[PR #1733] [MERGED] fix(evidence): normalize unknown revisions and preserve mutation intent #4783

Closed
opened 2026-10-31 00:55:00 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1733
Author: @N0zoM1z0
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/residual-unknown-intent


📝 Commits (1)

  • 2b5721d fix(evidence): normalize unknown revisions and preserve mutation intent

📊 Changes

7 files changed (+364 additions, -133 deletions)

View changed files

📝 src/application/WorkflowEvidence.test.ts (+48 -0)
📝 src/application/investigation/InvestigationRecords.test.ts (+71 -3)
📝 src/application/investigation/InvestigationRecords.ts (+12 -27)
📝 src/application/investigation/UnknownEvidence.ts (+26 -15)
📝 src/domain/residualUnknown.test.ts (+106 -1)
📝 src/domain/residualUnknown.ts (+81 -69)
📝 tests/boundary/mcp/workflowSnapshotReplayMcp.test.ts (+20 -18)

📄 Description

Provider-contract-accepted residual questions with edge whitespace could fail workflow retention with a revision-digest error. Different successful update_unknown requests could also generate identical mutation Evidence because most requested fields were omitted.

Normalize generated revision fields before hashing, share their semantic validation with the authenticated import schema, and compute each generated revision digest once. Consolidate creation/update mutation Evidence at its typed owner and retain the full command, preserving first-occurrence Evidence-link ordering. The revision digest algorithm and canonical constructor outputs for the same mutation Evidence IDs remain unchanged; historical bundles remain valid. New mutation Evidence IDs bind the complete request and therefore also affect new revision digests.

Closes #1723
Closes #1724

Validation:

  • npm run check and npm run docs:check passed.
  • 55 relevant tests passed, including public MCP snapshot replay, CLI/file import and tamper rejection, optimistic-update rollback, and the unchanged >125,000-dependent capacity fixture at its normal deadline.
  • Three fresh real stdio sessions verified complete update parameters, distinct high/low mutation IDs, unchanged pre-fix bundle imports, ping and awaited cleanup.
  • Flameox inspected the actual Vitest fork and real constructor profiles. Three alternating 10,000-pair constructor runs reduced median process CPU from 856 ms to 591 ms (~31%) with identical aggregate identity/revision checksums and sampled records. This is a constructor microbenchmark, not an end-to-end latency claim.

Native boundaries are synthetic fixtures; no GUI, real native provider, live model or Windows runtime is claimed by local probes.


🔄 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/1733 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/11/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/residual-unknown-intent` --- ### 📝 Commits (1) - [`2b5721d`](https://github.com/morluto/rea/commit/2b5721d03855ddd9060d121e80d8c957d90dc80c) fix(evidence): normalize unknown revisions and preserve mutation intent ### 📊 Changes **7 files changed** (+364 additions, -133 deletions) <details> <summary>View changed files</summary> 📝 `src/application/WorkflowEvidence.test.ts` (+48 -0) 📝 `src/application/investigation/InvestigationRecords.test.ts` (+71 -3) 📝 `src/application/investigation/InvestigationRecords.ts` (+12 -27) 📝 `src/application/investigation/UnknownEvidence.ts` (+26 -15) 📝 `src/domain/residualUnknown.test.ts` (+106 -1) 📝 `src/domain/residualUnknown.ts` (+81 -69) 📝 `tests/boundary/mcp/workflowSnapshotReplayMcp.test.ts` (+20 -18) </details> ### 📄 Description Provider-contract-accepted residual questions with edge whitespace could fail workflow retention with a revision-digest error. Different successful `update_unknown` requests could also generate identical mutation Evidence because most requested fields were omitted. Normalize generated revision fields before hashing, share their semantic validation with the authenticated import schema, and compute each generated revision digest once. Consolidate creation/update mutation Evidence at its typed owner and retain the full command, preserving first-occurrence Evidence-link ordering. The revision digest algorithm and canonical constructor outputs for the same mutation Evidence IDs remain unchanged; historical bundles remain valid. New mutation Evidence IDs bind the complete request and therefore also affect new revision digests. Closes #1723 Closes #1724 Validation: - `npm run check` and `npm run docs:check` passed. - 55 relevant tests passed, including public MCP snapshot replay, CLI/file import and tamper rejection, optimistic-update rollback, and the unchanged >125,000-dependent capacity fixture at its normal deadline. - Three fresh real stdio sessions verified complete update parameters, distinct high/low mutation IDs, unchanged pre-fix bundle imports, ping and awaited cleanup. - Flameox inspected the actual Vitest fork and real constructor profiles. Three alternating 10,000-pair constructor runs reduced median process CPU from 856 ms to 591 ms (~31%) with identical aggregate identity/revision checksums and sampled records. This is a constructor microbenchmark, not an end-to-end latency claim. Native boundaries are synthetic fixtures; no GUI, real native provider, live model or Windows runtime is claimed by local probes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:55:00 +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#4783
No description provided.