Skip to content

fix(javascript): retain directive literals in semantic function fingerprints - #3078

Closed
To3akaRin wants to merge 32 commits into
morluto:mainfrom
To3akaRin:codex/semantic-fingerprint-syntax
Closed

To3akaRin wants to merge 32 commits into
morluto:mainfrom
To3akaRin:codex/semantic-fingerprint-syntax

Conversation

@To3akaRin

@To3akaRin To3akaRin commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Include directive literals in semantic function fingerprints. Otherwise-identical strict, ordinary, asm, custom and escaped-directive functions previously received the same literal-set commitment, so a strict-function query could return all seven candidates.

DirectiveLiteral now enters the existing literal collector with its raw Babel value and a directive tag. Quote style, formatting and local names still normalize; "use\x20strict" remains different from "use strict", nested directives belong to their own callable, and genuine duplicates remain ambiguous. Existing AST traversal and fingerprint projection retain ownership.

Contract and authority

This is inert static analysis with existing CLI/MCP inputs, schemas and algorithm families. Newly analyzed fingerprints reflect directive text; affected callers should reanalyze and obtain fresh seeds. Stored Evidence remains authenticated and queryable with its original components, without rewriting it. Caller source bytes, provenance and ranges are preserved. No provider, target execution, installation or dependency capability is added.

Integration and shared boundary fixes

Merged main through 29d3dcb7ea85b3be37cd81e977ae4e09cebdd2fc normally, preserving upstream commits and authors. The conflict resolution keeps main's dedicated README-facts test owner and its current schema/graph assertions, while retaining invalid DOM-index, SAZ CLI/MCP parity, source-byte preservation and caveat-isolation coverage. No assertion threshold, CI selection, retry or timeout was loosened.

The shared process-effect correction skips an escape only for known primitive configuration slots. Unknown/inherited selections may expose a mutable prototype, so the producer records a wildcard effect for that configuration container; earlier top-level reads and unrelated configuration containers remain independent. The reported counterexamples were reproduced and the Greptile thread was answered and resolved.

Upstream's plain catalog-identity serialization, aborting JSON validation and exact PCAP-output/cleanup fixes are incorporated. The extra JSON regression prevents rejected data from reaching enclosing semantic consumers. Late graph/hash cancellation now uses a controlled progress boundary inside the owned CLI child to invoke the real signal handler, avoiding an external stderr-delivery race; the two early-phase cases still send real OS SIGINT. Typed exit 130 and partial-result assertions remain. Generated runtime, test catalogs and distribution outputs stay uncommitted.

Validation

Final candidate: 237d5d491aceb6b6f3dafd4f2093c3593bdfa503.

  • Original directive regressions: 6 failures / 2 passes before correction. The public compiled CLI/stdio MCP test separates seven functions into six fingerprint classes, retains the intended two strict duplicates, and preserves historical Evidence query results. Existing fingerprint/query tests pass 38 cases.
  • Process-selection repair: original dynamic/prototype counterexamples fail before repair; 151 related mutation/origin tests and 771 semantic-analysis tests pass (overlapping coverage), plus 10 compiled CLI/stdio MCP configuration/builtin cases.
  • Latest merged selection covering JSON/Evidence, process CLI depth errors, cancellation and native configuration: 72 passed, no skips.
  • npm run check, npm run docs:check (including five README consistency checks), dependency validation and git diff --check pass.

Final-head CI at 237d5d491aceb6b6f3dafd4f2093c3593bdfa503: all 21 reported checks successful, including CI required, Portable tests, all five test shards, source/static checks, docs, build, native package validation and the enabled compatibility/recovery lanes. Fourteen provider/capability lanes are skipped by the repository's unchanged scope rules. Greptile succeeds and every review thread is resolved. GitHub reports MERGEABLE / CLEAN; this PR remains open and has not been merged.

Verification limits

The final remote run establishes the repository-selected Linux CI coverage; scope-disabled lanes are reported as skipped. Local verification used macOS arm64 with pinned Node 24.18.0/npm 11.16.0. A Ghidra fixture rejects this host's universal Mach-O Node executable under its simulated Linux provider, so the complete macOS/provider suite is not claimed green. No production Ghidra/IDA/Frida or Windows host execution was performed locally. No current performance, memory or token improvement is claimed.

