Correct diff masking for historical descendants

This commit is contained in:
2026-10-09 13:22:40 +00:00
parent a4b5a6840a
commit 92025d65cb
5 changed files with 133 additions and 13 deletions

View File

@@ -248,8 +248,10 @@ Evidence: `go test ./internal/engine -run 'Diff|Effective|Snapshot'` and
`./scripts/check.sh` passed. Coverage includes both mapping/scalar directions,
mapping/sequence replacements with numeric path tokens, null/container changes,
nested sequence mismatches, historical-only descendant classification,
unrelated sensitive siblings, targeted masking through absence, and fallback
preserving an absent reported side.
unrelated sensitive siblings, and targeted masking through absence. Post-review
remediation corrects the original stronger-policy tests: historical descendants
alone do not mask same-kind scalars or public additions across absence. A
historical-only selector still triggers fallback for incompatible present kinds.
## Stage 6 — Distinguish hidden changes from unchanged masked content
@@ -279,6 +281,14 @@ unchanged masked mapping and sequence members, masked additions/removals,
sequence-length changes, structural fallback, and equal values with differing
classification but no changed region.
Post-review regressions also verify public-only sequence changes alongside an
unchanged scalar with historical sensitive descendants, plus public scalar
addition/removal across historical absence. These retain visible snapshots and
`HiddenChanged=false` while historical explanation sensitivity remains intact.
The corrected tests failed before remediation and passed after removing the
extra scalar/default fallback. Focused diff checks, `./scripts/check.sh`, and
`go test -race ./...` passed.
## Stage 7 — Assemble the complete engine diff operation
Status: complete. Scope: internal-facing records, serialization, and real loads.

View File

@@ -14,9 +14,16 @@ gates.
## 1. Restrict complete-region fallback to incompatible present shapes (P2)
Status: open.
Status: complete. The scalar/default descendant fallback is removed. The two
stronger-policy tests now require visible public content, and a separate
historical-only descendant case verifies that actual incompatible present kinds
still trigger complete-region masking. Public-load regressions cover the
unchanged scalar inside an atomic sequence and both addition/removal directions
across historical absence; they failed before the fix and pass afterward.
Historical sensitivity remains available to existing explanation rendering.
Focused diff tests, `./scripts/check.sh`, and `go test -race ./...` passed.
Affected: [diff_snapshot.go](../../internal/engine/diff_snapshot.go),
Affected at the reviewed commit: [diff_snapshot.go](../../internal/engine/diff_snapshot.go),
`preparePairedDiffNodes`, lines 63–66; and
[diff_snapshot_test.go](../../internal/engine/diff_snapshot_test.go),
`TestPreparePairedDiffSnapshotUsesHistoricalDescendantClassification`