Repository navigation
fix(reconstruction): check every selected replay environment - #2971
555aaditya wants to merge 1 commit into
Conversation
Behavioral reconstruction claims compared the environment of only the first left and first right source observation. A comparison that selects several observations per side through left_evidence_ids/right_evidence_ids could therefore pass even when a later observation ran in a different or missing controlled-replay environment. Require every selected source to carry an environment and all of them to match before a behavioral claim can pass; otherwise the existing "Controlled replay environments are unavailable or incompatible." limitation keeps the claim unknown. Single-pair comparisons behave as before. Fixes morluto#2622
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Preserve XML and Interface Builder identity at their parsing boundary, retain usable Objective-C slots with precise coverage, and keep native trace failures distinct from absence. Add caller-selected Interface Builder summaries backed by complete retained Evidence, and preserve comparison limitations. Reviewed fixes: #1969, #2088, #2108, #2513, #2639, #2684, #2731, #2759, #2875, #2888, #2889, #2970, #2971, #3002. Validation: relevant native/domain focused lane passed 142 tests; earlier Interface Builder/MCP checks passed 24 tests. Real native UI and Ghidra producer coverage was not repeated.
|
Closing as superseded: this fix and its regression coverage landed on main in 55dd21a. Thanks for integrating it! |
|
Thanks @555aaditya for finding that behavioral reconstruction compared only the first selected replay environment on each side. Main now checks every selected environment and keeps missing or differing environment facts from being treated as aligned (main). |
Summary
Fixes #2622.
A behavioral reconstruction claim checked the controlled-replay environment of only the first left source and the first right source. A process comparison can select several observations per side (
left_evidence_ids/right_evidence_ids, accepted bycomparisonSourceEvidenceSidesand reachable throughimport_evidence_bundle). So a later observation recorded in a different environment, or with none, did not stop the claim from reportingpass. That made an incomparable claim look verified.After this change, every selected source must carry an environment and all of them must be identical. Otherwise the existing
Controlled replay environments are unavailable or incompatible.limitation is added and the claim staysunknown. Single-pair comparisons, which are what the publiccompare_process_capturesproducer emits today, behave exactly as before.Problem and expected behavior
Smallest trigger: a
rea.process-comparisonrecord with two observations per side, where one of the later observations was captured in a different (or missing) environment:env-aenv-benv-aenv-averifyReconstructionreturnspass.unknown, withControlled replay environments are unavailable or incompatible.Violated invariant: a
passmay only cover declared claims whose source observations are comparable (.agents/skills/reverse-engineer-anything/references/evidence-workflows.md). The environment check insrc/domain/reconstructionVerification.tslooked upsides.left[0]andsides.right[0]only, so comparability was never established for the remaining sources.Change and scope
authorityLimitationsalready receivessources, which is exactly the resolved, deduplicated union of both sides. Every id there has already been resolved, and a missing record throws earlier. The fix compares every source's environment against the first one, and flagsnullenvironments, in that same function. It removes the first-source-only lookup map instead of adding a second check next to it, so there is one owner for this rule.The environment comparison still uses
JSON.stringify, as before, so the only behavioural change is which sources are checked.Not included: changing how environments are compared (canonical vs. serialized). That is unrelated to this bug.
Contribution scope: an ordinary correctness fix within an existing boundary, so a maintainer scope decision is not applicable.
Contract and boundary impact
src/domain/reconstructionVerification.ts, inauthorityLimitations(domain, pure).verify_reconstruction/verify-reconstructioncan now returnunknownwhere it previously returnedpass, but only for multi-source comparisons with mismatched or missing environments.passnow requires every selected observation to share one environment. The limitation text is unchanged.Expected effects:
(The verifier only reads in-memory Evidence; it launches nothing.)
Evidence and regression coverage
Tests added or updated:
src/domain/reconstructionVerification.test.ts, testlimits behavioral claims by every selected replay environment. It covers the restoration checks listed in the issue:unknown+ limitation;unknown+ limitation (so the result can't depend on source order);null) environment →unknown+ limitation;unknown+ limitation (existing behaviour kept);pass, without the environment limitation.To support this, the
sourcefixture takes an options object{ captureResult?, replayEnvironment? }in place of its trailingcaptureResultparameter, which keeps it withinmax-params. AmultiSourceProcessComparisonhelper buildsleft_evidence_ids/right_evidence_idscomparisons. The one existing caller that passedcaptureResultpositionally is updated.Base reproduction: with only the source change reverted, the new test fails (
1 failed | 9 passed). Base returnspassfor the later-mismatch cases. With the change, all 10 tests in the file pass.User-visible CLI/MCP output: no new fields. Affected multi-source claims report
status: "unknown"and include the existing environment limitation.Remaining proof gaps: I didn't run an end-to-end
import_evidence_bundle→verify_reconstructionMCP session with a hand-built multi-source bundle. The domain function changed here is the one those adapters call.For evidence-bearing changes:
Validation performed
All run on macOS (arm64), Node 26.5.0, npm 11.17.0, with locked dependencies, rebased on
origin/mainat7a6defab1:npx vitest run --project domain src/domain/reconstructionVerification.test.ts: 10 passed. With the source fix reverted: 1 failed (the new test), 9 passed.npx vitest run --project domain src/domain/reconstructionVerification.test.ts src/domain/reconstructionVerification.functionSources.test.ts: 78 passed.npx vitest run --project domain: 162 files, 2503 passed, 3 skipped.npx vitest run tests/boundary/mcp/reconstructionCoverageMcp.test.ts tests/boundary/mcp/reconstructionObligationLedgerMcp.test.ts tests/boundary/mcp/processEvidenceIdentityMcp.test.ts: passed.npm run test:focused -- tests/boundary/cli/reconstructionObligationLedgerCli.test.ts src/domain/reconstructionVerification.test.ts: 11 passed.npm run check:fast(typecheck + lint + module boundaries): passed, also via the pre-push hook.npx oxfmt --checkandnpx oxlinton both changed files: clean.Compatibility, safety, and release
Before merge
type(scope): outcome.