[PR #1934] [MERGED] fix(javascript): retain completed facts through cancellation #4922

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

📋 Pull Request Information

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

Base: main ← Head: codex/refactor-analysis-failure-boundaries


📝 Commits (2)

  • 6fd1fe3 fix(javascript): retain completed facts through cancellation
  • 2cdf2c1 chore: sync main for documentation validation

📊 Changes

6 files changed (+463 additions, -293 deletions)

View changed files

📝 docs/javascript-artifact-reconstruction.md (+5 -3)
📝 src/application/javascript/JavaScriptApplicationService.ts (+48 -10)
📝 src/application/javascript/JavaScriptArtifactReconstruction.ts (+28 -21)
📝 tests/acceptance/applications/javascriptCancellationCli.test.ts (+42 -6)
📝 tests/boundary/javascript/javascriptApplicationCancellation.test.ts (+207 -135)
📝 tests/boundary/mcp/javascriptAnalysisCancellation.test.ts (+133 -118)

📄 Description

Summary

Keep completed JavaScript source facts when cancellation arrives during analyzer cleanup, graph construction, Evidence sealing, or final publication. Previously these later checkpoints could return cancelled without the partial Evidence already recoverable from owned source facts. Found during the ongoing failure-boundary audit; no existing issue covers this specific handoff loss.

Problem and expected behavior

After source analysis completed, an aborting checkpoint could throw before the reconstruction's partial-Evidence branch. Later service checkpoints likewise discarded an already reconstructed result or sealed Evidence. A cancellation must stop remaining source acquisition/analysis while preserving the facts REA already owns.

Change and scope

  • After source adoption and worker cleanup, latch cancellation while finishing the existing graph projection cooperatively. Preserve cleanup/source interruption precedence and the existing cancellation error fields.
  • Keep the service's completed reconstruction, validated result and Evidence until publication. On cancellation, finish only missing validation/sealing stages without further progress callbacks and retain the resulting Evidence.
  • Strengthen phase tests, add cleanup/handoff timing regressions, exercise real CLI SIGINT during graph construction and hashing, and verify SDK cancellation at final publication preserves inspectable Evidence and a reusable session.
  • Remove the test file's empty grouping wrapper and document the completion behavior.

Contract and boundary impact

  • Semantic owner and earliest changed stage: JavaScript application workflow, immediately after source-fact adoption and analyzer cleanup.
  • CLI and MCP/tool-catalog contract: existing cancellation errors now retain partial Evidence at later phases; tool inputs/catalog unchanged. CLI SIGINT still exits 130.
  • Provider, bridge, target-format, or platform compatibility: static directory/ASAR workflows; no deep-provider or executable-target behavior changes.
  • Evidence, artifact, provenance, or reconstruction contract: preserve completed source facts, graph identity and prior session Evidence on cancellation. Final projection remains cooperative.
  • Process execution, authorization, cleanup, or containment impact: worker release precedes retained projection; existing cleanup failure precedence and resource ownership remain intact.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • The new cleanup/handoff regression failed on the base revision because partial_observation was missing, then passed with retained import relationships and source statistics.

  • Existing phase cases now require completed parsed facts through graph/result/Evidence phases and final publication.

  • Public CLI checks retain complete partial Evidence after SIGINT. SDK checks verify server completion, prior Evidence, retained analysis inspection, and another successful request.

  • MCP intermediate progress is rate-throttled, so the SDK publication case uses its guaranteed terminal notification rather than assuming every fast graph phase is emitted.

  • Remaining proof gaps: POSIX SIGINT cases skip native Windows; no real deep-analysis provider is involved or claimed. The full repository suite was not run.

  • 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 build:cached — passed with pinned Node 24.18.0.
  • Five focused JavaScript reconstruction/cancellation files — 56 tests passed in 11.40s, including real compiled CLI and SDK/MCP boundaries. Each case used a 5s deadline; none exceeded it.
  • npm run check:fast — passed.
  • npm run docs:check — passed.
  • Formatting, diff checks and pre-commit hooks — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: static local artifacts, real CLI and MCP on macOS; no deep-provider/runtime-target execution.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: caller-selected input and source provenance remain preserved; no configuration writes or new process authority.

Review checklist

  • Concrete evidence-retention bug, found during maintenance.
  • Focused outcome and Conventional Commit title.
  • Cancellation and completed-fact behavior verified across owning boundaries.
  • Owning documentation updated.
  • Representative CLI/MCP behavior exercised.
  • Diff checked for unrelated changes and unsupported claims.

🔄 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/1934 **Author:** [@morluto](https://github.com/morluto) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/11/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `codex/refactor-analysis-failure-boundaries` --- ### 📝 Commits (2) - [`6fd1fe3`](https://github.com/morluto/rea/commit/6fd1fe3691f0e08368df205e805c9692dd9cae38) fix(javascript): retain completed facts through cancellation - [`2cdf2c1`](https://github.com/morluto/rea/commit/2cdf2c1f7ad6af6402f152e6b6276cf623cd620c) chore: sync main for documentation validation ### 📊 Changes **6 files changed** (+463 additions, -293 deletions) <details> <summary>View changed files</summary> 📝 `docs/javascript-artifact-reconstruction.md` (+5 -3) 📝 `src/application/javascript/JavaScriptApplicationService.ts` (+48 -10) 📝 `src/application/javascript/JavaScriptArtifactReconstruction.ts` (+28 -21) 📝 `tests/acceptance/applications/javascriptCancellationCli.test.ts` (+42 -6) 📝 `tests/boundary/javascript/javascriptApplicationCancellation.test.ts` (+207 -135) 📝 `tests/boundary/mcp/javascriptAnalysisCancellation.test.ts` (+133 -118) </details> ### 📄 Description ## Summary Keep completed JavaScript source facts when cancellation arrives during analyzer cleanup, graph construction, Evidence sealing, or final publication. Previously these later checkpoints could return `cancelled` without the partial Evidence already recoverable from owned source facts. Found during the ongoing failure-boundary audit; no existing issue covers this specific handoff loss. ## Problem and expected behavior After source analysis completed, an aborting checkpoint could throw before the reconstruction's partial-Evidence branch. Later service checkpoints likewise discarded an already reconstructed result or sealed Evidence. A cancellation must stop remaining source acquisition/analysis while preserving the facts REA already owns. ## Change and scope - After source adoption and worker cleanup, latch cancellation while finishing the existing graph projection cooperatively. Preserve cleanup/source interruption precedence and the existing cancellation error fields. - Keep the service's completed reconstruction, validated result and Evidence until publication. On cancellation, finish only missing validation/sealing stages without further progress callbacks and retain the resulting Evidence. - Strengthen phase tests, add cleanup/handoff timing regressions, exercise real CLI SIGINT during graph construction and hashing, and verify SDK cancellation at final publication preserves inspectable Evidence and a reusable session. - Remove the test file's empty grouping wrapper and document the completion behavior. ## Contract and boundary impact - Semantic owner and earliest changed stage: JavaScript application workflow, immediately after source-fact adoption and analyzer cleanup. - CLI and MCP/tool-catalog contract: existing cancellation errors now retain partial Evidence at later phases; tool inputs/catalog unchanged. CLI SIGINT still exits 130. - Provider, bridge, target-format, or platform compatibility: static directory/ASAR workflows; no deep-provider or executable-target behavior changes. - Evidence, artifact, provenance, or reconstruction contract: preserve completed source facts, graph identity and prior session Evidence on cancellation. Final projection remains cooperative. - Process execution, authorization, cleanup, or containment impact: worker release precedes retained projection; existing cleanup failure precedence and resource ownership remain intact. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage - The new cleanup/handoff regression failed on the base revision because `partial_observation` was missing, then passed with retained import relationships and source statistics. - Existing phase cases now require completed parsed facts through graph/result/Evidence phases and final publication. - Public CLI checks retain complete partial Evidence after SIGINT. SDK checks verify server completion, prior Evidence, retained analysis inspection, and another successful request. - MCP intermediate progress is rate-throttled, so the SDK publication case uses its guaranteed terminal notification rather than assuming every fast graph phase is emitted. - Remaining proof gaps: POSIX SIGINT cases skip native Windows; no real deep-analysis provider is involved or claimed. The full repository suite was not run. - [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 build:cached` — passed with pinned Node 24.18.0. - Five focused JavaScript reconstruction/cancellation files — 56 tests passed in 11.40s, including real compiled CLI and SDK/MCP boundaries. Each case used a 5s deadline; none exceeded it. - `npm run check:fast` — passed. - `npm run docs:check` — passed. - Formatting, diff checks and pre-commit hooks — passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: static local artifacts, real CLI and MCP on macOS; no deep-provider/runtime-target execution. - Package or release metadata impact: none. - Security, privacy, process, or containment review: caller-selected input and source provenance remain preserved; no configuration writes or new process authority. ## Review checklist - [x] Concrete evidence-retention bug, found during maintenance. - [x] Focused outcome and Conventional Commit title. - [x] Cancellation and completed-fact behavior verified across owning boundaries. - [x] Owning documentation updated. - [x] Representative CLI/MCP behavior exercised. - [x] Diff checked for unrelated changes and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:56:48 +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#4922
No description provided.