Repository navigation
fix(javascript): answer an over-budget member-mutation query by escaping whole objects - #14153
Conversation
…ing whole objects Member-mutation analysis enumerates alias states with exact member paths for each query. On a dense alias cluster one query can schedule tens of thousands of states, so a handful of queries spent the whole per-source allowance and the source was refused: a 328 KB Vite and React bundle was refused at any allowance. Each query now has a state budget derived from semantic_precision.alias_selections. A query that outgrows it is answered again as an escape of the whole value and of every value a write stored into it. An escape covers every effect below it, so the answer is a superset of the exact one; the alias-selections limit is recorded. Bindings an abandoned query walked are remembered so later queries that reach them collapse without spending their budget first. Refs #14150
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[Medium impact] The PR appears safe to merge; no new blocking issues were found. SummaryThe PR gives each member-mutation query a budget. Queries that exceed it restart by escaping whole objects, disclose reduced precision, and share work across later queries.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Start query] --> B[Walk exact member paths]
B --> C{Query exceeds budget?}
C -->|No| D[Keep exact answer]
C -->|Yes| E[Disclose reduced precision]
E --> F[Escape whole receiver and stored values]
F --> G[Share covered escapes]
B --> H[Charge source allowance]
F --> H
Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
…site A collapsed query escaped whole objects at its own call site, so every collapsed query walked the same dense alias cluster again. An escape that names no site may precede any read, which readers already treat as unknown timing. Its alias states then do not depend on the query that reached them, and a later collapsed query stops at whatever an earlier one covered. Refs #14150
|
Integration note with #14148. The two merge cleanly in git but do not compile together: #14148 moves the limit sets under I verified the full stack on a temporary merge of #14148, #14149, #14153, #14171 and #14191 with that one-line adjustment: 462 unit test files (10,903 tests) and all 28 End to end through the CLI (
|
…er alias A collapsed query started a nested walk for every alias reached through a projection, so a long chain of projected aliases nested one call per link and overflowed the call stack, where the exact walk follows the same links through its queue. An escape walk now queues the whole-object escape as another state.
…-mutation-query-budget
Summary
Refs #14150.
Member-mutation analysis walks alias states with exact member paths, once per query. On a dense alias cluster, a single query can schedule tens of thousands of states. A handful of such queries then spend the whole per-source allowance (
javascript.member_mutation_alias_states), and the source is refused with no semantic result.This PR gives each query its own state budget. A query that outgrows it is answered again by escaping whole objects, and that answer is shared by later queries.
Behavior
semantic_precision.alias_selections × 8states per top-level query, which is 4,096 at the default. It is derived from the existing control so the reported limit and its recovery stay truthful: raisingalias_selectionsraises the budget.alias-selectionsresource limit is recorded, so coverage ispartialwith the existing limitation text.Effect
Local, macOS arm64, Node 24.22.1, in-process.
Ordinary sources are unaffected. Over 121 completing files in a 122-file sample of real JavaScript (349,885 queries), the largest query on
mainschedules 407 states, so the budget never triggers. A 359-file sample (10.4 MB) compared by SHA-256 of static facts and semantic IR againstmainhas 0 differences. The harness is a local script, not part of this PR.The #8294 pathology completes.
selections(8), which the allowance test used to expect a refusal for, completes in 19 ms withpartialcoverage;selections(32)completes in 22 ms;selections(4)is stillcomplete.A real bundle completes at the default allowance.
playwright-core/lib/vite/dashboard/assets/index-hRvO4yU2.js(328 KB, Vite + React):main28,396 queries ran and 1,866 collapsed, at 40 states each on average. Before the site was dropped, a collapsed query cost about 212 states and the bundle needed an allowance of about one million.
The result has
partialcoverage, 6,122 bindings, 1,558 callables, 5,564 call sites and 3 request operations. Binding values: 190 literal, 5,006 unknown, 902 ambiguous. Those counts are the same with and without the site on the collapsed escape.Tests
javascriptMemberMutationQueryBudget.test.ts:javascriptSemanticWorkAllowance.test.ts: the default-allowance refusal test asserted a refusal forselections(8). That source now completes, so the test asserts the conservative answer for 8 and 32 selections, and the refusal's contract fields are asserted onjavaScriptMemberMutationRefusaldirectly.src/domain/javascript/*.test.tsandsrc/javascript/analysis/*.test.ts: 209 files, 6,235 tests passed. Allowance tests insrc/config,src/browser,src/application/javascriptandtests/boundary/javascriptpassed, as did thejavascriptReturnedReferencesandjavascriptAnalysisLimitsacceptance tests.oxfmt --check;check:fast.Not done
semanticModuleRequireCallAt→walkCommonJsModuleSource), described in [Design] Member-mutation alias analysis re-derives alias closures per site and refuses ordinary React bundles #14150.