Repository navigation
Closed
Description
Summary
Residual of #1420 (the extras budget for capped bundle scans). On a corpus run, the revision that sends a small script's remainder whole, after the head, gave back about 1.3 percent of the detections an earlier revision of the same fix made (about 70 of 35,000 sites: PostHog, React, Supabase, Sentry, Stripe and a few more; none are losses against the release before #1420).
Mechanism: the page byte budget (512 KB) is already full on those pages. Sending the remainder of a small early script whole uses room that the earlier revision spent on hint windows of later bundles, so when the loader literal sits in a later bundle's hint window, the attached copy loses it.
Acceptance Criteria
- Hint windows are allocated across all of a page's bundles first; what is left of the page and audit budgets then goes to whole remainders and tails.
- A synthetic fixture reproduces the mechanism: a page of about 34 scripts at the 512 KB page cap, where an earlier small script's whole remainder would eat the room and the loader literal (for example a
posthog.init(orStripe(call) sits in a later bundle's hint window. Both are found. The fixture fails on the current code. - No regression of the shapes the sampler tests already pin (late loaders after crowd windows, tracker-lost long strings, siblings exhausting the page budget, the 13 shapes that regressed between revisions): each still passes at the cloud caps (64 KB / 512 KB / 1 MB) and the local caps. (amended 2026-11-02: the "13 shapes" are not enumerated anywhere, so the pinned shapes are named by their tests: in
packages/audit-engine/tests/tech-extras-budget-1420.test.ts"a lateSentry.initafter hundreds of earlier hint windows", "React, PostHog and Stripe late in the same bundle", "a loader in a small script survives the string tracker, at both caps (fix(tech-detect): derive search literals for unhinted detectors and share the window budget #1420 #1433 corpus)", "the budget steps of a page (tech-detect: allocate hint windows across all of a page's bundles before whole remainders (#1420 residual) #1445)", "the window scan is bounded and shared fairly (tech-detect: allocate hint windows across all of a page's bundles before whole remainders (#1420 residual) #1445)"; the local caps intech-local-caps-1387.test.ts; the late-window reserve intech-window-reserve-1510.test.ts; each passes at the cloud caps and at the local caps) - Extras never exceed the budget, are deterministic, repeat no text, and the tail reserve still holds, checked by the existing budget fuzz.
- Cost stays linear; the 33-bundle comparison against whole-body truth shows 0 regressions and 0 new false detections.
-
docs/cloud/technologies.mdxdescribes the allocation order accurately; no customer or site names appear in tests or docs.
Activity
fix(tech-detect): choose every bundle's hint windows before any remai…
fix(tech-detect): choose every bundle's hint windows before any remai…
fix(tech-detect): choose every bundle's hint windows before any remai…
fix(tech-detect): choose every bundle's hint windows before any remai…
nc9 commentedon Oct 31, 2026
Verified against main after v0.0.152 (bundle hint windows are chosen across all bundles before any remainder or tail). Met and ticked: criteria 1 (allocation in rounds, tests pass) and 6 (docs match, no site names). Open: criterion 2 (the synthetic fixture uses 25 scripts, not about 34, and it is not shown to fail on the old code), criteria 3 and 4 (no fuzz test and no explicit determinism test found; the budget and tail-reserve tests pass) and criterion 5 (no 33-bundle comparison against whole-body truth recorded). Leaving this open for those.
nik
test(tech-detect): 34 scripts at the page cap with the loader in the …
test(tech-detect): 34 scripts at the page cap with the loader in the …
nc9 commentedon Nov 1, 2026
Checked against main after v0.0.154. Ticked: criterion 2 (the 34-script fixture exists), on top of 1 and 6 already ticked. Open: that the fixture fails on the old code is not proven in the repo, the 13 shapes are not enumerated, the fuzz has no assertion that no text is repeated, and the 33-bundle comparison is not recorded. Leaving this open for those.
nik
nc9 commentedon Nov 2, 2026
Amended criterion 3 (original text kept visible): the "13 shapes that regressed between revisions" are not listed anywhere in the repo or on this issue, so the criterion now names the shapes the sampler tests actually pin, by file and test name, and asks that each pass at the cloud and local caps. They all pass on v0.0.159. Criterion 5 (the recorded 33-bundle comparison) stays open as a corpus step, and the sampler sending part of a script twice on pages of 7 to 10 scripts (criterion 4's "repeat no text") is tracked in #1534.
nik
nc9 commentedon Nov 2, 2026
Ticked criterion 5. Corpus comparison of the 33-bundle set, v0.0.151 against v0.0.159 (masked, run by squirrelscan-53): 0 regressions, 0 new false detections, whole-body truth identical. Cost is linear: at 3.5, 7, 14.1 and 28.1 MB the time is 295, 581, 1,196 and 2,297 ms on v0.0.151 and 312, 605, 1,057 and 1,054 ms on v0.0.159. Criterion 4 stays open for #1534 (repeated text); criterion 3 is amended as noted in the body.
nik
nc9 commentedon Nov 4, 2026
Acceptance check against main 7c31d5b. The allocation shipped in v0.0.152 (d8bc9c4) and the deterministic-allocation test in v0.0.154 (10663f7); everything below is in v0.0.161.
tech-extras-budget-1420.test.ts(30 pass),tech-local-caps-1387.test.ts(12 pass),tech-window-reserve-1510.test.ts(12 pass). But the criterion says each passes at the cloud caps and at the local caps, and the named cases intech-extras-budget-1420.test.tsrun atDEFAULT_TECH_BUNDLE_LIMITSonly (the #1433 cases add a 24 KB bundle cap, the seeded fuzz three smaller or larger caps); none runs atDEFAULT_LOCAL_TECH_BUNDLE_LIMITS.tech-local-caps-1387.test.tscovers local reads separately but not these shapes.Left open for criterion 3. To close the gap, either run the named cases (or a local-cap variant of each) at
DEFAULT_LOCAL_TECH_BUNDLE_LIMITS, or amend the criterion to say the local scan reads bundles whole and point attech-local-caps-1387.test.ts.nik
nc9 commentedon Nov 4, 2026
Re-check of criterion 3 against main 8d22fa2. Criteria 1, 2, 4, 5 and 6 stay ticked; the sampler sources and the named test files have not changed since the previous check.
I ran
tech-extras-budget-1420.test.tsas an uncommitted copy with the limits swapped toDEFAULT_LOCAL_TECH_BUNDLE_LIMITS(8 MB bundle, 32 MB page, 64 MB audit) and the local detect options: 29 of 30 cases pass, including the lateSentry.init, React, PostHog and Stripe late in one bundle, the string-tracker loader, the window-scan bound and the seeded fuzz. The one failure is "the page budget is spent, not wasted: whole remainders fill what the windows left", which asserts that 24 scripts of 40 KB fill to within 8 KB of the page cap. That holds for a 512 KB cap and cannot hold for a 32 MB one (960 KB of input), so it is cap-specific by construction, not a regression.So the behaviour holds at both cap sets, but the repository only pins it at the cloud caps: no committed test runs these shapes at the local caps, and the one cap-specific case has no local equivalent. Criterion 3 stays unticked. To close, either commit a local-cap variant of the shape cases (leaving the page-fill case cloud-only), or amend the criterion to say the local scan reads bundles whole and point at
tech-local-caps-1387.test.ts.nik
nc9 commentedon Nov 9, 2026
Verified on main at 486cd13: the pinned shapes are tests in packages/audit-engine/tests/tech-extras-budget-1420.test.ts (Sentry.init near the end of a big bundle with hundreds of earlier hint windows, React/PostHog/Stripe late in one bundle, the 25- and 34-script page-cap fixtures, the seeded budget and determinism tests), tech-local-caps-1387.test.ts and tech-window-reserve-1510.test.ts. Those three files pass in full (54 tests, 0 fail). The last box is ticked and every other box was already checked.
nik