[PR #4656] fix(javascript): scope candidate this event receivers #6347

Open
opened 2026-10-31 01:13:46 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4656
Author: @Xinglan233
Created: 10/17/2026
Status: 🔄 Open

Base: main ← Head: fix/3360-receiver-scope-20261017


📝 Commits (4)

  • 87f4fe4 fix(javascript): scope candidate this event receivers
  • 2d93e60 fix(javascript): retain receivers through type wrappers
  • 7681b17 fix(javascript): separate class receiver candidate families
  • 8f81e82 fix(javascript): retain enclosing receivers for computed keys

📊 Changes

5 files changed (+484 additions, -11 deletions)

View changed files

📝 docs/javascript-application-workflows.md (+9 -1)
➕ src/domain/javascript/javascriptSemanticAnalysis.this_emitters.test.ts (+157 -0)
📝 src/domain/javascript/javascriptSemanticAsyncEffects.ts (+7 -10)
➕ src/domain/javascript/javascriptSemanticThisReceivers.ts (+138 -0)
➕ tests/acceptance/applications/javascriptThisEmitters.test.ts (+173 -0)

📄 Description

Summary

Refine class this event candidates on top of main's #3360 fix. Prepared with OpenAI Codex.

Problem and expected behavior

Main separates lexical receivers and keeps this identities incomplete. The remaining distinctions are class instance/static sides and possible inherited links: instance and static fields must not share an event, while matching sides of possible local bases should retain candidate links.

Change and scope

  • Group class members by instance/static side and possible local-base family, including conditional bases; reuse the semantic parent's index and existing class-candidate resolver.
  • Keep every this identity incomplete. A shared unknown external base does not join classes. Member arrows inherit their receiver; computed keys, decorators and heritage use the enclosing receiver.
  • Keep non-class function/object method bodies lexical. Object/class computed method keys use the existing enclosing-evaluation rule; shared CallableStack changes and duplicated #3360 base coverage remain outside the diff.

Contract and boundary impact

  • Owner: JavaScript semantic event identity, before shared graph projection.
  • CLI/MCP schemas, providers, bridges, source provenance, authority and cleanup: unchanged; this remains inert static analysis. New class this event keys/IDs require fresh graph seeds; retained graphs remain usable.
  • Generated/package/install metadata: unchanged. No generated artifacts committed. Scope decision: not applicable to this existing static-analysis correction.

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

  • Computed object-method keys share the enclosing receiver with its event registration, while the method body stays separate. The new domain and real CLI/MCP regressions fail on 7681b1745 and pass after applying the shared evaluation boundary (review).
  • Against main 98422997c035bf314084b7d786628616e70bc95f, 10 of the original 11 receiver cases fail; the external-base negative case and main's 8 identity-boundary controls pass. Those 19 pass with this change.
  • The new real CLI/stdio-MCP regression returns 9 ready events on main versus the expected 5 after this change: two inherited receiver-side families, two unrelated external-base receivers and one stable binding. Static/instance fields also retain two separate events. this relations remain candidates with event unknowns; stable binding relations remain resolved. CLI and MCP graphs, plus MCP text/structured results, agree.
  • Domain coverage includes member and class-definition evaluation boundaries, nested functions/arrows, conditional/logical/sequence local bases, external bases, cycles and a 502-class chain.

Validation performed

macOS 27.2 arm64; Node 24.22.1, npm 11.16.0; head 8f81e82d7ac956d39b9370e3924e6f73c2fe2461 (tested main baseline 98422997c; follow-up to 7681b1745).

  • npm run test:local -- <72 JavaScript semantic domain/application test files> — 1,804 passed.
  • npm run test:focused -- tests/acceptance/applications/javascriptThisEmitters.test.ts tests/acceptance/applications/javascriptEventPayload.test.ts tests/acceptance/applications/javascriptTimerWritesCli.test.ts — 3 passed; runtime built.
  • npm run check:fast, changed-file oxfmt --threads=1 --check, git diff --check — passed.
  • Unchanged documentation and test-file discovery were validated at 7681b1745: npm run docs:check, npm run docs:build and npm run verify:test-discovery passed (2,666 test files exactly once). These unchanged checks were not rerun for this follow-up.

Compatibility, safety, and release

Candidate families overapproximate receiver equality. Rebinding with .call/.apply/.bind, general aliasing and external/cross-file inheritance remain unresolved. Full-suite, other-OS and real Hopper/Ghidra/browser lanes were not run for this static JavaScript change. No package/release metadata or target-execution capability changes.

Author readiness

Human owner: @Xinglan233

  • 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/4656 **Author:** [@Xinglan233](https://github.com/Xinglan233) **Created:** 10/17/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/3360-receiver-scope-20261017` --- ### 📝 Commits (4) - [`87f4fe4`](https://github.com/morluto/rea/commit/87f4fe41969daf81fcd2bf024c31762d209d47ca) fix(javascript): scope candidate this event receivers - [`2d93e60`](https://github.com/morluto/rea/commit/2d93e6066cfdf414213d0ca5ce9097f25ad47de3) fix(javascript): retain receivers through type wrappers - [`7681b17`](https://github.com/morluto/rea/commit/7681b17459824bcd8924c2e63ef64d20287f0170) fix(javascript): separate class receiver candidate families - [`8f81e82`](https://github.com/morluto/rea/commit/8f81e82d7ac956d39b9370e3924e6f73c2fe2461) fix(javascript): retain enclosing receivers for computed keys ### 📊 Changes **5 files changed** (+484 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `docs/javascript-application-workflows.md` (+9 -1) ➕ `src/domain/javascript/javascriptSemanticAnalysis.this_emitters.test.ts` (+157 -0) 📝 `src/domain/javascript/javascriptSemanticAsyncEffects.ts` (+7 -10) ➕ `src/domain/javascript/javascriptSemanticThisReceivers.ts` (+138 -0) ➕ `tests/acceptance/applications/javascriptThisEmitters.test.ts` (+173 -0) </details> ### 📄 Description ## Summary Refine class `this` event candidates on top of main's #3360 fix. Prepared with OpenAI Codex. ## Problem and expected behavior Main separates lexical receivers and keeps `this` identities incomplete. The remaining distinctions are class instance/static sides and possible inherited links: instance and static fields must not share an event, while matching sides of possible local bases should retain candidate links. ## Change and scope - Group class members by instance/static side and possible local-base family, including conditional bases; reuse the semantic parent's index and existing class-candidate resolver. - Keep every `this` identity incomplete. A shared unknown external base does not join classes. Member arrows inherit their receiver; computed keys, decorators and heritage use the enclosing receiver. - Keep non-class function/object method bodies lexical. Object/class computed method keys use the existing enclosing-evaluation rule; shared `CallableStack` changes and duplicated #3360 base coverage remain outside the diff. ## Contract and boundary impact - Owner: JavaScript semantic event identity, before shared graph projection. - CLI/MCP schemas, providers, bridges, source provenance, authority and cleanup: unchanged; this remains inert static analysis. New class `this` event keys/IDs require fresh graph seeds; retained graphs remain usable. - Generated/package/install metadata: unchanged. No generated artifacts committed. Scope decision: not applicable to this existing static-analysis correction. 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 - Computed object-method keys share the enclosing receiver with its event registration, while the method body stays separate. The new domain and real CLI/MCP regressions fail on `7681b1745` and pass after applying the shared evaluation boundary ([review](https://github.com/morluto/rea/pull/4656#discussion_r4386229952)). - Against main `98422997c035bf314084b7d786628616e70bc95f`, 10 of the original 11 receiver cases fail; the external-base negative case and main's 8 identity-boundary controls pass. Those 19 pass with this change. - The new real CLI/stdio-MCP regression returns 9 `ready` events on main versus the expected 5 after this change: two inherited receiver-side families, two unrelated external-base receivers and one stable binding. Static/instance fields also retain two separate events. `this` relations remain candidates with event unknowns; stable binding relations remain resolved. CLI and MCP graphs, plus MCP text/structured results, agree. - Domain coverage includes member and class-definition evaluation boundaries, nested functions/arrows, conditional/logical/sequence local bases, external bases, cycles and a 502-class chain. ## Validation performed macOS 27.2 arm64; Node 24.22.1, npm 11.16.0; head `8f81e82d7ac956d39b9370e3924e6f73c2fe2461` (tested main baseline `98422997c`; follow-up to `7681b1745`). - `npm run test:local -- <72 JavaScript semantic domain/application test files>` — 1,804 passed. - `npm run test:focused -- tests/acceptance/applications/javascriptThisEmitters.test.ts tests/acceptance/applications/javascriptEventPayload.test.ts tests/acceptance/applications/javascriptTimerWritesCli.test.ts` — 3 passed; runtime built. - `npm run check:fast`, changed-file `oxfmt --threads=1 --check`, `git diff --check` — passed. - Unchanged documentation and test-file discovery were validated at `7681b1745`: `npm run docs:check`, `npm run docs:build` and `npm run verify:test-discovery` passed (2,666 test files exactly once). These unchanged checks were not rerun for this follow-up. ## Compatibility, safety, and release Candidate families overapproximate receiver equality. Rebinding with `.call`/`.apply`/`.bind`, general aliasing and external/cross-file inheritance remain unresolved. Full-suite, other-OS and real Hopper/Ghidra/browser lanes were not run for this static JavaScript change. No package/release metadata or target-execution capability changes. ## Author readiness Human owner: @Xinglan233 - [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. - [x] 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>
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#6347
No description provided.