[PR #1218] [MERGED] fix(javascript): allow cancellation during semantic graph commitment #2732

Closed
opened 2026-10-17 21:09:36 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: perf/1065-cooperative-semantic-validation


📝 Commits (1)

  • d6eaf57 fix(javascript): allow cancellation during semantic graph commitment

📊 Changes

5 files changed (+287 additions, -70 deletions)

View changed files

📝 docs/testing.md (+9 -0)
📝 src/application/javascript/JavaScriptApplicationCancellation.test.ts (+35 -0)
📝 src/application/javascript/JavaScriptArtifactReconstruction.ts (+1 -1)
📝 src/domain/javascript/javascriptSemanticGraph.ts (+111 -69)
📝 src/domain/javascript/javascriptSemanticGraphQuery.test.ts (+131 -0)

📄 Description

Large JavaScript semantic graphs hash and validate synchronously before the owned iterator is returned, delaying cancellation even though sealing already yields. Move the whole-graph commitment into the existing canonical digest steps and share batched integrity checks with synchronous construction and imported-record validation. Capture caller input before yielding and authenticate the graph only after all checks and sealing complete. CLI and MCP retain the same results and canonical IDs.

Complete real Notion 7.6.1 ASAR verification preserves the exact Evidence ID, 100,000 semantic nodes, 76,229 relations, 67,576 unknowns, and existing coverage limits. In one profiled pair under two CPUs and a 1.5 GiB Node heap, the uninterrupted semantic factory interval falls from 12.50 s to 4.93 s. Total analysis is 62.89 s before and 66.14 s after; this is a responsiveness change, with no overall throughput improvement claimed. Single-file parsing, eager schema cloning and sorting remain synchronous.

Actual stdio MCP cancellation during the new commitment phase stops the server in 4.7 ms, preserves prior Evidence, admits no cancelled result, and leaves the same connection usable for ping and a subsequent analysis. Sampled client/server peak RSS is 1.61 GiB under a 2.25 GiB family guard.

Verification:

  • npm run build:cached and npm run check:fast.
  • 55 focused graph/ownership/traversal/cancellation/SDK regressions; 31 semantic projection regressions.
  • Full real Notion application-service identity/profile comparison and actual stdio MCP cancellation/retention/reuse.
  • No new real Hopper/Ghidra verification for this provider-neutral JavaScript change.

Refs #1065.


🔄 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/1218 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `perf/1065-cooperative-semantic-validation` --- ### 📝 Commits (1) - [`d6eaf57`](https://github.com/morluto/rea/commit/d6eaf57d42e41200fcfd6bad4a2390b6bc50ba24) fix(javascript): allow cancellation during semantic graph commitment ### 📊 Changes **5 files changed** (+287 additions, -70 deletions) <details> <summary>View changed files</summary> 📝 `docs/testing.md` (+9 -0) 📝 `src/application/javascript/JavaScriptApplicationCancellation.test.ts` (+35 -0) 📝 `src/application/javascript/JavaScriptArtifactReconstruction.ts` (+1 -1) 📝 `src/domain/javascript/javascriptSemanticGraph.ts` (+111 -69) 📝 `src/domain/javascript/javascriptSemanticGraphQuery.test.ts` (+131 -0) </details> ### 📄 Description Large JavaScript semantic graphs hash and validate synchronously before the owned iterator is returned, delaying cancellation even though sealing already yields. Move the whole-graph commitment into the existing canonical digest steps and share batched integrity checks with synchronous construction and imported-record validation. Capture caller input before yielding and authenticate the graph only after all checks and sealing complete. CLI and MCP retain the same results and canonical IDs. Complete real Notion 7.6.1 ASAR verification preserves the exact Evidence ID, 100,000 semantic nodes, 76,229 relations, 67,576 unknowns, and existing coverage limits. In one profiled pair under two CPUs and a 1.5 GiB Node heap, the uninterrupted semantic factory interval falls from 12.50 s to 4.93 s. Total analysis is 62.89 s before and 66.14 s after; this is a responsiveness change, with no overall throughput improvement claimed. Single-file parsing, eager schema cloning and sorting remain synchronous. Actual stdio MCP cancellation during the new commitment phase stops the server in 4.7 ms, preserves prior Evidence, admits no cancelled result, and leaves the same connection usable for ping and a subsequent analysis. Sampled client/server peak RSS is 1.61 GiB under a 2.25 GiB family guard. Verification: - `npm run build:cached` and `npm run check:fast`. - 55 focused graph/ownership/traversal/cancellation/SDK regressions; 31 semantic projection regressions. - Full real Notion application-service identity/profile comparison and actual stdio MCP cancellation/retention/reuse. - No new real Hopper/Ghidra verification for this provider-neutral JavaScript change. Refs #1065. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:09:36 +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#2732
No description provided.