[PR #3526] [MERGED] fix(reconstruction): withhold readiness for manifest references to absent Evidence #5803

Closed
opened 2026-10-31 01:09:33 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3526
Author: @kaoru0822-kitauji
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/ledger-missing-manifest-evidence


📝 Commits (1)

  • 3a6ec79 fix(reconstruction): withhold readiness for manifest references to absent Evidence

📊 Changes

3 files changed (+124 additions, -52 deletions)

View changed files

📝 src/application/ReconstructionObligationLedger.closure.test.ts (+108 -52)
📝 src/application/ReconstructionObligationLedgerEvaluation.ts (+8 -0)
📝 src/application/ReconstructionObligationOriginalCases.ts (+8 -0)

📄 Description

Summary

build-reconstruction-obligation-ledger reported an obligation as verified and the ledger as ready when a manifest original case or fixture referenced an Evidence ID missing from the bundle, as long as another entry of the same case kind was valid. Fixes #3363.

Problem and expected behavior

docs/reconstruction-obligation-ledgers.md says: "All referenced Evidence IDs must exist in the bundle." For each required case kind, originalCaseDiagnostics and evaluateBinding only asked whether some entry had authenticated Evidence (cases.some(...), fixtures.some(...)). One valid entry therefore hid another entry's dangling reference. That ID also appeared in evidence_links, with no diagnostic.

Change and scope

  • ReconstructionObligationOriginalCases.ts: every original case whose evidence_id is missing from the bundle adds missing-original-case, with a detail naming the ID.
  • ReconstructionObligationLedgerEvaluation.ts evaluateBinding: every fixture evidence_ids entry missing from the bundle adds missing-case, with a detail naming the fixture and the ID.
  • Any diagnostic already makes the obligation implemented instead of verified, so readiness is withheld. The existing codes are reused with precise details, so the schema doesn't change. The "some entry has sufficient authority" rules for present Evidence are unchanged.
  • Not changed: the dangling ID stays in evidence_links as a record of what the manifest claimed. The new diagnostic now explains it.

Contribution scope: an ordinary fix within existing boundaries, so no maintainer scope decision is needed.

Contract and boundary impact

  • Semantic owner and earliest changed stage: ledger evaluation of manifest bindings (evaluateBinding, originalCaseDiagnostics).

  • Contribution scope fit and linked maintainer decision: not applicable (ordinary fix).

  • CLI and MCP/tool-catalog contract: no schema change. Ledgers with dangling manifest references are no longer ready.

  • Provider, bridge, target-format, or platform compatibility: none.

  • Evidence, artifact, provenance, or reconstruction contract: matches the documented rule that referenced Evidence must be in the bundle.

  • Target selection, authority, upstream behavior, and cleanup details: unchanged.

  • Generated metadata: none.

  • Read existing files or captured data.

Evidence and regression coverage

  • Tests added or updated (src/application/ReconstructionObligationLedger.closure.test.ts):
    • New: withholds readiness when a manifest entry names absent Evidence. It starts from the existing ready packaged-process request and adds one dangling original case, then one dangling fixture. Each must be non-ready and implemented, with exactly one diagnostic naming the absent ID. It fails on base (1 failed, 11 passed).
    • The ready-request setup moved into a shared readyProcessLedgerRequest() helper so the describe block stays within the 150-line lint limit. The existing closure test is otherwise unchanged.
  • Base reproduction (the #3363 script through the built CLI):
variant main this PR
control ready, verified, no diagnostics unchanged
missing-fixture ready, verified, no diagnostics, dangling link open, implemented, missing-case: positive fixture sample.old references Evidence ev_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, which is absent from the bundle.
missing-original ready, verified, no diagnostics, dangling link open, implemented, missing-original-case: Original positive case references Evidence ev_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, which is absent from the bundle.
  • Cost: one map lookup per referenced ID. CLI wall time is about 0.35 s before and after.

  • Remaining proof gaps: none known. This is a pure evaluation change.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:local -- src/application/ReconstructionObligationLedger.closure.test.ts src/application/ReconstructionObligationLedger.authority.test.ts src/application/ReconstructionObligationCandidates.test.ts: 12 passed
  • npm run test:focused -- tests/boundary/mcp/reconstructionObligationLedgerMcp.test.ts tests/boundary/cli/reconstructionObligationLedgerCli.test.ts src/domain/reconstructionObligationLedgerSchemas.test.ts src/domain/reconstructionReadiness.test.ts: 26 passed
  • npm run check:fast: passed
  • git merge-tree against #3524 (same test file): no conflict

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Ledgers that cited missing Evidence were wrongly ready; they now report the dangling reference.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no change.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/3526 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/ledger-missing-manifest-evidence` --- ### 📝 Commits (1) - [`3a6ec79`](https://github.com/morluto/rea/commit/3a6ec79bb922b134788718ed5c418eb20b1bf882) fix(reconstruction): withhold readiness for manifest references to absent Evidence ### 📊 Changes **3 files changed** (+124 additions, -52 deletions) <details> <summary>View changed files</summary> 📝 `src/application/ReconstructionObligationLedger.closure.test.ts` (+108 -52) 📝 `src/application/ReconstructionObligationLedgerEvaluation.ts` (+8 -0) 📝 `src/application/ReconstructionObligationOriginalCases.ts` (+8 -0) </details> ### 📄 Description ## Summary `build-reconstruction-obligation-ledger` reported an obligation as `verified` and the ledger as `ready` when a manifest original case or fixture referenced an Evidence ID missing from the bundle, as long as another entry of the same case kind was valid. Fixes #3363. ## Problem and expected behavior `docs/reconstruction-obligation-ledgers.md` says: "All referenced Evidence IDs must exist in the bundle." For each required case kind, `originalCaseDiagnostics` and `evaluateBinding` only asked whether *some* entry had authenticated Evidence (`cases.some(...)`, `fixtures.some(...)`). One valid entry therefore hid another entry's dangling reference. That ID also appeared in `evidence_links`, with no diagnostic. ## Change and scope - `ReconstructionObligationOriginalCases.ts`: every original case whose `evidence_id` is missing from the bundle adds `missing-original-case`, with a detail naming the ID. - `ReconstructionObligationLedgerEvaluation.ts` `evaluateBinding`: every fixture `evidence_ids` entry missing from the bundle adds `missing-case`, with a detail naming the fixture and the ID. - Any diagnostic already makes the obligation `implemented` instead of `verified`, so readiness is withheld. The existing codes are reused with precise details, so the schema doesn't change. The "some entry has sufficient authority" rules for *present* Evidence are unchanged. - Not changed: the dangling ID stays in `evidence_links` as a record of what the manifest claimed. The new diagnostic now explains it. Contribution scope: an ordinary fix within existing boundaries, so no maintainer scope decision is needed. ## Contract and boundary impact - Semantic owner and earliest changed stage: ledger evaluation of manifest bindings (`evaluateBinding`, `originalCaseDiagnostics`). - Contribution scope fit and linked maintainer decision: not applicable (ordinary fix). - CLI and MCP/tool-catalog contract: no schema change. Ledgers with dangling manifest references are no longer `ready`. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: matches the documented rule that referenced Evidence must be in the bundle. - Target selection, authority, upstream behavior, and cleanup details: unchanged. - Generated metadata: none. - [x] Read existing files or captured data. ## Evidence and regression coverage - Tests added or updated (`src/application/ReconstructionObligationLedger.closure.test.ts`): - New: `withholds readiness when a manifest entry names absent Evidence`. It starts from the existing ready packaged-process request and adds one dangling original case, then one dangling fixture. Each must be non-ready and `implemented`, with exactly one diagnostic naming the absent ID. It fails on base (1 failed, 11 passed). - The ready-request setup moved into a shared `readyProcessLedgerRequest()` helper so the describe block stays within the 150-line lint limit. The existing closure test is otherwise unchanged. - Base reproduction (the #3363 script through the built CLI): | variant | main | this PR | |---|---|---| | control | `ready`, `verified`, no diagnostics | unchanged | | missing-fixture | `ready`, `verified`, no diagnostics, dangling link | `open`, `implemented`, `missing-case: positive fixture sample.old references Evidence ev_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, which is absent from the bundle.` | | missing-original | `ready`, `verified`, no diagnostics, dangling link | `open`, `implemented`, `missing-original-case: Original positive case references Evidence ev_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, which is absent from the bundle.` | - Cost: one map lookup per referenced ID. CLI wall time is about 0.35 s before and after. - Remaining proof gaps: none known. This is a pure evaluation change. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:local -- src/application/ReconstructionObligationLedger.closure.test.ts src/application/ReconstructionObligationLedger.authority.test.ts src/application/ReconstructionObligationCandidates.test.ts`: 12 passed - `npm run test:focused -- tests/boundary/mcp/reconstructionObligationLedgerMcp.test.ts tests/boundary/cli/reconstructionObligationLedgerCli.test.ts src/domain/reconstructionObligationLedgerSchemas.test.ts src/domain/reconstructionReadiness.test.ts`: 26 passed - `npm run check:fast`: passed - `git merge-tree` against #3524 (same test file): no conflict ## Compatibility, safety, and release - Breaking changes or migration steps: none. Ledgers that cited missing Evidence were wrongly `ready`; they now report the dangling reference. - Real Hopper/Ghidra, browser, or OS coverage: not applicable. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no change. ## Author readiness Human owner: <!-- @GitHub-handle --> - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. ## Before merge - [ ] This PR addresses a concrete problem or an agreed enhancement. - [ ] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [ ] The PR has one focused outcome and the title follows `type(scope): outcome`. - [ ] Related issue is linked, or the reason for not linking one is stated above. - [ ] Tests cover changed observable behavior and meaningful failure paths. - [ ] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. - [ ] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:09:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5803
No description provided.