[PR #7028] [MERGED] fix(evidence): link composed workflows to consumed observations #7585

Closed
opened 2026-11-03 13:38:53 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7028
Author: @WenyuChiou
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @morluto

Base: main ← Head: fix/5118-workflow-evidence-links-20261024


📝 Commits (1)

  • 7dff37a fix(evidence): link composed workflows to consumed observations

📊 Changes

9 files changed (+558 additions, -3 deletions)

View changed files

📝 src/application/AnalysisProvider.ts (+2 -0)
📝 src/application/DirectAnalysis.ts (+3 -0)
📝 src/application/WorkflowEvidence.ts (+12 -0)
📝 src/application/binary/AnalysisSnapshotCache.ts (+37 -0)
📝 src/application/binary/BinarySession.ts (+17 -3)
📝 src/server/registerEnhancedTools.ts (+3 -0)
➕ tests/boundary/filesystem/composedWorkflowEvidenceLinks.test.ts (+293 -0)
➕ tests/boundary/mcp/composedWorkflowEvidenceLinksMcp.test.ts (+67 -0)
➕ tests/fixtures/composedWorkflowEvidence.ts (+124 -0)

📄 Description

Summary

Fixes #5118 for session-backed composed observations with retained atomic Evidence.

A profiled binary_overview can return the right summary while its derived Evidence has no links to the atomic records already committed by the session. Both fresh and cached execution reproduced the loss.

Change and scope

  • Carry a session-issued Evidence ID only after successful recording. Strip provider-supplied IDs rather than treating them as retained provenance.
  • Preserve exact atomic identity through cache hits and validated snapshot import. Omit ambiguous matches and clear stale bindings.
  • Collect only successful observations returned through the current composed invocation, deduplicate and sort their IDs, and forward the links through both DirectAnalysis and MCP.
  • Preserve empty-link behavior when no retained record exists; do not invent records for profileless or uncacheable execution.

BinarySession owns recording authority, AnalysisSnapshotCache owns replay identity, and the composed workflow owns its invocation-local collection. This avoids inferring consumption from unrelated session history.

Contract and boundary impact

  • Semantic owner: session Evidence recording, snapshot replay and composed-workflow projection.
  • Scope decision: not applicable for this routine provenance fix within existing boundaries; no new provider or target execution/mutation capability.
  • CLI/MCP and public Evidence schema: unchanged; the existing evidence_links field now contains the consumed retained atomic IDs.
  • Persisted snapshot schema and provider/platform selection: unchanged. Internal metadata is optional and is not a claim that every operation has a retained record.
  • Target selection, process authority and cleanup: unchanged. No new target, process or network authority.
  • Generated metadata, dependencies, package and installation behavior: unchanged.

The changed logic reads captured observations and manages in-memory provenance. Broader workflow effects remain those of the selected existing provider; the regression runs use synthetic providers and static fixture files only.

Evidence and regression coverage

Executed against base 422ca5a8f80f2067ab05080d698e819f670f1822:

  • Before the fix, cold and warm production DirectAnalysis → BinarySession → Evidence-ledger fixtures both failed the exact evidence_links assertion. Summary, atomic-record and provider-call controls passed first.
  • Final coverage includes cache reuse, repeated/nested calls, unrelated history, concurrent independent wrappers, snapshot rehydration and ambiguity, provider-ID spoof rejection, stale-cache clearing, and empty/failed paths.
  • The actual MCP SDK/server with in-memory transport and the production CLI application entrypoint return matching consumed provenance. Repeated MCP overview reuses the atomic ID and invokes the provider once.
  • Early fixture setup/oracle lifetime failures were corrected and are not represented as product reproductions.

Independent automated static review found no remaining blocker. It inspected owner-issued identity, cache matching/reset/ambiguity, invocation-local collection and CLI/MCP forwarding; it did not independently execute tests or providers. This is not human review.

Validation performed

Linux cloud executor, Node 24.22.1 (repository pin), npm 11.9.0 (repository pin is 11.16.0), lockfile-pinned Vitest 5.0.3. Checks ran serially with bounded timeouts.

  • node node_modules/vitest/vitest.mjs run src/application/WorkflowEvidence.test.ts src/application/binary/AnalysisSnapshotCache.test.ts src/application/BinaryOverview.test.ts tests/composition/analysis-sessions/binarySession.test.ts tests/boundary/filesystem/directAnalysisSnapshotReplay.test.ts tests/boundary/mcp/workflowSnapshotReplayMcp.test.ts tests/boundary/mcp/composedWorkflowEvidenceLinksMcp.test.ts tests/boundary/filesystem/composedWorkflowEvidenceLinks.test.ts --maxWorkers 1 --no-file-parallelism — 136 passed, 2 Windows-only skips, 8 files.
  • node scripts/run-typescript.mjs --noEmit --checkers 1 --maxMemory 2G — whole-project typecheck passed.
  • node scripts/verify-module-boundaries.mjs with the six changed production paths — passed.
  • node scripts/verify-test-discovery.mjs — passed; 2,424 files discovered exactly once.
  • node scripts/verify/architecture-guards.mjs — passed; 2,031 sources.
  • Focused oxlint on all nine changed files — no errors; warnings remain, including cache stage complexity 21 against the threshold of 20.
  • Focused oxfmt --check and git diff --check — passed.

Main 97194c4b4808b2a9b79277c436ba9042c58b1b70 had no touched-file overlap and a clean local merge-tree check. That combined tree was not separately executed; test claims apply to the pinned-base patch.

Compatibility, safety, and remaining limits

No breaking schema migration, release metadata change or expanded authority. Ambiguous imported provenance remains unlinked rather than guessed.

Synthetic providers only: no real native tools/targets, packaged CLI subprocess, full npm run check, full suite/coverage, packaging or real-provider qualification. CI is separate from the local evidence. No performance improvement is claimed; process-family CPU/memory and token costs were not measured.

The API-published commit has different metadata from local reviewed commit 3bedc6452795f05f0cdb627bef02e5c2fb178cb9; the complete tree is identical: e70df9947ec1b1ce1ae772f038f011cab2afb642. All nine public file blob hashes were verified against the frozen reviewed files before opening this draft.

Author readiness

Human owner: @WenyuChiou

  • 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.

The human owner confirmed all three declarations and authorized recording them.

Before merge

  • Required current-head checks and relevant verification are satisfied or their gaps are explicitly resolved by maintainers.
  • The human owner has completed the readiness declarations for this PR.
  • Material scope and authority questions are resolved.

🔄 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/7028 **Author:** [@WenyuChiou](https://github.com/WenyuChiou) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/5118-workflow-evidence-links-20261024` --- ### 📝 Commits (1) - [`7dff37a`](https://github.com/morluto/rea/commit/7dff37afd213f5031e395c1ffcabe324a5728a54) fix(evidence): link composed workflows to consumed observations ### 📊 Changes **9 files changed** (+558 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/application/AnalysisProvider.ts` (+2 -0) 📝 `src/application/DirectAnalysis.ts` (+3 -0) 📝 `src/application/WorkflowEvidence.ts` (+12 -0) 📝 `src/application/binary/AnalysisSnapshotCache.ts` (+37 -0) 📝 `src/application/binary/BinarySession.ts` (+17 -3) 📝 `src/server/registerEnhancedTools.ts` (+3 -0) ➕ `tests/boundary/filesystem/composedWorkflowEvidenceLinks.test.ts` (+293 -0) ➕ `tests/boundary/mcp/composedWorkflowEvidenceLinksMcp.test.ts` (+67 -0) ➕ `tests/fixtures/composedWorkflowEvidence.ts` (+124 -0) </details> ### 📄 Description ## Summary Fixes #5118 for session-backed composed observations with retained atomic Evidence. A profiled `binary_overview` can return the right summary while its derived Evidence has no links to the atomic records already committed by the session. Both fresh and cached execution reproduced the loss. ## Change and scope - Carry a session-issued Evidence ID only after successful recording. Strip provider-supplied IDs rather than treating them as retained provenance. - Preserve exact atomic identity through cache hits and validated snapshot import. Omit ambiguous matches and clear stale bindings. - Collect only successful observations returned through the current composed invocation, deduplicate and sort their IDs, and forward the links through both DirectAnalysis and MCP. - Preserve empty-link behavior when no retained record exists; do not invent records for profileless or uncacheable execution. BinarySession owns recording authority, AnalysisSnapshotCache owns replay identity, and the composed workflow owns its invocation-local collection. This avoids inferring consumption from unrelated session history. ## Contract and boundary impact - Semantic owner: session Evidence recording, snapshot replay and composed-workflow projection. - Scope decision: not applicable for this routine provenance fix within existing boundaries; no new provider or target execution/mutation capability. - CLI/MCP and public Evidence schema: unchanged; the existing `evidence_links` field now contains the consumed retained atomic IDs. - Persisted snapshot schema and provider/platform selection: unchanged. Internal metadata is optional and is not a claim that every operation has a retained record. - Target selection, process authority and cleanup: unchanged. No new target, process or network authority. - Generated metadata, dependencies, package and installation behavior: unchanged. The changed logic reads captured observations and manages in-memory provenance. Broader workflow effects remain those of the selected existing provider; the regression runs use synthetic providers and static fixture files only. ## Evidence and regression coverage Executed against base `422ca5a8f80f2067ab05080d698e819f670f1822`: - Before the fix, cold and warm production DirectAnalysis → BinarySession → Evidence-ledger fixtures both failed the exact `evidence_links` assertion. Summary, atomic-record and provider-call controls passed first. - Final coverage includes cache reuse, repeated/nested calls, unrelated history, concurrent independent wrappers, snapshot rehydration and ambiguity, provider-ID spoof rejection, stale-cache clearing, and empty/failed paths. - The actual MCP SDK/server with in-memory transport and the production CLI application entrypoint return matching consumed provenance. Repeated MCP overview reuses the atomic ID and invokes the provider once. - Early fixture setup/oracle lifetime failures were corrected and are not represented as product reproductions. Independent automated static review found no remaining blocker. It inspected owner-issued identity, cache matching/reset/ambiguity, invocation-local collection and CLI/MCP forwarding; it did not independently execute tests or providers. This is not human review. ## Validation performed Linux cloud executor, Node 24.22.1 (repository pin), npm 11.9.0 (repository pin is 11.16.0), lockfile-pinned Vitest 5.0.3. Checks ran serially with bounded timeouts. - `node node_modules/vitest/vitest.mjs run src/application/WorkflowEvidence.test.ts src/application/binary/AnalysisSnapshotCache.test.ts src/application/BinaryOverview.test.ts tests/composition/analysis-sessions/binarySession.test.ts tests/boundary/filesystem/directAnalysisSnapshotReplay.test.ts tests/boundary/mcp/workflowSnapshotReplayMcp.test.ts tests/boundary/mcp/composedWorkflowEvidenceLinksMcp.test.ts tests/boundary/filesystem/composedWorkflowEvidenceLinks.test.ts --maxWorkers 1 --no-file-parallelism` — **136 passed, 2 Windows-only skips, 8 files**. - `node scripts/run-typescript.mjs --noEmit --checkers 1 --maxMemory 2G` — whole-project typecheck passed. - `node scripts/verify-module-boundaries.mjs` with the six changed production paths — passed. - `node scripts/verify-test-discovery.mjs` — passed; 2,424 files discovered exactly once. - `node scripts/verify/architecture-guards.mjs` — passed; 2,031 sources. - Focused `oxlint` on all nine changed files — no errors; warnings remain, including cache `stage` complexity 21 against the threshold of 20. - Focused `oxfmt --check` and `git diff --check` — passed. Main `97194c4b4808b2a9b79277c436ba9042c58b1b70` had no touched-file overlap and a clean local merge-tree check. That combined tree was not separately executed; test claims apply to the pinned-base patch. ## Compatibility, safety, and remaining limits No breaking schema migration, release metadata change or expanded authority. Ambiguous imported provenance remains unlinked rather than guessed. Synthetic providers only: no real native tools/targets, packaged CLI subprocess, full `npm run check`, full suite/coverage, packaging or real-provider qualification. CI is separate from the local evidence. No performance improvement is claimed; process-family CPU/memory and token costs were not measured. The API-published commit has different metadata from local reviewed commit `3bedc6452795f05f0cdb627bef02e5c2fb178cb9`; the complete tree is identical: `e70df9947ec1b1ce1ae772f038f011cab2afb642`. All nine public file blob hashes were verified against the frozen reviewed files before opening this draft. ## Author readiness Human owner: @WenyuChiou - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. The human owner confirmed all three declarations and authorized recording them. ## Before merge - [ ] Required current-head checks and relevant verification are satisfied or their gaps are explicitly resolved by maintainers. - [ ] The human owner has completed the readiness declarations for this PR. - [ ] Material scope and authority questions are resolved. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 13:38:53 +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#7585
No description provided.