[PR #461] [MERGED] fix: harden evidence lifecycle and MCP contracts #2007

Closed
opened 2026-10-16 21:13:18 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/461
Author: @morluto
Created: 8/3/2026
Status: ✅ Merged
Merged: 8/3/2026
Merged by: @morluto

Base: main ← Head: agent/comprehensive-repository-audit


📝 Commits (9)

  • 8657af4 fix: harden evidence lifecycle and MCP contracts
  • b069e77 refactor: remove remaining lint debt
  • 8625fdb fix: close MCP contract review gaps
  • 024255d Merge remote-tracking branch 'origin/main' into agent/comprehensive-repository-audit
  • 886cbd5 chore: refresh merged MCP catalog
  • 7e60bf8 chore: regenerate conformance manifest
  • c985f36 fix: complete MCP schema metadata
  • 926cef3 fix(mcp): notify evidence bundle subscribers
  • 918faa9 fix: preserve valid readiness schema composition

📊 Changes

47 files changed (+1452 additions, -404 deletions)

View changed files

📝 README.md (+1 -1)
📝 README_ar.md (+1 -1)
📝 README_ja.md (+1 -1)
📝 README_ko.md (+1 -1)
📝 README_zh.md (+1 -1)
📝 docs/mcp-contracts.md (+11 -2)
📝 docs/product-catalog.json (+6 -5)
📝 docs/testing.md (+20 -18)
📝 docs/verification/managed-conformance-manifest.json (+2 -2)
📝 package.json (+7 -5)
📝 scripts/generate-mcp-tool-catalog.mjs (+7 -3)
📝 skills/reverse-engineer-anything/SKILL.md (+2 -2)
📝 src/application/AnalysisContextQueries.ts (+33 -16)
📝 src/application/BinarySessionPort.ts (+3 -0)
📝 src/application/BinarySessionRecords.ts (+29 -4)
📝 src/application/CapabilityInventory.ts (+102 -12)
📝 src/application/EvidenceBundleCommands.ts (+5 -1)
📝 src/application/EvidenceLedger.ts (+16 -2)
➕ src/contracts/sessionToolSchemas.ts (+90 -0)
📝 src/contracts/toolContractExamples.ts (+1 -0)

...and 27 more files

📄 Description

Summary

This PR closes the main developer-experience bottlenecks found in the repository audit.

  • Makes retained evidence bundles explicitly session-scoped, releasable, permission-checked, snapshot-observable, and URI-invalidating.
  • Fixes evidence import accounting, malformed bookmark facet handling, navigation capability-mode reporting, and observer failure containment.
  • Publishes fail-closed MCP JSON Schema constraints for cross-field pairs, sensitive-data approvals, Evidence-source alternatives, export-shape links, and the complete readiness-stage set.
  • Separates MCP boundary tests into a dedicated threaded Vitest project while preserving the existing two-worker cap and routing all standard scripts through the new project.
  • Refreshes generated catalogs, documentation facts, package metadata, completion evidence, and contributor-facing test guidance.
  • Removes the remaining Oxlint debt by extracting contract helpers and session schemas, decomposing MCP server/session registration, and reducing complexity in provenance and process-tree reconstruction.

Related: #18

Root causes addressed

Runtime refinements were stronger than the advertised MCP schemas, so clients could be told that invalid inputs were valid. Retained evidence deletion bypassed the session’s mutation/notification/authorization boundaries. The MCP suite shared the slower fork-based boundary execution path, which increased process overhead and made the intended test ownership unclear. These changes move the constraints and lifecycle rules to their canonical boundaries instead of adding caller-specific workarounds.

The review follow-up corrected seven gaps: readiness-stage cardinality is nested under properties.stages without closing partial compositional schemas; passive and scenario capture inputs are mutually exclusive; bundle analysis inherits all relevant console/JSON/WebSocket/source-map approvals; source comparison requires exactly one application source; navigation preserves the most specific unavailable-mode reason instead of collapsing unsupported hosts to provider_missing; and releasing a retained evidence bundle notifies subscribers for the exact invalidated URI.

The CI documentation failure had a separate generated-artifact root cause: the committed managed-conformance manifest had been generated under Node 22 while CI uses the repository’s Node 24 runtime. The manifest was regenerated under Node 24.18.0 and validated with docs:check.

Validation

  • npm run test:fast — passed: 305 files, 1,522 tests.
  • npm run test:integration — passed: 184 files, 957 tests.
  • npm run verify:test-temp-hygiene — passed: 324 files, 1,641 tests; no owned temporary residues.
  • npm run check:ci — passed.
  • npm run docs:check — passed under Node 24.18.0.
  • Focused MCP boundary regressions for schema advertisement and evidence release — passed.
  • npm run format:check, npm run typecheck, and npm run lint — passed; Oxlint reports 0 warnings and 0 errors.
  • Fresh PR CI at head 918faa9f — all checks passed, including all four test shards, coverage/timing, package E2Es, Windows Ghidra, Docs Generation, static checks, real browser, and real replay.
  • TypeDoc still emits 196 existing non-fatal “referenced but not included in documentation” warnings during docs:check; the generated-document check passes.

Real Hopper and managed-tool verifiers were not run in this Linux checkout because their external provider prerequisites were unavailable. The CI real browser, replay, and Windows Ghidra lanes passed.

Review notes

All seven actionable review threads were addressed and marked resolved. The final tree was checked with focused behavioral tests, deterministic suites, static gates, generated-document checks, fresh CI, and exact-diff inspection.


🔄 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/461 **Author:** [@morluto](https://github.com/morluto) **Created:** 8/3/2026 **Status:** ✅ Merged **Merged:** 8/3/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `agent/comprehensive-repository-audit` --- ### 📝 Commits (9) - [`8657af4`](https://github.com/morluto/rea/commit/8657af4e4644a8ce721bfbf44bea355f3617cc54) fix: harden evidence lifecycle and MCP contracts - [`b069e77`](https://github.com/morluto/rea/commit/b069e770d42863d0944e9292887bbc2817d29873) refactor: remove remaining lint debt - [`8625fdb`](https://github.com/morluto/rea/commit/8625fdb0ed066f4d19ebe9b2fd892b0d92aade5c) fix: close MCP contract review gaps - [`024255d`](https://github.com/morluto/rea/commit/024255db3d363a1bd82771fa40476dcbd779cafa) Merge remote-tracking branch 'origin/main' into agent/comprehensive-repository-audit - [`886cbd5`](https://github.com/morluto/rea/commit/886cbd5aa71de2dc934e5da8c24f94c54353cee5) chore: refresh merged MCP catalog - [`7e60bf8`](https://github.com/morluto/rea/commit/7e60bf8b7b2c78233df50c2d3a7d046ae94be635) chore: regenerate conformance manifest - [`c985f36`](https://github.com/morluto/rea/commit/c985f36ee05a4e34e9095b48394614c525004e19) fix: complete MCP schema metadata - [`926cef3`](https://github.com/morluto/rea/commit/926cef35feceebb66675f18ef956d710955cdbf1) fix(mcp): notify evidence bundle subscribers - [`918faa9`](https://github.com/morluto/rea/commit/918faa9fa5b83284cdd9622d7d42689cac66d237) fix: preserve valid readiness schema composition ### 📊 Changes **47 files changed** (+1452 additions, -404 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -1) 📝 `README_ar.md` (+1 -1) 📝 `README_ja.md` (+1 -1) 📝 `README_ko.md` (+1 -1) 📝 `README_zh.md` (+1 -1) 📝 `docs/mcp-contracts.md` (+11 -2) 📝 `docs/product-catalog.json` (+6 -5) 📝 `docs/testing.md` (+20 -18) 📝 `docs/verification/managed-conformance-manifest.json` (+2 -2) 📝 `package.json` (+7 -5) 📝 `scripts/generate-mcp-tool-catalog.mjs` (+7 -3) 📝 `skills/reverse-engineer-anything/SKILL.md` (+2 -2) 📝 `src/application/AnalysisContextQueries.ts` (+33 -16) 📝 `src/application/BinarySessionPort.ts` (+3 -0) 📝 `src/application/BinarySessionRecords.ts` (+29 -4) 📝 `src/application/CapabilityInventory.ts` (+102 -12) 📝 `src/application/EvidenceBundleCommands.ts` (+5 -1) 📝 `src/application/EvidenceLedger.ts` (+16 -2) ➕ `src/contracts/sessionToolSchemas.ts` (+90 -0) 📝 `src/contracts/toolContractExamples.ts` (+1 -0) _...and 27 more files_ </details> ### 📄 Description ## Summary This PR closes the main developer-experience bottlenecks found in the repository audit. - Makes retained evidence bundles explicitly session-scoped, releasable, permission-checked, snapshot-observable, and URI-invalidating. - Fixes evidence import accounting, malformed bookmark facet handling, navigation capability-mode reporting, and observer failure containment. - Publishes fail-closed MCP JSON Schema constraints for cross-field pairs, sensitive-data approvals, Evidence-source alternatives, export-shape links, and the complete readiness-stage set. - Separates MCP boundary tests into a dedicated threaded Vitest project while preserving the existing two-worker cap and routing all standard scripts through the new project. - Refreshes generated catalogs, documentation facts, package metadata, completion evidence, and contributor-facing test guidance. - Removes the remaining Oxlint debt by extracting contract helpers and session schemas, decomposing MCP server/session registration, and reducing complexity in provenance and process-tree reconstruction. Related: #18 ## Root causes addressed Runtime refinements were stronger than the advertised MCP schemas, so clients could be told that invalid inputs were valid. Retained evidence deletion bypassed the session’s mutation/notification/authorization boundaries. The MCP suite shared the slower fork-based boundary execution path, which increased process overhead and made the intended test ownership unclear. These changes move the constraints and lifecycle rules to their canonical boundaries instead of adding caller-specific workarounds. The review follow-up corrected seven gaps: readiness-stage cardinality is nested under `properties.stages` without closing partial compositional schemas; passive and scenario capture inputs are mutually exclusive; bundle analysis inherits all relevant console/JSON/WebSocket/source-map approvals; source comparison requires exactly one application source; navigation preserves the most specific unavailable-mode reason instead of collapsing unsupported hosts to `provider_missing`; and releasing a retained evidence bundle notifies subscribers for the exact invalidated URI. The CI documentation failure had a separate generated-artifact root cause: the committed managed-conformance manifest had been generated under Node 22 while CI uses the repository’s Node 24 runtime. The manifest was regenerated under Node 24.18.0 and validated with `docs:check`. ## Validation - `npm run test:fast` — passed: 305 files, 1,522 tests. - `npm run test:integration` — passed: 184 files, 957 tests. - `npm run verify:test-temp-hygiene` — passed: 324 files, 1,641 tests; no owned temporary residues. - `npm run check:ci` — passed. - `npm run docs:check` — passed under Node 24.18.0. - Focused MCP boundary regressions for schema advertisement and evidence release — passed. - `npm run format:check`, `npm run typecheck`, and `npm run lint` — passed; Oxlint reports 0 warnings and 0 errors. - Fresh PR CI at head `918faa9f` — all checks passed, including all four test shards, coverage/timing, package E2Es, Windows Ghidra, Docs Generation, static checks, real browser, and real replay. - TypeDoc still emits 196 existing non-fatal “referenced but not included in documentation” warnings during `docs:check`; the generated-document check passes. Real Hopper and managed-tool verifiers were not run in this Linux checkout because their external provider prerequisites were unavailable. The CI real browser, replay, and Windows Ghidra lanes passed. ## Review notes All seven actionable review threads were addressed and marked resolved. The final tree was checked with focused behavioral tests, deterministic suites, static gates, generated-document checks, fresh CI, and exact-diff inspection. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:13:18 +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#2007
No description provided.