[PR #5040] [MERGED] fix(javascript): preserve inherited aliases past erased class fields #6750

Closed
opened 2026-11-01 21:42:48 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5040
Author: @Nikhi00718
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @morluto

Base: main ← Head: Nikhi00718/fix/typescript-erased-class-fields


📝 Commits (1)

  • e257b9f fix(javascript): preserve inherited aliases past erased class fields

📊 Changes

4 files changed (+110 additions, -3 deletions)

View changed files

📝 src/domain/javascript/javascriptAstValues.ts (+6 -0)
📝 src/domain/javascript/javascriptSemanticAnalysis.member_mutations.test.ts (+61 -0)
📝 src/domain/javascript/javascriptSemanticObjectReferences.ts (+9 -3)
📝 tests/boundary/filesystem/javascript-applications/javascriptArtifactGraphEndpoints.test.ts (+34 -0)

📄 Description

Summary

Ignore TypeScript declare and abstract fields when resolving runtime class properties. These erased declarations currently hide inherited fields/getters, so a write through an inherited alias can leave stale values reported as exact endpoint evidence.

Problem and expected behavior

const options = { url: "/before" };
class Base { field = options; }
class Derived extends Base { declare field: { url: string }; }
new Derived().field.url = "/after";
const target = options.url;
fetch(target);

On 23f984b1a, artifact analysis reports /before as an exact endpoint with no limitations. TypeScript erases declare field, so the inherited field still aliases options. The corrected analysis retains target as a partial endpoint after mutation instead of inventing an exact URL. No existing issue is linked; this was reproduced from the code.

Change and scope

One shared runtime-field predicate admits class properties before either instance-field shadowing or static descriptor selection. Real fields, including uninitialized JavaScript fields, still shadow inherited members. This is a static-analysis correction within existing contribution scope; no additional maintainer scope decision applies.

Contract and boundary impact

  • Semantic owner and earliest changed stage: class property admission during semantic object-reference lookup.
  • Contribution scope fit and linked maintainer decision: ordinary correction to existing static analysis; not applicable.
  • CLI and MCP/tool-catalog contract: no schema changes; affected endpoint evidence becomes partial.
  • Provider, bridge, target-format, or platform compatibility: TypeScript source only; no provider or bridge changes.
  • Evidence, artifact, provenance, or reconstruction contract: preserve unknown values after inherited alias mutation; retain source locations and artifact identity.
  • Target selection, authority, upstream behavior, and cleanup details: unchanged read-only artifact analysis.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

Tests cover inherited instance/static fields and getters, abstract declarations, and real derived-field shadowing. A real directory artifact regression follows the source through inventory, analysis and graph projection.

Executed on a clean worktree at 23f984b1a with only the new tests copied in: all six mutation/graph regressions fail for stale exact values (191 surrounding tests deselected). A TypeScript 7.0.2 compiler/runtime probe confirms inherited references survive erasure. The independent static review found no actionable issues.

Executed compiled CLI against the reproduction directory: node scripts/rea.mjs analyze-javascript-application ../_rea-flagship/artifact --json returns:

{"endpoint_kind":"network","value":"target","mechanism":"call:fetch","resolution":"partial"}

The attached Evidence limitation says: The request target is not an exact literal; the endpoint value retains the unresolved source expression.

  • 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

Windows 11; Node 24.18.0 and npm 11.16.0 for the main check/test runs:

  • npm run test:run -- src/domain/javascript tests/boundary/filesystem/javascript-applications/javascriptArtifactGraphEndpoints.test.ts --reporter=dot — 90 files, 2,415 tests passed.
  • npm run check — passed typecheck, runtime compile, lint/module boundaries, formatting, knip, metadata and architecture guards. Lint reported 0 errors and 1,682 warnings.
  • npm run test:focused -- tests/boundary/filesystem/javascript-applications/javascriptArtifactGraphEndpoints.test.ts — 3 passed with required artifacts built.
  • npm run verify:test-discovery — all 1,580 test files discovered exactly once.
  • TypeScript 7.0.2 checked and emitted the standalone runtime probe; running it printed /after and /abstract-after following inherited mutations.
  • git diff --check — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; no public input or schema changes.
  • Real Hopper/Ghidra, browser, or OS coverage: Windows 11 source/artifact tests; provider engines are not involved. Full suite and other operating systems not run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new execution, mutation or network authority; analyzed source is not evaluated by REA.

Author readiness

Human owner: @Nikhi00718

  • 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

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, 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/5040 **Author:** [@Nikhi00718](https://github.com/Nikhi00718) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `Nikhi00718/fix/typescript-erased-class-fields` --- ### 📝 Commits (1) - [`e257b9f`](https://github.com/morluto/rea/commit/e257b9f9fe73e24e899fdc28962faa17d628b237) fix(javascript): preserve inherited aliases past erased class fields ### 📊 Changes **4 files changed** (+110 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/javascriptAstValues.ts` (+6 -0) 📝 `src/domain/javascript/javascriptSemanticAnalysis.member_mutations.test.ts` (+61 -0) 📝 `src/domain/javascript/javascriptSemanticObjectReferences.ts` (+9 -3) 📝 `tests/boundary/filesystem/javascript-applications/javascriptArtifactGraphEndpoints.test.ts` (+34 -0) </details> ### 📄 Description ## Summary Ignore TypeScript `declare` and abstract fields when resolving runtime class properties. These erased declarations currently hide inherited fields/getters, so a write through an inherited alias can leave stale values reported as exact endpoint evidence. ## Problem and expected behavior ```ts const options = { url: "/before" }; class Base { field = options; } class Derived extends Base { declare field: { url: string }; } new Derived().field.url = "/after"; const target = options.url; fetch(target); ``` On `23f984b1a`, artifact analysis reports `/before` as an exact endpoint with no limitations. TypeScript erases `declare field`, so the inherited field still aliases `options`. The corrected analysis retains `target` as a partial endpoint after mutation instead of inventing an exact URL. No existing issue is linked; this was reproduced from the code. ## Change and scope One shared runtime-field predicate admits class properties before either instance-field shadowing or static descriptor selection. Real fields, including uninitialized JavaScript fields, still shadow inherited members. This is a static-analysis correction within existing contribution scope; no additional maintainer scope decision applies. ## Contract and boundary impact - Semantic owner and earliest changed stage: class property admission during semantic object-reference lookup. - Contribution scope fit and linked maintainer decision: ordinary correction to existing static analysis; not applicable. - CLI and MCP/tool-catalog contract: no schema changes; affected endpoint evidence becomes partial. - Provider, bridge, target-format, or platform compatibility: TypeScript source only; no provider or bridge changes. - Evidence, artifact, provenance, or reconstruction contract: preserve unknown values after inherited alias mutation; retain source locations and artifact identity. - Target selection, authority, upstream behavior, and cleanup details: unchanged read-only artifact analysis. - Generated metadata, package, or installation impact: none. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage Tests cover inherited instance/static fields and getters, abstract declarations, and real derived-field shadowing. A real directory artifact regression follows the source through inventory, analysis and graph projection. Executed on a clean worktree at `23f984b1a` with only the new tests copied in: all six mutation/graph regressions fail for stale exact values (191 surrounding tests deselected). A TypeScript 7.0.2 compiler/runtime probe confirms inherited references survive erasure. The independent static review found no actionable issues. Executed compiled CLI against the reproduction directory: `node scripts/rea.mjs analyze-javascript-application ../_rea-flagship/artifact --json` returns: ```json {"endpoint_kind":"network","value":"target","mechanism":"call:fetch","resolution":"partial"} ``` The attached Evidence limitation says: `The request target is not an exact literal; the endpoint value retains the unresolved source expression.` - [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 Windows 11; Node 24.18.0 and npm 11.16.0 for the main check/test runs: - `npm run test:run -- src/domain/javascript tests/boundary/filesystem/javascript-applications/javascriptArtifactGraphEndpoints.test.ts --reporter=dot` — 90 files, 2,415 tests passed. - `npm run check` — passed typecheck, runtime compile, lint/module boundaries, formatting, knip, metadata and architecture guards. Lint reported 0 errors and 1,682 warnings. - `npm run test:focused -- tests/boundary/filesystem/javascript-applications/javascriptArtifactGraphEndpoints.test.ts` — 3 passed with required artifacts built. - `npm run verify:test-discovery` — all 1,580 test files discovered exactly once. - TypeScript 7.0.2 checked and emitted the standalone runtime probe; running it printed `/after` and `/abstract-after` following inherited mutations. - `git diff --check` — passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none; no public input or schema changes. - Real Hopper/Ghidra, browser, or OS coverage: Windows 11 source/artifact tests; provider engines are not involved. Full suite and other operating systems not run. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new execution, mutation or network authority; analyzed source is not evaluated by REA. ## Author readiness Human owner: @Nikhi00718 - [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. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [ ] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:42: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#6750
No description provided.