Behavior parity is an observable contract
Parity evidence compares source and target on the same representative inputs; it does not merely check that the target compiles. The contract may contain outputs, errors, status codes, side effects, ordering, timing, idempotency, retries, and persistence behavior—only the measures that are truly observable to the consumer.
The comparison must separate expected equivalence, acceptable difference, and blocking discrepancy. If the oracle or baseline is missing, the result is not “parity,” but Unknown.
Source-to-target comparison matrix
| Dimension | Source baseline | Target observation | Decision |
|---|---|---|---|
| Inputs | representative request/state | same controlled input | confirm coverage |
| Output | value, status, shape | target value, status, shape | equivalent or investigate |
| Errors | type, code, message boundary | target error behavior | blocking on contract drift |
| Side effects | writes/events/notifications | target effects and count | check idempotency |
| Ordering/timing | observable sequence/latency class | target sequence/latency class | only if the contract requires it |
| Evidence | command, test, log, fixture | matching anchor | Unknown without anchors |
Evidence collection order
- Define representative cases and record the source revision and environment assumptions.
- Record the observable contract: inputs, outputs, errors, side effects, and invariants.
- Repeat the same cases on the target in a controlled surface.
- Compare results for each dimension instead of reducing everything to one score.
- Save evidence anchors, discrepancy, confidence, and the owner of the next decision.
- Stop or choose HOLD when there is an unexplained difference or no oracle.
What does not prove parity
- a successful build without runtime or contract checks;
- one happy-path case without errors and side effects;
- the same internal implementation or class names;
- a general “compatible” statement without source/target observations;
- a filled template without actual command or test outputs.
Canonical lesson source · JavaRush
Open JavaRush material