Skip to content

fix(javascript): scope candidate this event receivers - #4656

Merged
vincentkoc merged 5 commits into
morluto:mainfrom
Xinglan233:fix/3360-receiver-scope-20261017
Nov 30, 2026
Merged

vincentkoc merged 5 commits into
morluto:mainfrom
Xinglan233:fix/3360-receiver-scope-20261017

Conversation

@Xinglan233

@Xinglan233 Xinglan233 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

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 [Bug] Unrelated this receivers share one resolved event identity #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.

Preserve lexical receiver scopes and possible local inheritance links without asserting runtime this identity. Keep decorator evaluation outside method receiver and callable boundaries.

Fixes morluto#3360

AI-assisted implementation and verification with OpenAI Codex; human PR ownership and readiness remain unfilled.
@Xinglan233
Xinglan233 marked this pull request as ready for review October 17, 2026 03:02
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge; no new actionable issue was found.

Summary

This PR separates class this events by instance/static side and joins matching sides across possible local bases.

  • JavaScript event calls now follow class receiver sides and local bases.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Event call on this"] --> B["Find enclosing receiver"]
  B --> C["Ordinary function or outer scope"]
  B --> D["Class member"]
  D --> E["Instance side"]
  D --> F["Static side"]
  E --> G["Matching local-base family"]
  F --> G
  C --> H["Incomplete event identity"]
  G --> H
  H --> I["Candidate relation and event unknown"]
Loading

Reviews (5) · Last reviewed commit: "Merge upstream main into the JavaScript ..." · Reviewed by Greptile

Reuse the canonical expression normalizer to preserve object function receiver identity through transparent wrappers. Keep arrows, computed keys and non-transparent expressions separate. AI-assisted implementation and verification with OpenAI Codex.
@morluto

morluto commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Thank you for separating receiver scopes and retaining partial identities. Main now keys this events by lexical class or non-arrow-function owner and reports them as incomplete, addressing #3360. This PR also proposes distinguishing instance/static sides and retaining candidate links through possible local bases. I am keeping it open for that distinct semantic work. If you would like to continue, could you focus the diff and regression coverage on the remaining receiver distinctions against current main? I did not rerun the analysis in this pass.

Retain instance/static sides and possible local-base event links on current main. Keep this identities incomplete and remove the shared callable-stack changes from the PR.
Apply the existing computed-method-key evaluation boundary before non-arrow receiver selection. Cover object method keys and bodies through semantic IR and CLI/MCP regressions.
@morluto morluto added the bug Something isn't working label Nov 23, 2026
@morluto

morluto commented Nov 24, 2026

Copy link
Copy Markdown
Owner

@Xinglan233 thanks for the PR — this branch has merge conflicts with main. Could you merge or rebase onto the latest main and resolve them? Once it's clean and CI is green we can take another look.
cc @gensokyo-dev @dandgabr

@morluto morluto added the area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior label Nov 26, 2026
@vincentkoc

vincentkoc commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks again for the receiver fix! #4656 is merged, and its stronger source-location regressions are now merged in #15227 after exact-head CI passed. Fresh CLI/MCP checks also verified the original head’s receiver boundaries.

@vincentkoc
vincentkoc merged commit 1794085 into morluto:main Nov 30, 2026
41 checks passed
vincentkoc added a commit to agnaylor/rea that referenced this pull request Nov 30, 2026
…410-windows-transport

* commit '28772e67d245661b4a66ef5a09353eafda483367': (674 commits)
  docs: note symlink EPERM in Windows source test failures (morluto#7211)
  fix(javascript): scope candidate this event receivers (morluto#4656)
  fix(config): validate target and loader options before printing MCP registrations (morluto#9279)
  fix(native): honor cancellation during PE alias expansion (morluto#9063)
  fix(audit): preserve env shebang argument ownership (morluto#14075)
  feat(evtx): inventory Windows event log records offline
  docs(skill): replace the staged workflow with the rules it encodes (morluto#10374)
  fix(hopper): clarify publisher verification failures
  fix(analysis-view): keep PTX text pages on Unicode boundaries (morluto#15222)
  feat(mcp): advertise each tool's family in tools/list _meta (morluto#7154)
  perf(evidence): inspect retained records without building a bundle (morluto#15219)
  fix(process): report denied inspection as typed cleanup failures (morluto#9261)
  perf(mcp): complete retained Evidence without rebuilding bundles (morluto#15210)
  fix(agentenv): stop dry-run tarball reads on cancellation (morluto#15205)
  perf(png): reuse scanline storage in screenshot comparisons (morluto#15215)
  fix(javascript): respect Node HTTP path validation (morluto#9684)
  fix(windows): reject native addons with unusable delay-import tables (morluto#15216)
  feat(artifacts): inventory Android super image metadata (morluto#14928)
  fix(paths): reject dotted console device names for portability (morluto#15220)
  fix(analysis-view): return continuation for GPU pages at the byte limit (morluto#15206)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants