Repository navigation
Conversation
Bundlers fold request paths into one literal table and a base URL into a `const`, so the path never reaches a call site the request scanners can classify. `analyze_web_bundle` lost those paths entirely. Record a path- or URL-shaped literal as a low-confidence `endpoint_candidate` when it is an array element or a `const` URL binding. The scanner stays off call arguments: a literal passed to an unclassified callee is not endpoint evidence, and promoting it would make the two analyzers disagree on non-network calls. Template literals with expressions, computed values, object properties, `let`/`var` bindings, whitespace, control characters and backslash-prefixed values are rejected; a backslash can encode a cross-origin credential reference. Adding candidates adds input, so the inventory is bounded. The setting `web.bundle_endpoint_literal_candidates` (`REA_WEB_BUNDLE_ENDPOINT_LITERAL_CANDIDATES`, default 1024, maximum 4096, runtime) caps admitted literals per script and reports a structured `endpoint_literal_candidates` record plus an `unknowns` entry when literals are omitted. The worker then fits the survivors into the per-script result budget, dropping literal records only and keeping source order, so an oversized literal cannot evict the smaller ones after it. Count drops and byte drops stay separate because raising the setting recovers only the former.
The domain tests own the classifier; these cover the surfaces that carry the setting. The worker server case sends `endpoint_literal_candidates` and reads the written result file, so the protocol field, the admission default and the byte fit are exercised together. The CLI and stdio MCP cases prove the delivered document separates literal candidates from observed endpoints, and that a launch seed of `REA_WEB_BUNDLE_ENDPOINT_LITERAL_CANDIDATES` bounds the inventory.
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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The reviewed follow-up appears safe to merge. SummaryThe PR retains literal paths and URLs as low-confidence endpoint candidates, with a runtime count setting and the existing worker byte limit.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Resolve runtime count] --> B[Capture scripts]
B --> C[Collect literal candidates]
C --> D[Apply count ceiling]
D --> E[Fit candidates to worker bytes]
E --> F[Fit route facts]
F --> G[Merge results and omission records]
Reviews (13) · Last reviewed commit: "fix(web): charge the omission record's g..." · Reviewed by Greptile |
The new runtime setting changes the `inspect_analysis_settings` and `update_analysis_settings` input schemas, so their recorded digests move. Only the input digests change; each tool's output schema already described the setting list. The expected values are the ones CI printed on 44078001812 rather than a local `--update-summary` run, because this host is Windows and the summary comparison is skipped there. The committed bytes match that output exactly.
`IsolatedWebBundleAnalyzer.analyze` accepted the admission and then dropped it when it forwarded to the private per-script loop, so every CLI and provider call fell back to the worker's default ceiling. The new test fails without the forwarded argument. Found by the CLI boundary case on CI: the launch seed admitted four literals where the case expected one.
…by bytes The byte-fit regression measured its budget from a fixture that kept three candidates and an omission record, but the record is wider than a short candidate, so that fixture is larger than the untrimmed result and now exercises the new already-fits path instead of the trim. Measure the budget from the untrimmed result and use candidates long enough for the literals to decide what fits, then assert the trim, its source order and its byte-only omission again. Add the case the trim must not touch: one short candidate whose omission record would be wider than the candidate itself must be returned unchanged.
The documentation lifecycle asks for a specification, plan and tasks before a feature lands, and the new ceiling setting and classifier had none. Record the problem, the requirements the implementation keeps (ceiling admission, byte fit inside the existing result budget, omissions separated by cause, the parity contract), the acceptance the tests assert, the non-goals, and the one task left open.
Merges main at 819d046 into this branch. Conflicts were confined to the four surfaces main reworked while the PR awaited review: the limit inventory (moved from docs/design to docs/reference and stripped of its counts table), the analysis-settings catalog digests (main added zstd.max_frames, this branch adds web.bundle_endpoint_literal_candidates, both change the same input schemas), the analyzer test file whose refusal test main widened, and four import blocks. The feature behaviour and its tests are unchanged.
3dee82f to
a134695
Compare
…d tree AGENTS.md keeps specs, implementation plans, and task lists in issue or pull request discussions or in local drafts outside Git, and forbids committing local planning artifacts. The browser guide keeps the shipped behavior description.
`runtimeWebBundleEndpointLiteralAdmission` returned a pair of lazy getters, so a rejected `REA_WEB_BUNDLE_ENDPOINT_LITERAL_CANDIDATES` only threw when the worker read `maximumCount`. `IsolatedWebBundleAnalyzer` caught that per script, marked every script `worker_failure`, and returned a partial result the caller read as success: capture and worker startup had already happened. Resolve the ceiling in `#analyzeBundle`, next to the member-mutation allowance that already behaves this way, and return the configuration error before the target is opened. An accepted runtime override still wins over the launch seed.
`assemble([])` keeps every non-literal inference, so a result that already carries one has a non-empty array before the first literal arrives and that literal needs a separating comma. The incremental pass charged a comma only for later literals, so a literal whose own byte size exactly filled the remaining space was kept, pushed the measured result one byte over, and was then popped by the exact pass. The smaller literals behind it were never retried, so a script could report no literal candidates although one of them fit on its own.
…dpoint-literals # Conflicts: # docs/reference/rea-limit-inventory.md # scripts/verify/advertised-schemas/tools/inspect_analysis_settings.json # scripts/verify/advertised-schemas/tools/update_analysis_settings.json # src/config/analysisSettings.ts
The incremental fit measured `assemble([])` once and treated that base as carrying the widest possible omission record. The record also holds `admitted_count` and `omitted_by_result_budget`, so it grows by a byte when `admitted_count` reaches two digits. With 21 literals, a budget that the tenth literal exactly fills left that literal one byte over: the exact pass removed it, and the smaller literals behind it were never retried even though they fit. Measure the record at the size it will have after each admission instead of correcting the estimate afterwards. `baseWithoutRecord` keeps the non-record bytes, and every candidate is admitted against `baseWithoutRecord + kept bytes + its own cost + the record it implies`. Verified: `vitest run src/domain/webBundleEndpointLiterals.test.ts` (20 passed; the new 21-literal case keeps 13 without this change and 14 with it), `IsolatedWebBundleAnalyzer.test.ts`, `WebBundleAnalysisWorkerServer.test.ts`, `webBundleEndpointLiteralCandidates.test.ts` (27 passed), `tsc --noEmit`, oxlint and `oxfmt --check` on both files.
|
CI note on That test drives |
Summary
analyze_web_bundleloses request paths that a bundler folded into a literaltable or a base-URL constant. This records such a literal as a low-confidence
endpoint_candidateand bounds the inventory with one runtime setting.Supersedes #9836, which carried the same idea across 100 files and 54 commits and
is now conflicted against
main. This branch rebuilds the classifier on237b1ea5band drops the parts that changed unrelated analyzer behaviour.Problem and expected behavior
Bundled applications commonly keep every request path in one table:
The request scanners only classify calls they can prove are transport calls.
fetch("/api/feedback")becomes anendpointobservation, but the two tableentries and the base URL are unreachable from any call site, so the analysis
reported nothing for them. An agent therefore saw the one path the code happened
to call inline and none of the paths the app actually offers.
Expected: those literals appear as
endpoint_candidateinferences withconfidence: "low", aliteral:path-shapedorliteral:url-shapeddetector andtheir source position, never as
endpointobservations, and the number retainedis visible and adjustable rather than silently unbounded.
Change and scope
src/domain/webBundleEndpointLiterals.ts— the classifier. A literal is acandidate only when it has no whitespace or control character, no backslash
(which can encode
/\user:pass@hostcredentials in a browser), is a path rootedat
/(/x, not//,/?,/) or anhttp/https/ws/wssURL thatURL.parseaccepts.src/domain/webBundleAnalyzerInspection.ts— record it at an array element, orat a
constdeclarator initialized with a URL. Both are literal tables; the nodeis read where it is entered so source order keeps a nested literal ahead of the
same value in a following element, and the ancestor snapshot is taken only for a
URL-shaped initializer.
src/domain/webBundleEndpointLiteralBudget.ts,src/config/webBundleEndpointLiteralCandidates.ts— the settingweb.bundle_endpoint_literal_candidates(
REA_WEB_BUNDLE_ENDPOINT_LITERAL_CANDIDATES, default 1024, minimum 1, maximum4096,
update_mode: "runtime"), the per-script admission, the record schema andits message. A rejected launch seed is returned as a
ConfigurationErrorbeforecapture, the same way the member-mutation allowance already resolves.
src/domain/webBundleEndpointLiteralResultBudget.tsplus the worker requestfield — the worker fits the survivors into the per-script result budget it was
already given, and it fits them before route facts, so trimming literals frees
space instead of displacing a checked route inventory. Only literal records are
dropped, source order decides which ones, and one oversized literal does not end
the pass. A result that already fits is returned unchanged: reserving the
omission record first would drop a candidate whose record is wider than itself.
docs/guides/web/browser-observation.md— the analyst-facing description of thenew inference kind, its confidence, and the setting that bounds it. The planning
record for this change stays in this PR discussion:
AGENTS.mdkeeps specs,implementation plans and task lists in issue or PR discussions or in local drafts
outside Git.
endpoint_literal_candidatesand anunknownsentrywith
dimension: "endpoint_literal_candidates"when literals were omitted. Therecord separates the literals the ceiling dropped from those the byte budget
dropped, and the recovery message names the control that actually bound the
facet — raising the count setting does not recover a byte drop, and it is not
offered when the ceiling is already maximal.
src/domain/analysisResourceLimits.tssoanalysisSettingDefinitions.tscan import them without a cycle.Deliberately not included, because it changes behaviour outside this feature and
broke two existing cross-analyzer parity expectations on
main:to
getConfiguration("/api")orfs.open("/tmp/data.txt")stays with therequest scanners. Widening this scanner to call arguments made
web bundle configuration and navigation parityandweb bundle static-analysis parityreport paths the other analyzer does not, and the repository's paritycontract owns that decision, not a recall improvement.
detector or observation changes.
Base alignment
mainmoved 1,717 commits while this PR awaited review, so the branch now merges819d046eintoa1346957instead of sitting on237b1ea5b. Eight filesconflicted, in four groups, all because
mainreworked the same area:docs/reference/rea-limit-inventory.mdreplaceddocs/design/rea-limit-inventory.md,dropped the not-yet-landed limits table and the counts table, and filled in the
defaults this branch had described as owner defaults. The merged document keeps
main's structure and adds the one row for the new setting.mainaddedzstd.max_frames, this branchadded
web.bundle_endpoint_literal_candidates, and both change theinspect_analysis_settingsandupdate_analysis_settingsinput schemas. The twodigests were recomputed over the merged setting list, as described under
validation.
src/browser/IsolatedWebBundleAnalyzer.test.ts:mainwidened the refusal testthis branch had attached a case next to.
main's test is kept as merged and theliteral-forwarding case is re-attached after it.
The feature itself is unchanged: the classifier, the budget, the worker field and
the setting keep the behaviour and tests described below.
Contract and boundary impact
analyzer (
webBundleAnalyzerInspection.ts) produces the new inferences; thebundle merger aggregates the record; the isolated worker owns the byte fit. No
superseded path is removed and no policy responsibility moves.
within existing boundaries — no new provider, no target execution, no injection
or mutation — so no maintainer scope decision is required. The
#9836scope wasnot this code, so this replaces that diff rather than restating it.
analyze_web_bundle/rea analyze-web-bundlegainendpoint_literal_candidatesin the result, oneunknownsdimension, onelimitationssentence and oneupdate_analysis_settingsentry. No tool, option or command is added.only; the worker request field is optional, so a version mismatch degrades to the
default ceiling instead of failing a job.
the script key, artifact digest, detector, line and column. Candidates are
inferences, not observations, and never claim reachability.
Analysis reads the captured script text and starts no target work.
move, because the new setting is part of the
inspect_analysis_settingsandupdate_analysis_settingsinput schemas:scripts/verify/advertised-schemas/tools/{inspect,update}_analysis_settings.json(input digests only; both output schemas already described the setting list).
The limit inventory gains one row for
REA_WEB_BUNDLE_ENDPOINT_LITERAL_CANDIDATESin the runtime-settings table.
Expected effects:
Evidence and regression coverage
Tests added or updated:
src/domain/webBundleEndpointLiterals.test.ts(17 cases): the retained sites,deduplication and sanitization, the earlier nested coordinate, the ceiling
record and its structured
limit, the runtime ceiling, rejection of arbitraryliterals and computed strings, the ancestor-snapshot budget, the byte fit, the
maximalceiling,Mapkeys and call arguments,constversuslet/var,per-script aggregation and the inexact-count message, route facts surviving a
trim, and the backslash guard.
src/config/webBundleEndpointLiteralCandidates.test.ts(8 cases): launch seedparsing, the registered range, and runtime overrides winning over the seed.
src/browser/IsolatedWebBundleAnalyzer.test.ts: a new case holds the wrapperto forwarding the admission into the per-script loop. It fails when that
argument is dropped, which is exactly what the CI boundary run found.
src/browser/WebBundleAnalysisWorkerServer.test.ts: a new case sendsendpoint_literal_candidatesand reads the written result file, so the protocolfield, the default admission and the byte fit run together.
tests/boundary/cli/webBundleEndpointLiterals.test.ts: the CLI and stdio MCPsurfaces deliver the table entries without promoting them to observations, and a
launch seed of
REA_WEB_BUNDLE_ENDPOINT_LITERAL_CANDIDATES=1bounds theinventory.
Base reproduction: on
237b1ea5bthe same script yieldsinferences.filter(kind === "endpoint_candidate")=[]andobservations.endpoints=["/api/feedback"]. With this change the same callyields the three table entries plus
https://api.example.test, with theobservation set unchanged.
User-visible CLI/MCP output for the seeded case:
and the matching
unknownsentry:{ "dimension": "endpoint_literal_candidates", "reason": "…", "affected_script_keys": ["scr_…"], "limit": { "setting": "web.bundle_endpoint_literal_candidates", "effective_value": 1, "unit": "count" }, "remediation": "Raise web.bundle_endpoint_literal_candidates to retain more literal path/URL candidates in a later analysis." }Remaining proof gaps: the CLI boundary file cannot run on this host — it has
Node 22.22.2 and REA refuses to start below 22.23.4 — so CI was its first
execution. It caught a real defect: the public analyzer accepted the admission
and dropped it while forwarding to the per-script loop, so every CLI call fell
back to the default ceiling. That is fixed and now held by a local case that
fails without the forwarded argument. The full
domain+adaptersrun also has385 failures on this Windows host from missing
native/windows/buildartifacts,POSIX-path semantics, and the worker launcher's private-root authority; the
worker-launcher file reports the same 31 failures on unmodified
main, so thatcount is not attributable to this branch. The advertised-schema comparison itself
is POSIX-only; the two digests it records were recomputed locally by the method
described under validation, including the check against an untouched tool.
Validation performed
npx vitest run src/domain/webBundleEndpointLiterals.test.ts— 18 passed. Thebyte-fit case measures its budget from the untrimmed result and uses candidates
long enough for the literals to decide what fits; a second case pins the other
side, one short candidate whose omission record would be wider than the
candidate, and fails when the already-fits return is removed (checked by
reverting it).
npx vitest runover the literal, bundle-analyzer, worker-server, isolatedanalyzer and semantic-limit files — 133 passed on the current head (138 over
six files, including the setting test and the CDP admission test, on the head
before the review follow-ups). The bundle-analyzer file includes both
cross-analyzer parity expectations.
npx vitest run src/domain/browserObservation.test.ts src/domain/webBundleSemanticLimits.test.ts src/domain/webBundleAnalyzerAst.test.ts src/domain/analysisSettingAdmission.test.ts src/domain/numericLimitRegistry.test.ts— 32 passednpx vitest run src/browser/IsolatedWebBundleAnalyzer.test.ts src/browser/CdpBrowserProvider.admission.test.ts— passedmainat819d046e(a1346957):npx vitest runover theliteral, setting, analyzer, worker-server and CLI files — 44 passed, 3 failed.
The three are
tests/boundary/cli/webBundleEndpointLiterals.test.ts, which startsthe packaged server and is refused by this host's Node 22.22.2 guard; CI runs that
file on a supported release.
npm run lint(30 runtime settings),npx oxfmt --check .andnode scripts/verify-module-boundaries.mjsare clean.npx vitest run --project domain --project adapters— 24,087 passed, 385 failed (host limitations described above), 594 skippednode scripts/verify/rea-numeric-limits.mjs— exit 0: 30 runtime, 15 restart-only, 41 discoverednode scripts/verify-module-boundaries.mjs— exit 0, 4,482 filesnode scripts/verify-test-discovery.mjs— 3,770 test files, each discovered oncenpx vitest run src/domain/webBundleEndpointLiterals.test.ts src/config/webBundleEndpointLiteralCandidates.test.ts src/browser/CdpBrowserProvider.admission.test.ts— 33 passed (19 + 9 + 5). Both newregressions fail on the pre-fix code, checked by reverting each fix alone.
npx vitest run src/domain— 13,636 passed, 3 failed. The three(
regexLiteralCandidate.test.tstwice,desktop/appWithheld.test.tsonce) failidentically on the unmodified branch head.
provider and composition group — 153 passed, 39 failed. The same 39 fail on the
unmodified head: they start real worker processes, which this host's Node 22.22.2
guard refuses, and CI runs them on a supported release.
node scripts/verify/architecture-guards.mjsandnode scripts/verify-module-boundaries.mjs— exit 0 (3,052 and 4,722 files),npx oxfmt --checkon the six changed files — clean,npx oxlinton the changedsources — 0 errors.
npx oxfmt --check .— cleannpx oxlinton the changed files — 0 errors, 8 warnings. Seven pre-exist in thesame files; the eighth is
complexity21 onbuildCapturedWebBundleAnalysis, one||above the limit, which I left in placerather than reflow a pre-existing eleven-term condition.
npm run typecheck— exit 0. The 22 errors this checkout reported earlier camefrom a
node_modulesolder than the merged lockfile (missinggraphql, thePlaywright CDP type mismatch); after installing that lockfile they are gone.
scripts/verify-advertised-schemas.mjs— the summary comparison is skipped onWindows because absolute-path patterns are host-specific, and the packaged
listing needs
native/windows/build, which this checkout does not have. The twodigests were therefore recomputed from an in-process
tools/listwithREA_MCP_INPUT_SCHEMA_PROFILE=compact, using the samesha256(JSON.stringify(schema)).slice(0, 16)the summary records. The method waschecked against a tool this branch does not touch:
inspect_web_pagereproduced66a45fb27e9e1150/4bda7c3651bfc579, its committed pair, before the twosettings digests were taken.
Review follow-up
Two findings on the previous head, both in this branch's own code:
runtimeWebBundleEndpointLiteralAdmissionreturned a pair of lazy getters, so aninvalid
REA_WEB_BUNDLE_ENDPOINT_LITERAL_CANDIDATESonly threw when the workerread
maximumCount— after capture and after the worker had started.IsolatedWebBundleAnalyzerturned that into oneworker_failureper script, andthe call returned a partial result that read as success. The ceiling is now
resolved in
#analyzeBundle, next to the member-mutation allowance, so a rejectedvalue returns the
ConfigurationErrorbefore the target is opened (f060c3c63).Reverting only the early refusal turns that error into
BrowserObservationError.assemble([])keeps everynon-literal inference, so the first literal is not the first array element and it
needs a separator. The incremental pass charged a comma only for later literals, so
a literal whose own byte size exactly filled the remaining space survived the pass,
measured one byte over, and was popped by the exact pass; the smaller literals
behind it were never retried. The pass now counts the elements already retained
(
2f36377c4). Reverting it makes the new case return zero candidates where one ofthem fits on its own.
Compatibility, safety, and release
when nothing was omitted, so a caller that ignores it sees the same document shape
it saw before apart from the added inferences.
protocol case runs the real server module; the CLI case uses the repository's fake
CDP browser.
string, so
sanitizeEndpointCandidatestill runs, and the classifier rejectsbackslashes to keep
/\user:pass@hostout of the value. The inventory is boundedat both ends — a count setting and the existing result byte budget — so a page
with thousands of literals cannot inflate one worker result.
Author readiness
Human owner: @gongfpp
Before merge
type(scope): outcome.