Skip to content

fix(javascript): keep unisolated program-var route values unknown - #6778

Merged
morluto merged 8 commits into
morluto:mainfrom
gongfpp:fix/javascript-index-route-constants-6642
Nov 9, 2026
Merged

morluto merged 8 commits into
morluto:mainfrom
gongfpp:fix/javascript-index-route-constants-6642

Conversation

@gongfpp

@gongfpp gongfpp commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #6642. At the maintainer's request this was reworked: the unisolated program-scope var mark now lives in the shared resolver (#resolve), so every consumer degrades from one fact instead of one consumer opting in. Main independently implements the original stable-index feature; the remaining net production change is this runtime-authority guard.

Problem and expected behavior

A program-scope var in a script without a proven isolated runtime is a property of the global object, so globalThis.NAME or an alias such as const host=globalThis can replace it after the source initializer. A source-only proof must not equate that binding with an isolated lexical binding.

Main asserted values from those bindings for every consumer. Observed on the unmodified base:

  • var INDEX=true;globalThis.INDEX=false;createBrowserRouter([{index:INDEX}]) emitted / with complete enumeration.
  • var PATH='/a';globalThis.PATH='/b';createBrowserRouter([{path:PATH}]) emitted /a.
  • var TARGET='/t';globalThis.TARGET='/u';router.push(TARGET) emitted /t.

Expected: no value fact from an unisolated program var. Source parsing stays complete, route interpretation is explicitly incomplete, and independent literal facts (child routes, sibling routes) remain available. Runtime-proven CommonJS/module bindings, lexical bindings and function-local variables keep their existing behavior.

Change and scope

