[PR #695] [MERGED] fix(reference): retain recovered parser diagnostics #2175

Closed
opened 2026-10-16 21:15:16 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/695
Author: @kaoru0822-kitauji
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/reference-parser-recovery


📝 Commits (1)

  • ed3a7f0 fix(reference): retain recovered parser diagnostics

📊 Changes

3 files changed (+312 additions, -16 deletions)

View changed files

📝 src/domain/referenceSourceImportParsing.ts (+19 -16)
➕ src/domain/referenceSourceImportRecovery.test.ts (+150 -0)
➕ tests/boundary/filesystem/referenceSourceRecovery.test.ts (+143 -0)

📄 Description

Summary

Report Babel's recovered syntax diagnostics in historical-source imports while retaining useful recovered relationships as partial evidence.

No separate issue: this is a reproduced parser-boundary correctness defect.

Problem and expected behavior

The reference parser enables errorRecovery, but treats every returned AST as fully parsed and discards ast.errors.

For const n; let a; let a; import "node:fs";, Babel reports a missing initializer and a duplicate declaration. REA currently returns no parse failures and labels the import relationship parsed. A public filesystem import likewise reports only its fatal-syntax control and omits the recovered file's diagnostics.

The defect is missing diagnostics and overstated relationship parse confidence. The public inventory already reports partial coverage because of the reader's standing pathname-race advisory; this PR does not claim an incorrect complete inventory.

Change and scope

Project actual recovered Babel messages into the existing path/parser/reason failure shape. Messages retain their source locations without serializing error objects, ASTs or stacks.

Retain recovered relationships and downgrade only parsed to partial when recovery errors exist. Preserve existing partial/unknown evidence, valid-source results and fatal-error behavior. Parser options and downstream normalization remain unchanged.

Contract and boundary impact

  • Semantic owner: reference-source Babel parsing before graph assembly.
  • CLI/MCP: previously hidden recovered diagnostics become visible and recovered relationships carry partial parse state; no schemas or tools change.
  • Provider/platform: unchanged.
  • Evidence/provenance: relationship targets/resolution, source paths, byte sizes and hashes remain intact. Distinct diagnostics at different locations survive normalization; exact duplicates still use the existing deduplication policy.
  • Process/authorization/cleanup: source is parsed inertly, never evaluated; no new file/network/process effects.
  • Generated metadata/package: unchanged.

Evidence and regression coverage

Baseline on e828acc: 13 failing recovery tests and nine passing valid/fatal/unsupported controls.

Coverage includes JS/JSX/TS/TSX, TypeScript declaration files, static imports/re-exports, CommonJS, literal/computed dynamic imports, declarations with unknown resolution, multiple diagnostics and repeated diagnostic kinds at different locations. A filesystem regression validates the graph and exact file evidence alongside valid and fatal controls.

Validation performed

After fast-forwarding to current main 132a3a4:

  • Eight focused parser, graph, detector and filesystem suites: 79 tests passed.
  • Exact dependency check, build and npm run check: passed.
  • npm run jscpd, npm run scan:todos, and git diff --check: passed.
  • Independent review completed before publication with no blocking findings.

Node.js 24.19.0, npm 11.9.0, exact locked dependencies. Existing lint warnings remain; no new errors. Hosted CI is tracked separately; no full local suite pass is claimed.

Compatibility, safety, and release

No schema, packaging, dependency, provider or execution-authority changes. Package-install and real Hopper/Ghidra verification were not rerun for this parser-only correction.

Prepared with AI assistance.


🔄 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/695 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/reference-parser-recovery` --- ### 📝 Commits (1) - [`ed3a7f0`](https://github.com/morluto/rea/commit/ed3a7f070cf0793e22b9a0bbfd1f2ebe9dabcfd0) fix(reference): retain recovered parser diagnostics ### 📊 Changes **3 files changed** (+312 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/referenceSourceImportParsing.ts` (+19 -16) ➕ `src/domain/referenceSourceImportRecovery.test.ts` (+150 -0) ➕ `tests/boundary/filesystem/referenceSourceRecovery.test.ts` (+143 -0) </details> ### 📄 Description ## Summary Report Babel's recovered syntax diagnostics in historical-source imports while retaining useful recovered relationships as partial evidence. No separate issue: this is a reproduced parser-boundary correctness defect. ## Problem and expected behavior The reference parser enables `errorRecovery`, but treats every returned AST as fully parsed and discards `ast.errors`. For `const n; let a; let a; import "node:fs";`, Babel reports a missing initializer and a duplicate declaration. REA currently returns no parse failures and labels the import relationship `parsed`. A public filesystem import likewise reports only its fatal-syntax control and omits the recovered file's diagnostics. The defect is missing diagnostics and overstated relationship parse confidence. The public inventory already reports partial coverage because of the reader's standing pathname-race advisory; this PR does not claim an incorrect complete inventory. ## Change and scope Project actual recovered Babel messages into the existing `path/parser/reason` failure shape. Messages retain their source locations without serializing error objects, ASTs or stacks. Retain recovered relationships and downgrade only `parsed` to `partial` when recovery errors exist. Preserve existing partial/unknown evidence, valid-source results and fatal-error behavior. Parser options and downstream normalization remain unchanged. ## Contract and boundary impact - Semantic owner: reference-source Babel parsing before graph assembly. - CLI/MCP: previously hidden recovered diagnostics become visible and recovered relationships carry partial parse state; no schemas or tools change. - Provider/platform: unchanged. - Evidence/provenance: relationship targets/resolution, source paths, byte sizes and hashes remain intact. Distinct diagnostics at different locations survive normalization; exact duplicates still use the existing deduplication policy. - Process/authorization/cleanup: source is parsed inertly, never evaluated; no new file/network/process effects. - Generated metadata/package: unchanged. ## Evidence and regression coverage Baseline on `e828acc`: 13 failing recovery tests and nine passing valid/fatal/unsupported controls. Coverage includes JS/JSX/TS/TSX, TypeScript declaration files, static imports/re-exports, CommonJS, literal/computed dynamic imports, declarations with unknown resolution, multiple diagnostics and repeated diagnostic kinds at different locations. A filesystem regression validates the graph and exact file evidence alongside valid and fatal controls. ## Validation performed After fast-forwarding to current main `132a3a4`: - Eight focused parser, graph, detector and filesystem suites: 79 tests passed. - Exact dependency check, build and `npm run check`: passed. - `npm run jscpd`, `npm run scan:todos`, and `git diff --check`: passed. - Independent review completed before publication with no blocking findings. Node.js 24.19.0, npm 11.9.0, exact locked dependencies. Existing lint warnings remain; no new errors. Hosted CI is tracked separately; no full local suite pass is claimed. ## Compatibility, safety, and release No schema, packaging, dependency, provider or execution-authority changes. Package-install and real Hopper/Ghidra verification were not rerun for this parser-only correction. Prepared with AI assistance. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:15:16 +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#2175
No description provided.