[GH-ISSUE #1718] perf(evidence): reuse authenticated file snapshots during MCP session import #574

Closed
opened 2026-10-15 18:26:20 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @N0zoM1z0 on GitHub (Oct 11, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/1718

File-backed import_evidence_bundle currently authenticates a newly imported Evidence record three times across the filesystem reader, ledger parser, and immutable commit path. Each untrusted pass clones/validates the record and recomputes its semantic identifier. With unknowns, candidate validation also reconstructs and reparses an internally generated bundle.

At main revision 693ed332b58d05192f55b8192d2c0c4bc4f4824a, the path is:

  1. EvidenceBundleFiles.readEvidenceBundle → parseEvidenceBundle.
  2. EvidenceLedger.import → parseEvidenceBundle again.
  3. EvidenceLedger.#commit → immutableEvidence on the still-mutable parsed record.

This is redundant work at ownership boundaries, rather than a demonstrated loss of data or incorrect import result. The domain already recognizes exact authenticated immutable snapshots; plain Object.freeze does not confer trust.

A bounded Linux investigation used real stdio MCP with SDK 2.3.1 / Node 24.18.0 and a complete 3,062,416-byte JavaScript Evidence bundle. First import, duplicate import, semantic tamper rejection, full import/export equality, ping and owned-process cleanup passed before and after the proposed change. Server-only V8 profiles are retained and analyzed using Flameox. Shared-host wall-time samples vary substantially and do not establish a stable speedup percentage.

Suggested scope:

  • Seal an authenticated file snapshot specifically at the session-import boundary, then reuse its identity in the ledger.
  • Keep ordinary CLI/comparison file reads mutable and avoid adding a sealing pass to them.
  • Validate internally constructed unknown candidates directly with the existing immutable bundle constructor.
  • Preserve semantic authentication, manifest validation, malformed/process-capture diagnostics, atomic unknown merges, and detached public reads.

This does not resolve the separate large-snapshot admission/heap problem in #1680. It also does not propose truncating Evidence or changing output contracts.

Originally created by @N0zoM1z0 on GitHub (Oct 11, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/1718 File-backed `import_evidence_bundle` currently authenticates a newly imported Evidence record three times across the filesystem reader, ledger parser, and immutable commit path. Each untrusted pass clones/validates the record and recomputes its semantic identifier. With unknowns, candidate validation also reconstructs and reparses an internally generated bundle. At main revision `693ed332b58d05192f55b8192d2c0c4bc4f4824a`, the path is: 1. `EvidenceBundleFiles.readEvidenceBundle` → `parseEvidenceBundle`. 2. `EvidenceLedger.import` → `parseEvidenceBundle` again. 3. `EvidenceLedger.#commit` → `immutableEvidence` on the still-mutable parsed record. This is redundant work at ownership boundaries, rather than a demonstrated loss of data or incorrect import result. The domain already recognizes exact authenticated immutable snapshots; plain `Object.freeze` does not confer trust. A bounded Linux investigation used real stdio MCP with SDK 2.3.1 / Node 24.18.0 and a complete 3,062,416-byte JavaScript Evidence bundle. First import, duplicate import, semantic tamper rejection, full import/export equality, ping and owned-process cleanup passed before and after the proposed change. Server-only V8 profiles are retained and analyzed using Flameox. Shared-host wall-time samples vary substantially and do not establish a stable speedup percentage. Suggested scope: - Seal an authenticated file snapshot specifically at the session-import boundary, then reuse its identity in the ledger. - Keep ordinary CLI/comparison file reads mutable and avoid adding a sealing pass to them. - Validate internally constructed unknown candidates directly with the existing immutable bundle constructor. - Preserve semantic authentication, manifest validation, malformed/process-capture diagnostics, atomic unknown merges, and detached public reads. This does not resolve the separate large-snapshot admission/heap problem in #1680. It also does not propose truncating Evidence or changing output contracts.
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#574
No description provided.