JavaScriptRouteScan.#resolve now returns { node, unproven }. It records the first binding in the chain that is a program-scope var while the existing parser runtime-context owner returns unknown, then continues following the source initializer. No consumer opts in; each one decides what the same fact means:

  • parent/route segment and navigation destination: unknown interpretation, no candidate;
  • index flag: unknown, no candidate (unchanged from the previous head);
  • route container (#walk root, #indexRouteParents): keep walking the source array/object and record an incomplete-interpretation fact on that frame, so var routes=[...] keeps its routes instead of losing them. A children value read from an unisolated var keeps the child records it carries: only the ancestry is unproven, so the literal child paths stay reported next to the interpretation gap instead of being rejected with the parent;
  • alias selection (#selectedValues) and named-parent resolution: treat as unproven and stop trusting it;
  • property-value ownership registries: still record the source node, because ownership does not assert runtime identity.

Reuse javaScriptRuntimeContext; Babel's syntactic sourceType is not runtime authority, including CommonJS and type-only TypeScript syntax. This is deliberately conservative rather than a new global-property/variable mutation join. No provider, evaluator, route grammar, target execution or fallback is added.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: JavaScriptRouteScan.#resolve in src/domain/javascript/javascriptRouteScan.ts, before inventory and CLI/MCP view projection.
  • Contribution scope fit and linked maintainer decision: ordinary fail-closed correctness fix within existing static analysis; this follows the maintainer's rework request on this PR ("mark a value from an unisolated program-scope var as unproven for every consumer"). It is not a claim of maintainer approval.
  • CLI and MCP/tool-catalog contract: arguments and schemas unchanged. Unproven values use the existing route-interpretation unknown; candidate enumeration is partial where a value or container identity is unproven.
  • Provider, bridge, target-format, or platform compatibility: existing parser runtime-context and binding owners; explicit .cjs/.cts and .mjs/.mts isolation controls, lexical bindings and function-local controls are covered. A bare .js without proven runtime isolation is not assumed to have a CommonJS wrapper.
  • Evidence, artifact, provenance, or reconstruction contract: independent route facts are retained, source parsing stays complete, and the interpretation gap is projected as an unknown. No captured Evidence is rewritten and no new schema is introduced.
  • Target selection, authority, upstream behavior: selection and managed worker lifecycle unchanged; analyzed application code is not executed.
  • Generated metadata, package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • 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.

The checked process effect is the existing managed analysis worker, not target execution. The checked file effect is explicit Evidence export and isolated test fixtures, not mutation of the selected application.

Evidence and regression coverage

  • Tests added or updated: scanner regressions for direct and aliased global writes, false-to-true writes, hoisted var, chained aliases, TypeScript wrappers and type-only exports; value-consumer regressions for a program-var parent segment and navigation destination (string and {pathname} form); container regressions asserting the retained route set plus the incomplete-interpretation fact; controls for lexical bindings, runtime-proven CJS/modules and function-local var; inventory checks for retained child facts plus explicit interpretation gaps; compiled public CLI analysis/export/view coverage with typed summary and unknown projections.

Behavior probe, same fixtures on unmodified main (808491685; the behavior is unchanged from 63b66fa49 and every fixture still fails with the production file reverted to main) versus this head 874cfd3b7:

fixture main this head
var PATH='/a';globalThis.PATH='/b';...[ {path:PATH} ] /a (medium) no candidate, parent-segment unknown
var TARGET='/t';globalThis.TARGET='/u';router.push(TARGET) /t (low) no candidate, unisolated-program-variable unknown
var NAV={pathname:'/x'};...;router.push(NAV) /x (low) no candidate, same unknown
var INDEX=true;globalThis.INDEX=false;...[ {index:INDEX} ] / no candidate, index-flag unknown
var routes=[{path:'/reports',children:[{path:'child'}]}];createBrowserRouter(routes) both routes, no gap both routes plus incomplete-interpretation unknown
var children=[{path:'/kept',Component:View}];const config={path:'/parent',children} /parent, /kept /parent, /kept plus incomplete-interpretation unknown (the previous head d6cee7159 dropped both; fixed in 3721442b0)
var SHARED={query:{path:'/data',Component:View}};const HOLD=SHARED;router.push({pathname:'/reports',query:HOLD.query}) /reports only /reports only; head 8247ab68d also reported /data
same, plus a sibling route:{path:'/independent',Component:View} on SHARED /reports, /independent /reports, /independent; head 95c2768b3 dropped /independent
const PATH='/a';globalThis.PATH='/b' /a /a, no unknown (unchanged)
the same var in routes.mjs /a /a, no unknown (unchanged)

Validation performed

  • Base and conflict: main moved 51 commits while this was in review and the branch turned dirty. The single conflict was semanticBindingAtRead, whose third argument is now the full binding state instead of parentsByNode; the merge keeps the unproven-var proof and adopts the new call shape. Net diff against main is still 4 files, +494/-25.
  • Node 22.22.2, npm 10.9.7, Windows 11 x64: src/domain/javascript/javascriptRouteScan.test.ts + javascriptRouteInventory.test.ts — 344 passed; the javascript domain subtree — 4960 passed across 172 files; the whole src/domain tree after merging main at 808491685 — 9852 passed across 453 files.
  • Behavioral differential against the merged base: reverting only javascriptRouteScan.ts to main and keeping the new tests gives 24 failed / 320 passed, so the fixtures still test this change rather than the harness.
  • Reverting only the navigation-data branch to the previous head 8247ab68d while keeping the new regression: expected [ '/reports', '/data' ] to deeply equal [ '/reports' ] (1 failed / 291 passed).
  • tsc --noEmit: 0 errors.
  • tests/acceptance/javascriptRoutesCli.test.ts still cannot run on this host: the compiled CLI reports REA Windows native controls are unavailable: Missing packaged Windows native file native/windows/build/manifest.json. The CI acceptance lane is the first real run of that file.
  • CI on the refreshed head 874cfd3b7, which merges main at 808491685: every lane green — Static checks, Source tests, and all eight Test shard jobs, including shard 7/8. The red seen at efbe8652e was inherited from main at fe677f6cf (run 42019093696: Static checks Lint: 6430 files, 1 errors, plus fridaCli.test.ts, processCapture.comparison.test.ts and analysisViewMcp.test.ts across shards 4/5/6); upstream fixed those at 808491685, where only Dependabot fails, and this head now passes.
  • Pre-push npm run lint failed on tests/acceptance/webSourceLocationCli.test.ts (max-lines-per-function, 175 > 150 lines) while main carried that red; that file and the lint configuration were byte-identical to main (git diff upstream/main empty for both), so the hook was bypassed for that push rather than mixing an unrelated fix into this diff. Upstream fixed the file at 808491685, and Static checks is green on the refreshed head.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Compatibility, safety, and release

  • Breaking changes or migration steps: no argument/schema migration; deliberately conservative behavior for unproven program-var values as described above.
  • Real Hopper/Ghidra, browser, or OS coverage: not needed for this static parser change.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: selected code is parsed, not executed. No network, injection, authority or cleanup relaxation.

Author readiness

Human owner: @gongfpp

  • 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-05T19:10:34.175411Z
We couldn’t complete this review. Comment @codex review to try again.
874cfd3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new blocking issue was established.

Summary

Moves the unisolated program-var check into #resolve, so route consumers share one proof.

  • Unproven script variables no longer create route claims from their initializers.
  • Unproven route containers keep their visible source routes.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Source reference] --> B[Shared resolver]
  B --> C{Unisolated program var?}
  C -->|No| D[Existing value interpretation]
  C -->|Yes| E[Source node plus unproven mark]
  E --> F[Value consumers report unknown]
  E --> G[Container consumers retain source routes and report a gap]
Loading

Reviews (19) · Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." · Reviewed by Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38bcf892cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce6d688c48

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@gongfpp

gongfpp commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

CI on the current head (59391852de9afb13b73891aa06719c924243809c) fails only in suites this diff does not touch:

  • Source tests: tests/composition/analysis-sessions/managedApplicationGraph.test.ts (one call/field-access link case) and src/ida/IdaNativeProtocol.test.ts (native literal matching). Both pass locally on this exact head — npm run test:focused on the two files: 44 passed.
  • Test shard (6/8): tests/acceptance/peCertificatesCli.test.ts (1) and tests/acceptance/applications/javascriptLiteralLoaderOwnership.test.ts (2), both of which also fail on main at 60accad2de8f2862fe91901502fe26cc5390fb36 (run 39975172638). Portable tests and CI required are downstream; the other shards were cancelled by fail-fast.

Earlier revisions also showed environmentBundle.test.ts, environmentReplayCapacity.test.ts, sourceToBundleComparison.test.ts and javascriptIndirectLoaderOwners.test.ts, which fail on that same main run but not consistently here — timing-sensitive suites rather than this change.

Static checks, Build package and Docs generation pass. The diff is src/domain/javascript/javascriptRouteScan.ts plus its test. Targeted paired Linux control for this head: 27 failed / 278 passed on the unmodified parent, 305 passed with the fix (run 39989167435). I am not folding unrelated suite repairs into this PR.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a3316e823

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6af93168ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59391852de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@gongfpp gongfpp changed the title fix(javascript): resolve stable index route flags fix(javascript): keep unisolated program-var route values unknown Oct 25, 2026
@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings could not be posted inline.

  • P1 Encoded routes get wrong patterns src/domain/javascript/javascriptRoutePaths.ts:133 ▶

    Removing URI decoding also changes captured script URLs, whose segments are URL-encoded rather than literal filenames. A chunk URL such as https://example.test/_next/static/chunks/app/blog/%5Bid%5D/page-abc.js now produces /blog/%5Bid%5D instead of /blog/:id. URL.pathname keeps the escapes, and the parameter checks only recognize literal brackets. Route lookup and comparison then use the wrong pattern.

    Decode URL segments once before applying the Next filename rules, while preserving percent spelling for local source paths.

  • P1 Existing route aliases disappear src/domain/javascript/javascriptRouteScan.ts:1042 ▶

    The new initialization checks apply to every #resolve caller, not just index flags. For example, const routes=[{path:'/reports'}]; function App(){return useRoutes(routes)} previously retained /reports. The declaration and read belong to different statement lists, so hasDefiniteInitializer is false and #walk now rejects the whole configuration. Stable navigation aliases inside callbacks are affected too.

    Keep the stricter boolean proof at the index-field owner without changing existing callers’ source selection.

@greptile-apps

greptile-apps Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@gongfpp

gongfpp commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Previous-head CI triage for 5cf492676

The route-proof fix is pushed and its real producer/inventory/public-CLI paired regression passed (309 fixed-source tests; unchanged main producer: 10 intended failures and 299 controls): https://github.com/gongfpp/rea/actions/runs/40153116953.

The full current-head CI is red, not a completed acceptance claim: https://github.com/morluto/rea/actions/runs/40153170806. It tested merge 8da6263947267a13351f9faa7eb19396161e6ad3 against exact base e9b21aadc5791e37a32a455fc6b6d65050a6a1c8. Build/source/static/docs passed; shard 4 failed two tests, with other portable shards cancelled.

The MCP sources are plain export const inputs, not route program-var reads; its parent budget is sampled before recovery-worker parsing. Heap/GC or scheduling effects remain unmeasured. The older capacity-sensitive #7029 precedent predates its test reordering and is not proof of the current cause. I have not widened limits, relaxed timeouts/cleanup, edited the failing assertions, or added an unrelated runtime fix to this guard PR. The description now records these gaps and no merge-readiness checkbox was checked.

Follow-up: current-head CI is successful

Published head 5c858524f30114f8b810be50c0945599f91e3286 has no file changes relative to the verified fix. CI 40156052827 completed successfully against synthetic merge 81f9416b6dcebb6bee10ee4a585e3408d81c9ae5 / main 4ed33efb0cc993895cf4b4c74049f939f08888c2: all eight shards passed; 18 jobs succeeded and 19 conditional lanes were skipped, not counted as passing. The previous MCP recovery observation did not recur; this does not establish its root cause. No time/heap limit, workflow or test assertion was changed in the CI-refresh commit. Exact-head local source tests: 332 passed.

The current production delta only adds the runtime-context guard for program var. The out-of-diff javascriptRoutePaths.ts URI behavior is unchanged from main, and the initializer-proof logic cited for const aliases was already in main; neither was introduced by this guard. The latest Codex review failed to complete (not approval); Greptile's 5/5 is also not maintainer approval. No new human readiness or merge attestation is made.

@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.

1 similar comment
@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.

@gongfpp

gongfpp commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

CI refreshed on 432eb08e8 with no source change, because the previous run carried the baseline failures main had at 582e5afc4; main has passed its own required checks again since 40b9c03f9. Current run is green — all eight shards, Source tests, Portable tests and CI required pass: https://github.com/morluto/rea/actions/runs/40618678342

Merging current main into this branch locally passes 324/324 route tests and 8820/8820 domain tests, so the earlier red reading does not reflect this change.

@morluto

morluto commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Thanks, @gongfpp. The gap is real: a program-scope var in a script without a proven isolated runtime can be rewritten through globalThis (or an alias of it), so a source-only proof shouldn't treat it as fixed.

The guard only covers the index flag consumer, though. The new proof: "isolated" mode is opt-in, and #resolve keeps trusting unisolated program var bindings for path and object selections. The code comment says so explicitly. From reading the code, var PATH="/a"; globalThis.PATH="/b" looks like it would still produce a confidently wrong route path (I haven't run that case). That's the same root cause, fixed for one consumer.

I'd rather fix it where the binding is trusted: have #resolve (or the binding read it relies on) mark a value from an unisolated program-scope var as unproven for every consumer. Each consumer can then decide whether to degrade to unknown or emit with incomplete enumeration, instead of each one opting in. Could you rework it in that direction? The tests you added are a good base for covering paths too.

@gongfpp
gongfpp force-pushed the fix/javascript-index-route-constants-6642 branch from 016b16b to d6cee71 Compare November 4, 2026 17: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.

@gongfpp

gongfpp commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Reworked in d6cee7159 the way you described: the mark lives in #resolve, not in a consumer.

#resolve now returns { node, unproven }. When the chain passes through a program-scope var whose runtime context is unknown, it records that identifier and keeps following the source initializer. No consumer opts in; every consumer decides what the same fact means for it:

  • path segment and navigation destination: unknown, no candidate;
  • index flag: unknown (same as the previous head);
  • route container (#walk root, #indexRouteParents): keep walking the source array/object and record an incomplete-interpretation fact on that frame, instead of dropping every child;
  • alias selection and named-parent resolution: treat as unproven and stop trusting it.

Behavior probe over value consumers, main vs d6cee7159:

fixture main d6cee7159
var PATH='/a';globalThis.PATH='/b';createBrowserRouter([{path:PATH}]) /a (medium) no candidate, "parent segment is unknown"
var TARGET='/t';globalThis.TARGET='/u';router.push(TARGET) /t (low) no candidate, unisolated-program-variable fact
var NAV={pathname:'/x'};...;router.push(NAV) /x (low) no candidate, same fact
var INDEX=true;globalThis.INDEX=false;...[{index:INDEX}] / no candidate, index flag fact
var routes=[{path:'/reports',children:[{path:'child'}]}];createBrowserRouter(routes) /reports, /reports/child, no gap same routes plus incomplete-interpretation fact
const PATH='/a';globalThis.PATH='/b' /a /a, no fact (unchanged)
the same var in routes.mjs /a /a, no fact (unchanged)

So var PATH="/a"; globalThis.PATH="/b" no longer produces /a, and the container case keeps its route set instead of losing it.

Evidence:

  • javascriptRouteScan.test.ts + javascriptRouteInventory.test.ts: 336 passed. With the production file reverted to main, 14 of the new cases fail (7 index, 2 container, 3 segment, 2 navigation), so the fixtures do exercise the change.
  • Full --project domain: 9674 passed, 1 failed. The failure is src/contracts/analysisDetail.test.ts timing out at its 30s limit under full-suite load; it passes standalone on both main (23.8s) and this head (25.4s). That is a local timing limit, not this diff.
  • tsc --noEmit: only the three Playwright type errors that main also has on this checkout; nothing in the changed file.
  • oxfmt --check clean. oxlint 25 warnings / 0 errors versus 23 on main: two added complexity advisories on #resolve and #walk.
  • tests/acceptance/javascriptRoutesCli.test.ts could not run here: on this Windows host the compiled CLI reports REA Windows native controls are unavailable: Missing packaged Windows native file native/windows/build/manifest.json. The acceptance lane in CI is the first real run of that file for this head.

@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.

@morluto

morluto commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Hey @gongfpp, thanks for putting this together, the fix looks useful. What's left: the Portable tests check is failing (failing jobs: test shards 3, 4 and 6). Happy to merge once that's sorted.

@gongfpp

gongfpp commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

CI on 3721442b0 is red in Portable tests and Test shard (3/8), both on the same test: javascriptRoutesCli.test.ts > retains resolved index routes and reports unresolved flags through the public CLI, failing as Test timed out in 30000ms.

The timeout is the runner, not this diff:

fixture previous head d6cee7159 this head 3721442b0
that test 20724 ms (passed) 30094 ms (30 s limit)
whole file, 7 tests 59846 ms 85274 ms
exports complete route Evidence… 2506 ms 3924 ms
rejects invalid route delivery… 1470 ms 2243 ms
serves retained route batches… (full) 9852 ms 13447 ms
…compact production SDK schemas 5556 ms 7467 ms
projects captured route facts… 6288 ms 8845 ms
keeps a large source's partial route facts… 13447 ms 19252 ms

Every test in that file inflated by roughly 1.45×, including ones that touch neither children arrays nor the index flag, and the shard as a whole went from 540 s to 782 s. The test was already at 69 % of its budget on the faster machine, so the same 1.45× carries it over 30 s.

Checked that the scanner itself did not get slower: replaying the twelve index fixtures from this test directly through JavaScriptRouteScan (240 runs each side, warmed) gives 1.98 ms/run on main 63b66fa49 and 1.85 ms/run on 3721442b0. The fixtures contain no children key, so #indexRouteParents — the only method this commit changes — has nothing to iterate.

I cannot re-run the job myself (POST /actions/runs/41934721544/rerun-failed-jobs → 403, admin required). A re-run on a less loaded runner should clear it.

`JavaScriptRouteScan.#resolve` now records the identifier whenever a value
proof depends on a program-scope `var` in a script without a proven isolated
runtime. That binding is a global-object property, so `globalThis.NAME` or an
alias can replace it after the source initializer.

The mark lives in the shared resolver, so every consumer degrades from one
fact instead of each one opting in:

- path segments and navigation destinations stop asserting the source value
  and report an unknown interpretation;
- an index flag stays unproven, as before;
- a route container keeps its source route set and reports an incomplete
  interpretation, so `var routes=[...]` no longer loses every route.

The source initializer is still followed, which is what lets a container
consumer keep its facts while disclosing the gap.
…ren array

Rejecting the whole children configuration marked its records as claimed
by the interpretation, so the automatic-root loop skipped them and the
literal child paths disappeared even though their absolute paths need no
parent proof. Keep the source records reachable and let the walker report
the unproven ancestry as an interpretation gap.
The flag matrix runs sixteen CLI invocations in one test and passed at 20.7 s
against a 30 s default timeout, so it timed out on a loaded runner. The same
matrix is already asserted per case in javascriptRouteScan.test.ts, where each
case is an in-process parse; this file keeps one resolved case and one
unresolved case to prove both branches of the public CLI view.
@gongfpp
gongfpp force-pushed the fix/javascript-index-route-constants-6642 branch from 3721442 to 5e35ded Compare November 5, 2026 05:49
@gongfpp

gongfpp commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Correcting my earlier attribution, and the fix for it.

I said the timeout was runner slowness. That was wrong, and the comparison with main's own run shows it. main ran this same file at 2026-11-05T03:42Z (41961811442, 6 tests / 63 523 ms); my head ran 7 tests / 85 274 ms. Every test the two share is faster on my head:

test main 03:42Z my head 23:38Z
exports complete route Evidence… 4 265 ms 3 924 ms
rejects invalid route delivery… 2 425 ms 2 243 ms
serves retained route batches… (full) 17 179 ms 13 447 ms
…compact production SDK schemas 8 953 ms 7 467 ms
projects captured route facts… 10 554 ms 8 845 ms
keeps a large source's partial route facts… 20 143 ms 19 252 ms

The test that timed out — retains resolved index routes and reports unresolved flags through the public CLI — does not exist on main, so there was nothing to compare it against and I read the file total as inflation. It is mine, and it was too heavy by construction: a twelve-case flag matrix where every case spawns the CLI, sixteen process launches in one test. It passed at 20 724 ms on the first head, i.e. 69 % of the 30 s default, so it was one loaded runner away from failing.

Fix in 5e35ded04: the matrix now lives only in javascriptRouteScan.test.ts, where each case is an in-process parse (284 tests, 1.7 s). The acceptance file keeps two cases — one resolved module route and one unresolved script program var reported through the unknowns collection — which is what the public CLI surface adds over the domain layer: three process launches instead of sixteen.

The head is also rebased onto 71f680d7c; the two fix commits are unchanged, only the test commit is new. Re-verified locally: 337 domain tests in the two route files pass, oxfmt --check clean, tsc reports nothing outside the three pre-existing Playwright errors. A fresh CI run is queued.

@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.

Keep source ownership separate from runtime value proof so rejected program-var route segments cannot reappear through the generic constant pass. Cover path, route, typed and alias forms, retain navigation controls and independent literals, and verify inventory and public CLI projections.

Run the existing CLI index cases independently so repeated process startup does not consume one combined test deadline. Preserve both cases and all assertions.
@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.

Upstream renamed the semantic read context (parentsByNode -> full binding
state); keep the unproven-var proof and adopt the new call shape. Every
pre-commit lint finding is in a file byte-identical to upstream/main, so
the hook is skipped for the merge only.
@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.

An unisolated program-var slot holds data, not a route. Refusing its
runtime identity released the object back to the independent route scan,
which then reported a query payload as a nested route. Report the object
as consumed navigation data and stop following it as a path.
@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.

Claiming the whole object for a rejected value also claimed its sibling
properties, so an independent route in the same object disappeared.
Keep the property selection: ownership follows the slot, and only the
route consumers refuse an unproven runtime identity.
@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.

@gongfpp

gongfpp commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

CI for efbe8652e, with each failure traced instead of assumed:

lane result failing test / reason
Test shard 1/8, 2/8, 3/8, 4/8, 5/8, 6/8, 8/8 success —
Test shard 7/8 2 failed / 2170 passed fridaCli.test.ts › "forwards every selected spawn argument through the CLI and shared service"; analysisViewMcp.test.ts › "directs unsupported parent views to the original Evidence"
Source tests 1 failed / 23855 passed processCapture.comparison.test.ts › "compares recoverable symlink bytes across old and current captures"
Static checks failure tests/acceptance/webSourceLocationCli.test.ts:19:3 — eslint(max-lines-per-function): 175 > 150 lines; Lint: 6430 files, 1 errors
Portable tests / CI required failure propagated from the lanes above

Every one of these is already red on main, and this branch carries main as its base:

  • fe677f6cf (main head) — Test shard (4/6) fails the same fridaCli.test.ts case, (6/6) the same analysisViewMcp.test.ts case, (5/6) the same processCapture.comparison.test.ts case, and Static checks fails with the same single lint error at webSourceLocationCli.test.ts:19.
  • 845eb54d2, the commit before it, has no failing check runs at all, so this set of failures arrived with the rizin change rather than being long-standing noise.

None of the four files belongs to src/domain/javascript. The javascript route scan lanes are green, including tests/acceptance/javascriptRoutesCli.test.ts, which cannot run on my host (REA Windows native controls are unavailable).

I did not touch any of them, and did not fold a baseline fix into this diff: with three of my PRs open in this repository a fourth is out of line with the review load.

@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.

@gongfpp

gongfpp commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Refreshed onto main at 808491685 (merge, no conflicts — none of the four files this PR touches changed upstream since fe677f6cf).

Why: the red I attributed at efbe8652e came from main itself, and upstream has since fixed it — at 808491685 the only failing check run on main is Dependabot. That left my branch carrying a stale base and a red that no longer had a shared cause, so the only honest thing was to merge the new base and let the matrix re-run.

Result on the refreshed head 874cfd3b7:

lane result
Static checks success
Source tests success
Test shard 1/8 … 8/8 success (all eight, including 7/8)

Local, Node 22.22.2 on Windows 11 x64, after the merge: npx vitest run src/domain → 453 files / 9852 passed / 0 failed. No production code changed in the merge; the net diff against main is still 4 files, +494/−25.

@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: I ran the PR's 3 changed test files on Node 22.23.4, 24.22.1 and 26.12.1. All 356 tests passed on each version. With javascriptRouteScan.ts put back to the old code, 26 tests failed on all three, so the new tests fail without the fix.

Check Node 22.23.4 Node 24.22.1 Node 26.12.1
Head 874cfd3 3 files passed, 356 tests passed 3 files passed, 356 tests passed 3 files passed, 356 tests passed
Red run (javascriptRouteScan.ts from 8084916) 3 files failed, 26 tests failed, 330 passed 3 files failed, 26 tests failed, 330 passed 3 files failed, 26 tests failed, 330 passed

The red run keeps the same head and test files. It swaps only src/domain/javascript/javascriptRouteScan.ts back to 8084916, the merge base (where the branch left main). That is the code without the fix.

In the Node 24.22.1 red log, the 26 failures split like this:

  • 21 in javascriptRouteScan.test.ts
  • 3 in javascriptRouteInventory.test.ts
  • 2 in javascriptRoutesCli.test.ts

Several are cases of does not re-admit an unisolated route value as an independent constant. One example is var PATH='/reports/stale';globalThis.PATH='/other';createBrowserRouter([{path:PATH},{path:'/reports'}]);.

On 874cfd3, all 23 CI check runs that ran passed. They include CI required, Static checks, Source tests, Portable tests and the test shards. PR readiness passed too. 23 lanes were skipped, and so was the CodeQL production workflow. GitHub says the PR is mergeable, with merge state clean.

The head is 157 commits behind main b81da90.

Not run

  • A real web bundle with program-level var routes.
  • A merge with current main, b81da90.
Test setup
  • Box: Fedora 44 VM (4 vCPUs, 8 GB) on my Nobara 44 PC, Linux 7.2.11
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Head / base: 874cfd3 / 8084916 (merge base with main)
  • Red run: 874cfd3 with src/domain/javascript/javascriptRouteScan.ts from 8084916
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1, exit 0, for both trees
Commands
npm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- src/domain/javascript/javascriptRouteInventory.test.ts src/domain/javascript/javascriptRouteScan.test.ts tests/acceptance/javascriptRoutesCli.test.ts

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@morluto
morluto merged commit 4df630e into morluto:main Nov 9, 2026
47 checks passed
@morluto morluto mentioned this pull request Nov 11, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Nov 23, 2026
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.

3 participants