Repository navigation
fix(javascript): keep unisolated program-var route values unknown - #6778
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The PR appears safe to merge; no new blocking issue was established. SummaryMoves the unisolated program-
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]
Reviews (19) · Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
|
CI on the current head (
Earlier revisions also showed
|
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
Comments Outside DiffThese findings could not be posted inline.
|
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
Previous-head CI triage for
|
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
1 similar comment
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
CI refreshed on 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. |
|
Thanks, @gongfpp. The gap is real: a program-scope The guard only covers the I'd rather fix it where the binding is trusted: have |
016b16b to
d6cee71
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Reworked in
Behavior probe over value consumers, main vs
So Evidence:
|
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Hey @gongfpp, thanks for putting this together, the fix looks useful. What's left: the |
|
CI on The timeout is the runner, not this diff:
Every test in that file inflated by roughly 1.45×, including ones that touch neither Checked that the scanner itself did not get slower: replaying the twelve index fixtures from this test directly through I cannot re-run the job myself ( |
`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.
3721442 to
5e35ded
Compare
|
Correcting my earlier attribution, and the fix for it. I said the timeout was runner slowness. That was wrong, and the comparison with
The test that timed out — Fix in The head is also rebased onto |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
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.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
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.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
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.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
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.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
CI for
Every one of these is already red on
None of the four files belongs to 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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Refreshed onto Why: the red I attributed at Result on the refreshed head
Local, Node 22.22.2 on Windows 11 x64, after the merge: |
|
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
The red run keeps the same head and test files. It swaps only In the Node 24.22.1 red log, the 26 failures split like this:
Several are cases of On 874cfd3, all 23 CI check runs that ran passed. They include The head is 157 commits behind main b81da90. Not run
Test setup
Commandsnpm 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 🦊 |
Summary
Follow-up to #6642. At the maintainer's request this was reworked: the unisolated program-scope
varmark 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
varin a script without a proven isolated runtime is a property of the global object, soglobalThis.NAMEor an alias such asconst host=globalThiscan 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.#resolvenow returns{ node, unproven }. It records the first binding in the chain that is a program-scopevarwhile the existing parser runtime-context owner returnsunknown, then continues following the source initializer. No consumer opts in; each one decides what the same fact means:indexflag: unknown, no candidate (unchanged from the previous head);#walkroot,#indexRouteParents): keep walking the source array/object and record an incomplete-interpretation fact on that frame, sovar routes=[...]keeps its routes instead of losing them. Achildrenvalue read from an unisolatedvarkeeps 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;#selectedValues) and named-parent resolution: treat as unproven and stop trusting it;Reuse
javaScriptRuntimeContext; Babel's syntacticsourceTypeis 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
JavaScriptRouteScan.#resolveinsrc/domain/javascript/javascriptRouteScan.ts, before inventory and CLI/MCP view projection.varas unproven for every consumer"). It is not a claim of maintainer approval..cjs/.ctsand.mjs/.mtsisolation controls, lexical bindings and function-local controls are covered. A bare.jswithout proven runtime isolation is not assumed to have a CommonJS wrapper.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
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
var, chained aliases, TypeScript wrappers and type-only exports; value-consumer regressions for a program-varparent 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-localvar; 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 from63b66fa49and every fixture still fails with the production file reverted to main) versus this head874cfd3b7:var PATH='/a';globalThis.PATH='/b';...[ {path:PATH} ]/a(medium)var TARGET='/t';globalThis.TARGET='/u';router.push(TARGET)/t(low)var NAV={pathname:'/x'};...;router.push(NAV)/x(low)var INDEX=true;globalThis.INDEX=false;...[ {index:INDEX} ]/var routes=[{path:'/reports',children:[{path:'child'}]}];createBrowserRouter(routes)var children=[{path:'/kept',Component:View}];const config={path:'/parent',children}/parent,/kept/parent,/keptplus incomplete-interpretation unknown (the previous headd6cee7159dropped both; fixed in3721442b0)var SHARED={query:{path:'/data',Component:View}};const HOLD=SHARED;router.push({pathname:'/reports',query:HOLD.query})/reportsonly/reportsonly; head8247ab68dalso reported/dataroute:{path:'/independent',Component:View}onSHARED/reports,/independent/reports,/independent; head95c2768b3dropped/independentconst PATH='/a';globalThis.PATH='/b'/a/a, no unknown (unchanged)varinroutes.mjs/a/a, no unknown (unchanged)Validation performed
mainmoved 51 commits while this was in review and the branch turneddirty. The single conflict wassemanticBindingAtRead, whose third argument is now the full binding state instead ofparentsByNode; the merge keeps the unproven-var proof and adopts the new call shape. Net diff againstmainis still 4 files, +494/-25.src/domain/javascript/javascriptRouteScan.test.ts+javascriptRouteInventory.test.ts— 344 passed; the javascript domain subtree — 4960 passed across 172 files; the wholesrc/domaintree after mergingmainat808491685— 9852 passed across 453 files.javascriptRouteScan.tstomainand keeping the new tests gives 24 failed / 320 passed, so the fixtures still test this change rather than the harness.8247ab68dwhile keeping the new regression:expected [ '/reports', '/data' ] to deeply equal [ '/reports' ](1 failed / 291 passed).tsc --noEmit: 0 errors.tests/acceptance/javascriptRoutesCli.test.tsstill cannot run on this host: the compiled CLI reportsREA 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.874cfd3b7, which mergesmainat808491685: every lane green —Static checks,Source tests, and all eightTest shardjobs, including shard 7/8. The red seen atefbe8652ewas inherited frommainatfe677f6cf(run 42019093696:Static checksLint: 6430 files, 1 errors, plusfridaCli.test.ts,processCapture.comparison.test.tsandanalysisViewMcp.test.tsacross shards 4/5/6); upstream fixed those at808491685, where onlyDependabotfails, and this head now passes.npm run lintfailed ontests/acceptance/webSourceLocationCli.test.ts(max-lines-per-function, 175 > 150 lines) whilemaincarried that red; that file and the lint configuration were byte-identical tomain(git diff upstream/mainempty for both), so the hook was bypassed for that push rather than mixing an unrelated fix into this diff. Upstream fixed the file at808491685, andStatic checksis green on the refreshed head.For evidence-bearing changes:
Compatibility, safety, and release
Author readiness
Human owner: @gongfpp
Before merge
type(scope): outcome.