[PR #4207] [MERGED] fix(javascript): preserve analysis applicability after interruption #6125

Closed
opened 2026-10-31 01:12:02 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/javascript-interruption-applicability


📝 Commits (3)

  • 04ca36a fix(javascript): preserve analysis applicability after interruption
  • 323fae8 test(javascript): require exact retained metadata processing phases
  • 40e0ce4 fix(javascript): own semantic file applicability in the projection

📊 Changes

18 files changed (+3717 additions, -93 deletions)

View changed files

📝 docs/javascript-artifact-reconstruction.md (+12 -0)
➕ docs/verification/javascript-interruption-applicability-2026-10-15.json (+2641 -0)
➕ docs/verification/javascript-interruption-applicability-2026-10-15.md (+245 -0)
➕ scripts/lib/javascript-file-scope-oracle.d.mts (+28 -0)
➕ scripts/lib/javascript-file-scope-oracle.mjs (+28 -0)
📝 scripts/verify/javascript/native-handoffs.mjs (+153 -19)
📝 src/application/javascript/JavaScriptArtifactAnalysis.ts (+48 -24)
📝 src/application/javascript/JavaScriptArtifactAnalysisTypes.ts (+46 -6)
📝 src/application/javascript/JavaScriptArtifactGraphContext.ts (+6 -3)
📝 src/application/javascript/JavaScriptArtifactGraphEvidence.ts (+8 -4)
📝 src/application/javascript/JavaScriptArtifactGraphStructure.ts (+16 -5)
📝 src/application/javascript/JavaScriptArtifactReconstruction.ts (+9 -3)
📝 src/application/javascript/JavaScriptSemanticGraphBuilder.ts (+4 -1)
📝 tests/acceptance/applications/javascriptAnalysisLimits.test.ts (+164 -28)
📝 tests/boundary/filesystem/javascript-applications/javascriptArtifactReconstruction.test.ts (+70 -0)
📝 tests/boundary/filesystem/javascriptArtifactReconstruction.test.ts (+25 -0)
📝 tests/boundary/javascript/javascriptApplicationCancellation.test.ts (+98 -0)
➕ tests/boundary/process/javascriptVerifierScopeOracle.test.ts (+116 -0)

📄 Description

Summary

After a source interruption, native binaries and unvisited metadata acquired JavaScript AST failure scopes; native files could also acquire phantom semantic modules. Preserve file-specific applicability/status at the producer and semantic projection boundaries.

Fixes #3948. Part of #4027; exact retained-fact delivery is separate #4190.

Problem and expected behavior

Native inventory and byte identity remain usable independently of source interruption. Package/JSON, HTML and source-map gaps describe their own unavailable processing; actual JavaScript failures, source-bound unknowns and caller exclusions remain distinguishable.

Change and scope

  • Own operation/authority by file kind, with interrupted for entered phases (including worker startup) and not-started for unvisited phases. Graph/progress consume those facts; normal structured gaps retain byte authority.
  • Centralize semantic applicability at recordUnavailableFile, before retaining limits/nodes/unknowns. Full and incremental construction share it; remove three duplicate caller checks and the AST-only unavailable Evidence helper.
  • Extend the real-ASAR verifier with independent exact path/operation/status expectations and negative oracles. Retain scripts, source pins, failed attempts and compact measurements.

Ordinary static-reconstruction correction within existing authority; no separate scope decision applies. Existing effects remain:

  • Read selected local files/captured data.
  • Launch an owned analysis worker.
  • Write private staged sources/verification inputs.

The target application and native providers do not execute in this verification. Dependencies are unchanged.

Contract and boundary impact

Shared CLI/MCP inputs, effects and schemas are unchanged. analysis_status is an additive observation property; corrected provenance/phase values and removal of false scopes change derived Evidence identities. Preserve caller choices, canonical byte identity, partial/unknown states and complete retained Evidence. At most five shared failure entries exist per interruption; no persistent cache. Generated artifacts are checked and excluded from commits.

Evidence and regression coverage

Public CLI/MCP timeout and shared-application cancellation baselines reproduced native AST scopes and a phantom native module. A second producer-boundary regression on 323fae8cb also reproduced phantom modules for all five excluded metadata/native kinds in the full builder. Both construction paths now preserve selected/excluded JavaScript controls without those modules.

Official Joplin v3.7.21 ASAR: selected native identity/provenance remain exact; native has no AST gap, while three unvisited metadata paths retain their exact unavailable operation and not-started status. Strict reruns preserve all earlier analytical fields/Evidence/BPE and exact CLI/MCP parity. Native Evidence is explicitly simulated solely for subject linkage. Alternate full-builder coverage uses the actual filesystem boundary rather than a separately measured real-app workflow.

Reproduction, measurements, source pins, attempts and limitations.

  • Observed, derived and unknown facts remain distinguishable.
  • Caller inputs, source identity/provenance and failed attempts remain recorded.
  • Partial coverage remains independent of native handoff eligibility.

Validation performed

  • Final focused selection: 78 distinct cases across ten files passed (nine files65/65 plus original root reconstruction13/13), including six real-snapshot/counterexample oracles and both full/incremental construction. Earlier deadline/lint/harness failures remain recorded; no test deadline raised.
  • Final real Joplin controls passed: timeout60.443s wall/59.970344s CPU/3,078,295,552B peak; default63.574s/63.177884s/3,189,719,040B. One CPU/8GiB, no OOM and verified owned cleanup.
  • Final npm run check && npm run docs:check passed, including five consistency tests (117.636s wall/117.194118s CPU/4,263,153,664B peak, no OOM and verified cleanup). Earlier receipts remain version-labelled.
  • git diff --check: passed.

The timeout task includes four inline traces; the default control models one native trace plus exported-parent metadata diagnostics outside task tokens. Compare only equivalent completed cohorts. Keep every timing outlier/repeat; no speedup or performance-equivalence claim. Static BPE projections are not hosted-model billing. Local verification is Linux x64/Node24.18/npm11.16; live Electron and real native providers remain unverified.

Initial-head CI:36 passed; Apple DMG fixture creation failed before REA verification, also failing the aggregate. Apple passed on the intermediate head without changing Apple code. Final-head CI/reviews remain pending.

Author readiness

Human owner: @N0zoM1z0

The session authorized implementation, validation, ready PRs and merging, including waiving manual declarations. The agent reviewed the diff/evidence. A human final-diff review is not asserted; declarations remain unchecked.

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

Before merge

  • Concrete problem, related issue, scope and authority identified.
  • Producing representation and affected consumers audited; superseded helper removed.
  • Coverage preserves caller choices, native identity, typed failures and unknowns.
  • Owning documentation and verification updated; generated files excluded.
  • Final diff checked for secrets, 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/4207 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/javascript-interruption-applicability` --- ### 📝 Commits (3) - [`04ca36a`](https://github.com/morluto/rea/commit/04ca36ad86831e2d3639141bf41cd6994d8575d7) fix(javascript): preserve analysis applicability after interruption - [`323fae8`](https://github.com/morluto/rea/commit/323fae8cbf3e36677bcb7b22ba31fa1a7e3c5cd4) test(javascript): require exact retained metadata processing phases - [`40e0ce4`](https://github.com/morluto/rea/commit/40e0ce42ae11ad14567ee7abf91d90ecfe3d0c20) fix(javascript): own semantic file applicability in the projection ### 📊 Changes **18 files changed** (+3717 additions, -93 deletions) <details> <summary>View changed files</summary> 📝 `docs/javascript-artifact-reconstruction.md` (+12 -0) ➕ `docs/verification/javascript-interruption-applicability-2026-10-15.json` (+2641 -0) ➕ `docs/verification/javascript-interruption-applicability-2026-10-15.md` (+245 -0) ➕ `scripts/lib/javascript-file-scope-oracle.d.mts` (+28 -0) ➕ `scripts/lib/javascript-file-scope-oracle.mjs` (+28 -0) 📝 `scripts/verify/javascript/native-handoffs.mjs` (+153 -19) 📝 `src/application/javascript/JavaScriptArtifactAnalysis.ts` (+48 -24) 📝 `src/application/javascript/JavaScriptArtifactAnalysisTypes.ts` (+46 -6) 📝 `src/application/javascript/JavaScriptArtifactGraphContext.ts` (+6 -3) 📝 `src/application/javascript/JavaScriptArtifactGraphEvidence.ts` (+8 -4) 📝 `src/application/javascript/JavaScriptArtifactGraphStructure.ts` (+16 -5) 📝 `src/application/javascript/JavaScriptArtifactReconstruction.ts` (+9 -3) 📝 `src/application/javascript/JavaScriptSemanticGraphBuilder.ts` (+4 -1) 📝 `tests/acceptance/applications/javascriptAnalysisLimits.test.ts` (+164 -28) 📝 `tests/boundary/filesystem/javascript-applications/javascriptArtifactReconstruction.test.ts` (+70 -0) 📝 `tests/boundary/filesystem/javascriptArtifactReconstruction.test.ts` (+25 -0) 📝 `tests/boundary/javascript/javascriptApplicationCancellation.test.ts` (+98 -0) ➕ `tests/boundary/process/javascriptVerifierScopeOracle.test.ts` (+116 -0) </details> ### 📄 Description ## Summary After a source interruption, native binaries and unvisited metadata acquired JavaScript AST failure scopes; native files could also acquire phantom semantic modules. Preserve file-specific applicability/status at the producer and semantic projection boundaries. Fixes #3948. Part of #4027; exact retained-fact delivery is separate #4190. ## Problem and expected behavior Native inventory and byte identity remain usable independently of source interruption. Package/JSON, HTML and source-map gaps describe their own unavailable processing; actual JavaScript failures, source-bound unknowns and caller exclusions remain distinguishable. ## Change and scope - Own operation/authority by file kind, with `interrupted` for entered phases (including worker startup) and `not-started` for unvisited phases. Graph/progress consume those facts; normal structured gaps retain byte authority. - Centralize semantic applicability at `recordUnavailableFile`, before retaining limits/nodes/unknowns. Full and incremental construction share it; remove three duplicate caller checks and the AST-only unavailable Evidence helper. - Extend the real-ASAR verifier with independent exact path/operation/status expectations and negative oracles. Retain scripts, source pins, failed attempts and compact measurements. Ordinary static-reconstruction correction within existing authority; no separate scope decision applies. Existing effects remain: - [x] Read selected local files/captured data. - [x] Launch an owned analysis worker. - [x] Write private staged sources/verification inputs. The target application and native providers do not execute in this verification. Dependencies are unchanged. ## Contract and boundary impact Shared CLI/MCP inputs, effects and schemas are unchanged. `analysis_status` is an additive observation property; corrected provenance/phase values and removal of false scopes change derived Evidence identities. Preserve caller choices, canonical byte identity, partial/unknown states and complete retained Evidence. At most five shared failure entries exist per interruption; no persistent cache. Generated artifacts are checked and excluded from commits. ## Evidence and regression coverage Public CLI/MCP timeout and shared-application cancellation baselines reproduced native AST scopes and a phantom native module. A second producer-boundary regression on `323fae8cb` also reproduced phantom modules for all five excluded metadata/native kinds in the full builder. Both construction paths now preserve selected/excluded JavaScript controls without those modules. Official Joplin v3.7.21 ASAR: selected native identity/provenance remain exact; native has no AST gap, while three unvisited metadata paths retain their exact unavailable operation and `not-started` status. Strict reruns preserve all earlier analytical fields/Evidence/BPE and exact CLI/MCP parity. Native Evidence is explicitly simulated solely for subject linkage. Alternate full-builder coverage uses the actual filesystem boundary rather than a separately measured real-app workflow. [Reproduction, measurements, source pins, attempts and limitations](https://github.com/morluto/rea/blob/fix/javascript-interruption-applicability/docs/verification/javascript-interruption-applicability-2026-10-15.md). - [x] Observed, derived and unknown facts remain distinguishable. - [x] Caller inputs, source identity/provenance and failed attempts remain recorded. - [x] Partial coverage remains independent of native handoff eligibility. ## Validation performed - Final focused selection: **78 distinct cases across ten files passed** (nine files65/65 plus original root reconstruction13/13), including six real-snapshot/counterexample oracles and both full/incremental construction. Earlier deadline/lint/harness failures remain recorded; no test deadline raised. - Final real Joplin controls passed: timeout60.443s wall/59.970344s CPU/3,078,295,552B peak; default63.574s/63.177884s/3,189,719,040B. One CPU/8GiB, no OOM and verified owned cleanup. - Final `npm run check && npm run docs:check` passed, including five consistency tests (117.636s wall/117.194118s CPU/4,263,153,664B peak, no OOM and verified cleanup). Earlier receipts remain version-labelled. - `git diff --check`: passed. The timeout task includes four inline traces; the default control models one native trace plus exported-parent metadata diagnostics outside task tokens. Compare only equivalent completed cohorts. Keep every timing outlier/repeat; no speedup or performance-equivalence claim. Static BPE projections are not hosted-model billing. Local verification is Linux x64/Node24.18/npm11.16; live Electron and real native providers remain unverified. Initial-head CI:36 passed; Apple DMG fixture creation failed before REA verification, also failing the aggregate. Apple passed on the intermediate head without changing Apple code. Final-head CI/reviews remain pending. ## Author readiness Human owner: @N0zoM1z0 The session authorized implementation, validation, ready PRs and merging, including waiving manual declarations. The agent reviewed the diff/evidence. A human final-diff review is not asserted; declarations remain unchecked. - [ ] 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. ## Before merge - [x] Concrete problem, related issue, scope and authority identified. - [x] Producing representation and affected consumers audited; superseded helper removed. - [x] Coverage preserves caller choices, native identity, typed failures and unknowns. - [x] Owning documentation and verification updated; generated files excluded. - [x] Final diff checked for secrets, 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 01:12:02 +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#6125
No description provided.