Skip to content

feat(web): retain literal endpoint candidates from bundle tables - #11822

Open
gongfpp wants to merge 18 commits into
morluto:mainfrom
gongfpp:agent/web-bundle-endpoint-literals
Open

gongfpp wants to merge 18 commits into
morluto:mainfrom
gongfpp:agent/web-bundle-endpoint-literals

Conversation

@gongfpp

@gongfpp gongfpp commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

analyze_web_bundle loses request paths that a bundler folded into a literal
table or a base-URL constant. This records such a literal as a low-confidence
endpoint_candidate and 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 on
237b1ea5b and drops the parts that changed unrelated analyzer behaviour.

Problem and expected behavior

Bundled applications commonly keep every request path in one table:

const routes = ["/api/daily/stats", "/api/progress/complete"];
const BASE = "https://api.example.test";
function complete(id) { return apiPostWithRetry("/api/daily/complete", id); }

The request scanners only classify calls they can prove are transport calls.
fetch("/api/feedback") becomes an endpoint observation, but the two table
entries 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_candidate inferences with
confidence: "low", a literal:path-shaped or literal:url-shaped detector and
their source position, never as endpoint observations, and the number retained
is visible and adjustable rather than silently unbounded.

Change and scope

  • src/domain/webBundleEndpointLiterals.ts — the classifier. A literal is a
    candidate only when it has no whitespace or control character, no backslash
    (which can encode /\user:pass@host credentials in a browser), is a path rooted
    at / (/x, not //, /?, /) or an http/https/ws/wss URL that
    URL.parse accepts.
  • src/domain/webBundleAnalyzerInspection.ts — record it at an array element, or
    at a const declarator initialized with a URL. Both are literal tables; the node
    is 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 setting
    web.bundle_endpoint_literal_candidates
    (REA_WEB_BUNDLE_ENDPOINT_LITERAL_CANDIDATES, default 1024, minimum 1, maximum
    4096, update_mode: "runtime"), the per-script admission, the record schema and
    its message. A rejected launch seed is returned as a ConfigurationError before
    capture, the same way the member-mutation allowance already resolves.
  • src/domain/webBundleEndpointLiteralResultBudget.ts plus the worker request
    field — 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 the
    new inference kind, its confidence, and the setting that bounds it. The planning
    record for this change stays in this PR discussion: AGENTS.md keeps specs,
    implementation plans and task lists in issue or PR discussions or in local drafts
    outside Git.
  • The bundle result carries endpoint_literal_candidates and an unknowns entry
    with dimension: "endpoint_literal_candidates" when literals were omitted. The
    record 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.
  • The three constants live in src/domain/analysisResourceLimits.ts so
    analysisSettingDefinitions.ts can 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:

  • Call arguments of an unclassified callee are not promoted. A literal passed
    to getConfiguration("/api") or fs.open("/tmp/data.txt") stays with the
    request scanners. Widening this scanner to call arguments made
    web bundle configuration and navigation parity and web bundle static-analysis parity report paths the other analyzer does not, and the repository's parity
    contract owns that decision, not a recall improvement.
  • No route, RPC, XHR or WebMCP scanner is touched; no existing inference kind,
    detector or observation changes.

Base alignment

main moved 1,717 commits while this PR awaited review, so the branch now merges
819d046e into a1346957 instead of sitting on 237b1ea5b. Eight files
conflicted, in four groups, all because main reworked the same area:

  • docs/reference/rea-limit-inventory.md replaced docs/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.
  • The analysis-settings catalog digests: main added zstd.max_frames, this branch
    added web.bundle_endpoint_literal_candidates, and both change the
    inspect_analysis_settings and update_analysis_settings input schemas. The two
    digests were recomputed over the merged setting list, as described under
    validation.
  • src/browser/IsolatedWebBundleAnalyzer.test.ts: main widened the refusal test
    this branch had attached a case next to. main's test is kept as merged and the
    literal-forwarding case is re-attached after it.
  • Four import blocks that both sides extended; both sides' imports stay.

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

  • Semantic owner and earliest changed stage: the per-script JavaScript static
    analyzer (webBundleAnalyzerInspection.ts) produces the new inferences; the
    bundle merger aggregates the record; the isolated worker owns the byte fit. No
    superseded path is removed and no policy responsibility moves.
  • Contribution scope fit and linked maintainer decision: ordinary additive analysis
    within existing boundaries — no new provider, no target execution, no injection
    or mutation — so no maintainer scope decision is required. The #9836 scope was
    not this code, so this replaces that diff rather than restating it.
  • CLI and MCP/tool-catalog contract: additive. analyze_web_bundle /
    rea analyze-web-bundle gain endpoint_literal_candidates in the result, one
    unknowns dimension, one limitations sentence and one
    update_analysis_settings entry. No tool, option or command is added.
  • Provider, bridge, target-format, or platform compatibility: browser provider
    only; the worker request field is optional, so a version mismatch degrades to the
    default ceiling instead of failing a job.
  • Evidence, artifact, provenance, or reconstruction contract: every candidate keeps
    the script key, artifact digest, detector, line and column. Candidates are
    inferences, not observations, and never claim reachability.
  • Target selection, authority, upstream behavior, and cleanup details: none.
    Analysis reads the captured script text and starts no target work.
  • Generated metadata: no authored catalog changes. Two committed tool summaries
    move, because the new setting is part of the inspect_analysis_settings and
    update_analysis_settings input 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_CANDIDATES
    in the runtime-settings table.

Expected effects:

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

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 arbitrary
      literals and computed strings, the ancestor-snapshot budget, the byte fit, the
      maximal ceiling, Map keys and call arguments, const versus let/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 seed
      parsing, the registered range, and runtime overrides winning over the seed.
    • src/browser/IsolatedWebBundleAnalyzer.test.ts: a new case holds the wrapper
      to 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 sends
      endpoint_literal_candidates and reads the written result file, so the protocol
      field, the default admission and the byte fit run together.
    • tests/boundary/cli/webBundleEndpointLiterals.test.ts: the CLI and stdio MCP
      surfaces deliver the table entries without promoting them to observations, and a
      launch seed of REA_WEB_BUNDLE_ENDPOINT_LITERAL_CANDIDATES=1 bounds the
      inventory.
  • Base reproduction: on 237b1ea5b the same script yields
    inferences.filter(kind === "endpoint_candidate") = [] and
    observations.endpoints = ["/api/feedback"]. With this change the same call
    yields the three table entries plus https://api.example.test, with the
    observation set unchanged.

  • User-visible CLI/MCP output for the seeded case:

    "endpoint_literal_candidates": {
      "coverage": "partial",
      "code": "web_bundle_endpoint_literal_candidates",
      "admitted_count": 1,
      "omitted_by_count": 2,
      "omitted_by_count_exact": false,
      "omitted_by_result_budget": 0,
      "omitted_count": 2,
      "ceiling": "adjustable",
      "limit": { "setting": "web.bundle_endpoint_literal_candidates", "effective_value": 1, "unit": "count", "source": "setting", "minimum": 1, "maximum": 4096, "update_mode": "runtime", "pending_restart": false }
    }

    and the matching unknowns entry:

    { "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+adapters run also has
    385 failures on this Windows host from missing native/windows/build artifacts,
    POSIX-path semantics, and the worker launcher's private-root authority; the
    worker-launcher file reports the same 31 failures on unmodified main, so that
    count 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. The
    byte-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 run over the literal, bundle-analyzer, worker-server, isolated
    analyzer 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 passed
  • npx vitest run src/browser/IsolatedWebBundleAnalyzer.test.ts src/browser/CdpBrowserProvider.admission.test.ts — passed
  • After merging main at 819d046e (a1346957): npx vitest run over the
    literal, setting, analyzer, worker-server and CLI files — 44 passed, 3 failed.
    The three are tests/boundary/cli/webBundleEndpointLiterals.test.ts, which starts
    the 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 . and node scripts/verify-module-boundaries.mjs are clean.
  • npx vitest run --project domain --project adapters — 24,087 passed, 385 failed (host limitations described above), 594 skipped
  • node scripts/verify/rea-numeric-limits.mjs — exit 0: 30 runtime, 15 restart-only, 41 discovered
  • node scripts/verify-module-boundaries.mjs — exit 0, 4,482 files
  • node scripts/verify-test-discovery.mjs — 3,770 test files, each discovered once
  • Review follow-up: npx vitest run src/domain/webBundleEndpointLiterals.test.ts src/config/webBundleEndpointLiteralCandidates.test.ts src/browser/CdpBrowserProvider.admission.test.ts — 33 passed (19 + 9 + 5). Both new
    regressions fail on the pre-fix code, checked by reverting each fix alone.
  • Review follow-up: npx vitest run src/domain — 13,636 passed, 3 failed. The three
    (regexLiteralCandidate.test.ts twice, desktop/appWithheld.test.ts once) fail
    identically on the unmodified branch head.
  • Review follow-up: the domain-webBundle, config-webBundle, browser-WebBundle,
    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.
  • Review follow-up: node scripts/verify/architecture-guards.mjs and
    node scripts/verify-module-boundaries.mjs — exit 0 (3,052 and 4,722 files),
    npx oxfmt --check on the six changed files — clean, npx oxlint on the changed
    sources — 0 errors.
  • npx oxfmt --check . — clean
  • npx oxlint on the changed files — 0 errors, 8 warnings. Seven pre-exist in the
    same files; the eighth is complexity 21 on
    buildCapturedWebBundleAnalysis, one || above the limit, which I left in place
    rather than reflow a pre-existing eleven-term condition.
  • npm run typecheck — exit 0. The 22 errors this checkout reported earlier came
    from a node_modules older than the merged lockfile (missing graphql, the
    Playwright CDP type mismatch); after installing that lockfile they are gone.
  • scripts/verify-advertised-schemas.mjs — the summary comparison is skipped on
    Windows because absolute-path patterns are host-specific, and the packaged
    listing needs native/windows/build, which this checkout does not have. The two
    digests were therefore recomputed from an in-process tools/list with
    REA_MCP_INPUT_SCHEMA_PROFILE=compact, using the same
    sha256(JSON.stringify(schema)).slice(0, 16) the summary records. The method was
    checked against a tool this branch does not touch: inspect_web_page reproduced
    66a45fb27e9e1150 / 4bda7c3651bfc579, its committed pair, before the two
    settings digests were taken.

Review follow-up

Two findings on the previous head, both in this branch's own code:

  • A rejected launch seed looked like success.
    runtimeWebBundleEndpointLiteralAdmission returned a pair of lazy getters, so an
    invalid REA_WEB_BUNDLE_ENDPOINT_LITERAL_CANDIDATES only threw when the worker
    read maximumCount — after capture and after the worker had started.
    IsolatedWebBundleAnalyzer turned that into one worker_failure per script, and
    the call returned a partial result that read as success. The ceiling is now
    resolved in #analyzeBundle, next to the member-mutation allowance, so a rejected
    value returns the ConfigurationError before the target is opened (f060c3c63).
    Reverting only the early refusal turns that error into BrowserObservationError.
  • The first retained literal was charged no comma. assemble([]) keeps every
    non-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 of
    them fits on its own.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. The result field is optional and absent
    when nothing was omitted, so a caller that ignores it sees the same document shape
    it saw before apart from the added inferences.
  • Real Hopper/Ghidra, browser, or OS coverage: no live browser was used. The worker
    protocol case runs the real server module; the CLI case uses the repository's fake
    CDP browser.
  • Package or release metadata impact: none; no dependency is added.
  • Security, privacy, process, or containment review: a candidate can carry a query
    string, so sanitizeEndpointCandidate still runs, and the classifier rejects
    backslashes to keep /\user:pass@host out of the value. The inventory is bounded
    at 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

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

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.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-17T11:53:03.560505Z
We couldn’t complete this review. Comment @codex review to try again.
e4d2512 PR opened
ℹ️ 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.

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

@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The reviewed follow-up appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The reviewed follow-up appears safe to merge.

Summary

The PR retains literal paths and URLs as low-confidence endpoint candidates, with a runtime count setting and the existing worker byte limit.

  • Bundle analysis finds path lists and URL constants as endpoint candidates.
  • A count setting and worker byte budget bound the candidate inventory.

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]
Loading

Reviews (13) · Last reviewed commit: "fix(web): charge the omission record's g..." · Reviewed by Greptile

Comment thread src/domain/webBundleAnalyzerResult.ts Resolved
Comment thread docs/guides/web/browser-observation.md Resolved
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.
@gongfpp
gongfpp force-pushed the agent/web-bundle-endpoint-literals branch from 3dee82f to a134695 Compare November 23, 2026 00:59
…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.
@morluto morluto added the area: runtime Process capture and runtime observation label Nov 26, 2026
…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.
@gongfpp

gongfpp commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

CI note on b0d2200a2: Windows capability and package lane (capabilities) failed in tests/acceptance/webSourceLocationCli.test.ts with shared CLI process 4408 did not exit after SIGKILL. This is the first run that actually executed that lane for this PR — the two earlier runs had it skipped / cancelled.

That test drives trace-web-source-location and shares no code with this change (src/domain/webBundleEndpointLiteral*, src/browser/*WebBundle*, docs/). On the same commit Build package, Static checks, Documentation, Test shard (1/3) through (3/3) and the three Native package baseline lanes all pass, so this reads as process-teardown flake on the Windows runner rather than a regression. A rerun of that lane should clear it — I don't have permission to rerun it myself.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants