Repository navigation
fix(javascript)!: preserve Vite dependency values and uncertainty - #1840
evenafterallisaid wants to merge 106 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f0bee9979
ℹ️ 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".
Codex Review Summary: ✅ CompletedThis 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. |
dandgabr
left a comment
There was a problem hiding this comment.
Review corrections
- P2 — Recognize equivalent down-leveled Vite helper shapes.
src/domain/javascript/javascriptViteDependencies.ts:101-104only recognizes the canonical arrow/default-parameter expression form. Transpilers can emit a function witharguments-based defaults or a block body while preserving the samem.f || (m.f = [...])table; those artifacts then lose preload dependency edges. Recognize semantically equivalent emitted forms, or preserve an explicit unknown dependency when such a helper is identified. - P2 — Key classified calls by full AST node identity.
src/domain/javascript/javascriptStaticAnalysisCalls.ts:153-155looks up Vite classification bynode.start. Babel gives__vite__mapDeps([0]).filter(Boolean)'s inner and outer calls the same start, so the outer call is misclassified as Vite and emits a spurious unknown import (or bogus table entry), downgrading otherwise complete evidence. Key the classification by the call node or an unambiguous source range. - P2 — Honor explicitly undefined default arguments. In
src/domain/javascript/javascriptStaticAnalysisCalls.ts:158-160,__vite__mapDeps([0], void 0)is treated as an override, although JavaScript applies the parameter default and uses the helper's default table. Distinguish provably undefined arguments from actual mapper overrides so known dependencies are retained.
dandgabr
left a comment
There was a problem hiding this comment.
Follow-up review
- P2 — Invalidate dependency tables after aliased or in-place cache writes. In
src/domain/javascript/javascriptViteDependencies.ts:188-199, mutation tracking resolves a write only from the identifier at the root of the target. A helper alias can therefore mutate the same cache without invalidating the original table:const alias = __vite__mapDeps; alias.f = ["./other.js"]; __vite__mapDeps([0]);can still be reported using the stale table. In-place array mutations such as__vite__mapDeps.f.splice(0, 1, "./other.js")also bypass the assignment/update/delete checks. Track alias writes and known mutating calls against the cache, or mark the table unknown when the cache escapes, so later edges do not claim stale dependency paths.
5f0bee9 to
d04d671
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. |
|
addressed all four findings in d04d671 and refreshed the branch against main.
the source regex and downstream table/index interpretation are removed; the reference consumer uses the domain owner's parsed facts and shared lexical index. no separate binding collector remains. validation: 80 tests across nine affected suites passed; the final cache representation was rechecked through public CLI/MCP and bundler suites (four tests, 38 public scenarios). the updated description records performance measurements and proof limits. stylesheet graph resolution and arbitrary runtime effects remain outside this static-analysis fix; browser and provider execution are unverified. refreshed CI is pending. |
|
@greptileai review |
[Medium impact] The follow-up appears safe to merge; both numbered previous findings are addressed and no new blocking issue was established. SummaryThe PR preserves decoded Vite dependency values as uncertain candidates and separates equal-content file occurrences. The follow-up:
Both numbered previous findings are addressed. No new actionable issue or security finding was established. Review was source-only; no tests were run. GitHub credentials were unavailable, so whether another PR supersedes this one could not be checked. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Parsed JavaScript] --> B[Helper and cache facts]
B --> C[Property snapshots]
C --> D[Recheck call exposures]
D --> E[Known values or explicit unknowns]
E --> F[Vite candidate references]
F --> G[Application graph]
H[File occurrence identities] --> G
G --> I[Version comparison]
J[Source digest and coordinates] --> I
Reviews (59) · Last reviewed commit: "fix(javascript): retain call authority a..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f029c24edc
ℹ️ 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: 1bb4b1feee
ℹ️ 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".
|
Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open. The ownership edge selected f before applying copy semantics, so a shared child was relabeled as the copied container. Edges now retain selection before an object-rest copy separately from selection after a spread copy. Copies lose container identity, and a later f projection regains the exact shared child identity. Copying the array itself does not regain its original identity. Source validation: inspected the producing boundary and affected consumers, applied targeted formatting with two threads, and passed git diff --check. Tests, builds, lint, typechecks, provider workloads, and CI reruns were not run, as explicitly requested. Added unrun projected-child assignment/splice cases and a nested object-rest copied-array independence case. Mutation consumers continue using the single ownership graph. An unresolved computed property was treated as proof that the original cache had been overwritten. Copy ownership now stops only at a proven f replacement with a fresh value; unresolved keys retain possible shared ownership so subsequent writes invalidate the original table conservatively. Source validation: inspected the producing boundary and affected consumers, applied targeted formatting with two threads, and passed git diff --check. Tests, builds, lint, typechecks, provider workloads, and CI reruns were not run, as explicitly requested. Added an unrun computed-key override case. Unknown keys stay possible in the shared owner instead of being repaired in dependency-output consumers. The copy owner ignored keys contributed by later literal spreads. It now computes cached literal-spread facts iteratively and recognizes a definitive fresh f override before retaining earlier shared-cache ownership. Unknown expressions/keys remain possible, and nested literal spreads reuse source-sized cached facts. Source validation: inspected the producing boundary and affected consumers, applied targeted formatting with two threads, and passed git diff --check. Tests, builds, lint, typechecks, provider workloads, and CI reruns were not run, as explicitly requested. Added unrun direct and nested literal-spread override cases. The helper uses an explicit work stack rather than recursive rewalking and does not enumerate owner cross-products; performance was not measured. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a28279108a
ℹ️ 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".
|
Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open. The Vite helper matcher rejected TypeScript ES5 output with plain parameters and assignment-guarded defaults. It now recognizes the exact ordered undefined guards and return shape before rejecting the candidate. Added a representative TS 6 ES5 fixture. Validation: formatter and The fresh-replacement whitelist omitted regular-expression literals, so a write to a replacement regexp invalidated the original cache. RegExp literals are now classified as fresh replacements through the shared recursive freshness owner. Added a |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e8dbeb7a3
ℹ️ 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".
|
Hey @evenafterallisaid, thanks for this! The fix looks good. What's left: it has merge conflicts with main in |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
TL;DR: On head 80711fc, both of my open cases are fixed. A frozen object read back from a property now says unknown on both calls. The harmless-reads case now keeps first.js. The 39 changed test files pass on Node 24, and I did not test the merge with main. Edit (8 Nov): I ran the new head, 97e86f5, in a VM, and the results are here. This follows my review above, which ran head 09bf40f. Please read this first. On this head the CLI marks each Vite table value as a candidate with partial coverage, even in the control with no write. So "first.js, complete" no longer appears. A candidate with a path is the old "first.js". A candidate with no path is the old "unknown". I ran 25 small cases through the compiled CLI on Node 24, each with its real final value from plain Node. In the table, Before is from my review above (I did not rerun 09bf40f), and Now is 80711fc.
The harmless-reads fix does not hide a real write. Three new guards still say unknown, and the real value is last.js in each. One is a harmless read, then a write. One copies the cache into another object with The earlier fixes still hold. These all say unknown: direct Every freeze case also says unknown on the lead call, whose real value is first.js. That is safe too. Tests on Node 24.22.1: 39 changed test files, 535 tests, all pass. On Node 22.23.4 and 26.12.1, 12 of those files (the Vite files, 233 tests) also pass. The tests ran at the same time as my other runs on the same 4 vCPUs, so their times are rough. The merge. GitHub shows the branch as conflicting with main. That is GitHub's report. I did not test the merge, so the compile error in my review above is neither confirmed nor cleared. The head alone typechecks (exit 0). I ran only this head. The branch has commits from the author (24 Oct to 6 Nov) and from morluto (29 Oct), so I can't say which commit fixed which case. Still not run
Thanks, evenafterallisaid, for the work on this branch since my last review. Test setup
CommandsThe 39 test files are the test files in Each fixture folder holds main.js and six small modules (first.js, last.js, other.js, decoy.js, left.js, right.js). main.js ends with The cases that use 🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91a2db2b72
ℹ️ 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: 97e86f5751
ℹ️ 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".
|
TL;DR: On head 97e86f5, the 38 changed test files passed on Node 22.23.4, 24.22.1 and 26.12.1. The Findings
Not run
Test setupCommandsnpm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- src/domain/javascript/electronStaticReceiverAdmission.test.ts src/domain/javascript/javascriptApplicationVersionMatching.test.ts src/domain/javascript/javascriptIntrinsicInvocation.test.ts src/domain/javascript/javascriptStaticAnalysis.mapEndpoints.test.ts src/domain/javascript/javascriptStaticAnalysisElectronApplicability.test.ts src/domain/javascript/javascriptStaticAnalysisFindings.steps.test.ts src/domain/javascript/javascriptViteDependencies.steps.test.ts src/domain/javascript/javascriptViteHelperDefaults.test.ts src/domain/javascript/javascriptViteInheritedValues.test.ts src/domain/javascript/javascriptVitePreloadDependencies.test.ts src/domain/javascript/javascriptViteTableCandidates.test.ts src/javascript/analysis/JavaScriptWorkerViteCandidate.test.ts tests/acceptance/applications/applicationVersionMatchingCli.test.ts tests/acceptance/applications/bundlerCallbackMetadataCli.test.ts tests/acceptance/applications/javascriptCheckpointReserveCli.test.ts tests/acceptance/applications/javascriptContentDeduplicatedModulePaths.test.ts tests/acceptance/applications/javascriptEndpointPayload.test.ts tests/acceptance/applications/javascriptSourceMapVersionCli.test.ts tests/acceptance/applications/javascriptViteDependencies.test.ts tests/boundary/cli/javascriptBundlerRuntimeScopes.test.ts tests/boundary/filesystem/artifactLiteralBackslash.test.ts tests/boundary/filesystem/javascript-applications/javascriptApplicationEmptyLiterals.test.ts tests/boundary/filesystem/javascript-applications/javascriptApplicationTemplateLiterals.test.ts tests/boundary/filesystem/javascript-applications/javascriptArtifactReconstruction.test.ts tests/boundary/filesystem/javascript-applications/javascriptAsarOccurrenceIdentity.test.ts tests/boundary/filesystem/javascript-applications/javascriptBundlerAdapters.test.ts tests/boundary/filesystem/javascript-applications/javascriptFileOccurrenceIdentity.test.ts tests/boundary/filesystem/javascript-applications/javascriptRuntimeReconciliation.test.ts tests/boundary/filesystem/javascript-applications/javascriptSourceMapVersionOccurrence.test.ts tests/boundary/filesystem/javascript-applications/viteOutputDependencies.test.ts tests/boundary/filesystem/javascript-applications/viteTableCandidate.test.ts tests/boundary/filesystem/javascriptArtifactReconstruction.test.ts tests/boundary/filesystem/javascriptSourceMapLocations.test.ts tests/boundary/filesystem/sourceToBundlePaths.test.ts tests/boundary/mcp/javascriptAnalysisResources.test.ts tests/boundary/mcp/javascriptFactsViewMcp.test.ts tests/boundary/mcp/javascriptLiteralBudget.test.ts tests/boundary/mcp/javascriptNativeHandoffIdentity.test.ts🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae97bb1bf8
ℹ️ 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".
| t.isLiteral(node) || | ||
| t.isFunction(node) || | ||
| t.isObjectMethod(node) || | ||
| t.isClass(node); |
There was a problem hiding this comment.
Preserve cache ownership through class heritage
A remaining route beyond the class-field initializer case is superclass inheritance: for an admitted function-form helper, __vite__mapDeps([]); const C = class extends __vite__mapDeps {}; C.f[0] = './last.js'; __vite__mapDeps([0]); returns ./last.js. The subclass inherits the live cache, but this classification makes C foreign, and no field initializer exists to trigger the exposure pass. Consequently, the indexed write loses its cache owner and the final selection retains the stale ./first.js candidate. Preserve the superclass ownership edge or conservatively expose superClass when indexing the class.
AGENTS.md reference: AGENTS.md:L21-L21
Useful? React with 👍 / 👎.
| if (t.isAwaitExpression(node)) expose(node, node.argument); | ||
| if (t.isForOfStatement(node) && node.await) | ||
| expose(node, identities.containedValues(node.right)); |
There was a problem hiding this comment.
Expose cache-bearing receivers of with statements
For sloppy-script input, __vite__mapDeps([]); with (__vite__mapDeps) { f[0] = './last.js'; } __vite__mapDeps([0]); mutates the live cache through the dynamic environment. The semantic binding owner deliberately leaves f unresolved, but this effect index neither exposes WithStatement.object nor connects the dynamic lookup to that receiver. The write therefore has no cache owner, and the final selection still emits the stale ./first.js candidate instead of an unknown. Retain the with receiver as a possible exposure when lookup ownership cannot be proved.
AGENTS.md reference: AGENTS.md:L21-L21
Useful? React with 👍 / 👎.
summary
recover decoded vite dependency table values, exact array slots, and source ranges through the shared javascript analyzer, cli, and mcp. table selections remain candidates when the actual load target is unproven. holes, dynamic slots, and changed or exposed caches remain explicit unknowns. independent direct imports retain their resolved targets.
the shared ast, binding, allocation, and property owners distinguish primitives, source containers, copied values, inherited values, and reachable cache owners. normalized descriptor facts retain enumerability and copied child identities. file-occurrence identities distinguish equal-content siblings while retaining digests and original Evidence. version comparison uses path and content for source-map occurrences while retaining container provenance in Evidence. retained historical Evidence remains readable.
table-only selections use
vite-table-candidate/candidatereferences. graph coverage records unresolved candidates.review fixes
inherited helper constructors retain a shared owner for Function prototype writes. snapshots preserve an ordered own constructor replacement.
the Vite intrinsic resolver considers writes from other scopes when deciding whether a callable or wrapper read has native authority.
writes through ownerless intrinsic aliases retain shared-prototype effects. named ambient paths retain their key-specific precision.
captured call and apply aliases check inherited wrapper authority at the capture site.
call exposure proofs are evaluated again after property snapshots settle, including assignments that replace data-only copy sources with getters.
version comparison pairs unchanged windows, context bridges, and utility processes by source digest, file path, and local selector while retaining the full occurrence identity in Evidence.
changed
Reflect.constructcalls remain opaque before the analyzer follows the constructor argument. captured callable and wrapper authority stay with the shared invocation resolver.borrowed non-array intrinsic calls retain their normalized receiver as an exposure, including getter dispatch through
Object.prototype.toString.call,.apply, andReflect.apply.array property selection preserves inherited constructor identity, including mapped helper results. ordered own-property replacements retain their selected value.
intrinsic-copy hazards use the write receiver and copied intrinsic identity. unrelated local writes preserve valid candidates. unproven receivers and external prototype exposures remain conservative.
property snapshots reuse indexed write positions and replacement proofs per allocation and key. restrictions invalidate those indexes. both property and copy indexes use one stable merge sort that yields in bounded steps. branches, repeating reads, multiple declarators, and unresolved effects retain conservative ordering.
main through
c52a9b9d7is integrated. conditional loader authority survives worker transfer and graph projection. Electron applicability requires an observed load with proven authority. main also includes the source-publication fixture fix that sizes its delivery budget from the current envelope.checkpoint and native-handoff assertions use file-occurrence identities and actual byte digests.
validation
the merged branch passed 5,489 selected source, service, and boundary cases across the broad run and the corrected Electron applicability rerun. all 12 source-publication fixture tests passed.
all 16 selected public tests passed, including Vite batches 26–29 on cli and sdk stdio mcp, Electron interop on both adapters, and version comparisons. the inherited constructor and three cross-scope replacements reproduced stale paths on the baseline.
build, formatting, and architecture guards passed.
all 62 compiled acceptance tests passed on Windows, including 445 Vite scenarios in 56 cli and sdk stdio mcp batches and six version comparison tests. the baseline reproduced five stale Vite cases and the removed-window comparison.
the broad domain run passed 5,098 tests. the unrelated-slot precision failure passed after narrowing the intrinsic write rule, alongside all 234 focused source tests.
build, formatting, and architecture guards passed.
the earlier
015a02d57merge passed 5,123 selected source, service, and worker-schema tests across the initial run and the corrected Electron applicability rerun. 17 additional compiled acceptance and boundary tests passed, including Vite batches 26–28, Electron cli and sdk stdio mcp, and loader authority. build, typecheck, lint, formatting, and architecture guards passed.on
e1996f58e, all 4,980 javascript domain tests passed locally across 178 suites, plus 30 focused boundary and public tests. these include captured call/apply and Electron workflows, loader method authority, and Vite batches 26–28 through cli and sdk stdio mcp.five new public cases cover replaced Reflect constructors, borrowed calls, alias writes, and changed/unchanged Reflect.apply. stale dependency paths reproduced on the baseline and stay unknown after the fix.
a 4,097-write property snapshot regression observed 9,214 ordering reads in one baseline step. the complete analysis now stays within the existing 8,192-read per-step bound and retains the expected candidate. the existing wide prototype-copy regression also passes. the four ordering tests complete locally in 5.35 seconds, with the snapshot case taking 3.62 seconds.
the complete 432-scenario cli/mcp matrix and all 60 affected boundary/acceptance tests passed locally on
3498d44d4.build, typecheck, lint, repository formatting, architecture guards, and Windows native artifact verification pass.
the native addon comes from the successful main run 42065378278 at the integrated commit. its verified SHA-256 begins with bacce63c6edd.
the Windows source-analyzer probe with 200 repeated writes retained the same candidate. replacement proofs fell from 80,000 to 200 and inert-write checks from 60,100 to 599. cold/warm elapsed time was 5,480/3,867 ms before and 5,689/3,782 ms after. cpu was 5,937/4,063 ms before and 6,047/4,047 ms after. process peak rss was 185,932/282,912 KiB before and 172,728/270,928 KiB after. the probe uses one process. total analyzer time stayed similar. whole-task token costs and cli/mcp performance were unmeasured.
hosted ci on
e1996f58ereported one source fixture timeout, with 42,005 other portable tests passing. the reduced fixture still reproduces the sorting regression against the native-sort baseline.local verification covers the selected Windows workflows. real-provider execution and the complete repository suite are outside this follow-up's local validation. the previous head failed one source-publication assertion. the merged fixture passes locally. fresh ci is pending on the updated branch.
Required repository checklist
Author readiness
Human owner: @evenafterallisaid