@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 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issue remains from this review.

Summary

Function fingerprints now include function-local directive values without merging escaped strict-mode lookalikes with real strict directives.

  • Function fingerprints distinguish different directive values.
  • Unknown configuration selections keep later reads uncertain.
  • MCP docs explain that partner fields are guidance and runtime checks stay exact.
  • SAZ docs describe the expanded-size error returned by CLI and MCP.
  • The saved-database test checks refusal while the MCP session stays usable.
  • MCP tests keep graph and trace caveats at their matching Evidence levels.
  • Boundary tests pin existing worker, JSON, cancellation, and browser behavior.

Reviews (9) · Last reviewed commit: "chore: reconcile main JSON and cleanup r..." · Reviewed by Greptile

kaoru0822-kitauji and others added 7 commits October 14, 2026 01:50
…reads

Main fails five source tests after 04672f2 and d4bd65c.

- Ambient write resolution used the caller's write site for every alias
  read it reached, so `alias = alias.globalThis` resolved its own self-read
  only to the reassignment and lost the original `globalThis` identity. Reads
  reached through an initializer now select initializers at their own
  position; the written target keeps the caller's write site.
- Process escape tracking recorded `Number(process.env.PORT)` and
  `Number(process.argv[2])` as escapes of the read slot, which dropped the
  configuration read inside functions. Node stores env values and argv
  entries as strings, so passing one exposes no mutable object; replacing an
  entry still records its own write or receiver escape.
- The dynamic isolated-world test now expects the direct observation that the
  proven Webpack bootstrap resolution produces.
- The native IDA admission test now matches d4bd65c: attached profiles
  report the bound document and still refuse address resolution.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Cover configuration reads after passing env/argv values to a call, and
  keep reads unknown after replacing an argv entry directly, through an alias,
  or after a container escape.
- b58adaf added `resolution_status` to source-map edges. Expect it, and pair
  each alias edge with the script that declared it instead of relying on
  content-derived edge ID order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e572c38 replaced the localized guide URLs in the translated readmes with
repository-relative guide links, so the drift fixture no longer contained
`https://rea.tools/zh-CN/guides/native/`. Exercise the same missing-target,
wrong-locale, and query drift on a localized showcase link the readme still
carries, and add drift for the new relative guide link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@To3akaRin To3akaRin changed the title fix(javascript): distinguish yield and update forms in function fingerprints fix(javascript): retain directive literals in semantic function fingerprints Oct 14, 2026
kaoru0822-kitauji and others added 14 commits October 14, 2026 02:36
…tput

b58adaf emits `interpretation: "candidate"` on static endpoint findings,
but the worker's strict endpoint schema still rejected the key, so
`analyze_javascript_application` failed output validation for any source
with a candidate endpoint. Admit the field as an exact optional literal.

Update application acceptance and boundary expectations to current main:
endpoint identity keys tag literal values (88afcc7), source-map
observations and edges carry `resolution_status` (b58adaf), and a proven
Webpack bootstrap reports bundled contextBridge exposures as direct syntax.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fails

d4bd65c moved a failed LaunchSupport helper's output into the nested
`command_outcome`, but the cause projection also returned early for those
failures and dropped `launch_support`. A `-vmargs` failure therefore lost the
warning that the successful `-envvars` helper had already reported. Keep the
retained helper outputs and skip only the launcher outcome that the nested
cause now owns.

Update the Ghidra launch and Hopper startup boundary expectations to current
main: failed helpers report through `cause.command_outcome`, and bridge startup
results carry the launched `processId` (599a8ee), asserted against the
exact retried process.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chrome's DOMSnapshot interns empty or null strings as index -1. bffdd91
began rejecting every negative string index, so real Chrome snapshots lost
each element node (whose nodeValue is -1) and any node with an empty
attribute value, and the headless Chrome SVG xlink:href lanes found no
anchors. Simulated snapshots interned "" as a table entry and missed it.

Parse snapshot strings at one owner: names still require a table entry,
while node values, attribute values, and baseURL accept -1 as "". The SVG
ancestry projection shares the same parser instead of its own copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29a2d13 classifies an over-budget expanded SAZ archive as invalid input
with an out_of_range `capture_path` issue that names the expanded-byte
maximum. Assert that projection through the CLI instead of the previous
execution failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…acement

DirectoryArtifactReader yields a directory's entries in `opendir()` order and
reads queued child directories only after that directory is exhausted. The
root-replacement test assumed APFS order (`sub` before `sample.txt`), so it
failed on Linux ext4. Require both root entries in either order before the
descent into the replaced root is rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The exact-selection tests from 4d4631a match the child Vitest summary as
plain text. In the CI lane the child inherited color, so ANSI styling split
"Test Files  2 passed" and both tests failed there while passing locally;
`FORCE_COLOR=1` reproduces it. Run the child with `NO_COLOR=1`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assert SAZ expansion-limit code and byte constraint through stdio MCP as well as CLI, without partial results or source mutation. Align schema presentation guidance with canonical runtime partner validation. The general MCP documentation paragraph preserves the upstream explanation from 5447a5d in PR morluto#2877.

Co-authored-by: Omisakin Joshua <117924167+thefolahan@users.noreply.github.com>
(cherry picked from commit 5d906ecbe1ef7e6ca9e2129dd9dbc25d6145d1e9)
(cherry picked from commit 4dc37dc8210509c66b2fe4313525736978b8bd07)
Check one copy of each generic caveat in the workflow result and one in
its Evidence envelope, following the scoped assertion proposed by
N0zoM1z0 in PR morluto#2933. Keep distinct caveats and confirm a later trace does
not inherit a caveat from an observation only used by the earlier graph.

Retain explicit -2 node/attribute value rejection alongside the valid -1
empty-string regression supplied by the upstream browser repair.

Validation: 88 source tests, 24 boundary tests (including all three real
Chrome SVG/XHTML lanes), npm run check, and test discovery passed on
Node 24.18.0/npm 11.16.0 and Chrome 155.0.8059.79 on macOS 15.7.7.

(cherry picked from commit 2cd292ca495ddb57fc6ac0f7f51449aa4fc6e95c)
To3akaRin and others added 3 commits October 14, 2026 11:28
Main d4bd65c intentionally refuses saved Hopper database analysis on macOS
because its launcher cannot run the analysis bridge for that target kind.
The production stdio smoke test still expected a successful fake reply.

Assert the typed target_kind_unsupported Hopper rejection, retained target
identity and an unbound provider instead. After the refusal, verify the same
stdio session still serves its complete catalog and session status. Retain
the structured warning/error record and no-fatal assertions.

The unchanged test fails on clean main d901561 and the shared CI repair
head 3d3076a. The updated runtime suite and Hopper discovery suite each pass
all four cases on macOS 15.7.7, Node 24.18.0 and npm 11.16.0. npm run check
passes. These tests use the explicit Node fake launcher; no live Hopper
installation or user document is opened or modified.

(cherry picked from commit 33ec4cee9c3e982c9712d082aec98fd035ce209f)
…c root

599a8ee replaced the host-wide `ps` scan with a scan of the supplied proc
root, but the reparented demo-helper case only mirrored its process into the
synthetic root in alternate-launcher mode. The renamed `Xvfb` helper was
therefore invisible and the clean-runtime check resolved. Mirror the fixture
process in both modes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit d4df0a6)
@To3akaRin

Copy link
Copy Markdown
Contributor Author

I checked PR head 237d5d4 against main through 7d1e4d0. The directive fingerprint fix and its unit/CLI/MCP regressions are already included in 6396851; the shared fixes and associated coverage landed in e79e014.

Twelve of the eighteen changed files are identical to main. I reviewed the remaining six: they retain this PR’s changes alongside subsequent upstream updates. I found no outstanding changes that need to land separately.

Closing this PR as superseded. Thanks for integrating the work and preserving the attribution!

Verification was source and history comparison; I did not rerun tests for this check.

@To3akaRin To3akaRin closed this Oct 15, 2026
@morluto

morluto commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Thanks @To3akaRin for identifying that function-local directive literals affect semantic fingerprints. Main now includes those values while keeping escaped strict-mode lookalikes distinct, with domain and CLI regression coverage (main).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants