Skip to content

fix(audit-engine): unbounded class evidence keeps a 25-page report's publish-cap sample small (#2430) - #2432

Merged
nc9 merged 3 commits into
mainfrom
fix/2430-publish-cap-sample
Nov 28, 2026
Merged

nc9 merged 3 commits into
mainfrom
fix/2430-publish-cap-sample

Conversation

@longshore-nc9

@longshore-nc9 longshore-nc9 Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2430

Cause

Built a 25-page fixture through the engine (synthetic site, full rule set, runV1Pipeline), then a page map from readPublishedPageMap and an entity map, and measured each input of the full sample in publish-cap.ts. The fixture has 150 generic-text ("read more") links on every page, the shape that makes a11y/link-text record one element per link.

Input Bytes
Full sample (every class at tier 0, entity map, page map) 4,740,702
componentOccurrences on the a11y/link-text classes 4,497,013 (95%)
All other per-class fields together (pages, details, message, items, ...) ~230,000
pageMap (28 rows) 13,915
entityMap (25 pages of JSON-LD, projected) 6,425
Report sections (summary, sitemaps, robots, ...) under 6,000

The oversized input is a per-class sample field, not the entity map or the page map: componentOccurrences (and siteResourceOccurrences). The fold concatenates them whole, by design, and sampleCheck copied them onto every level, counts rows included. The fitter then could not admit those classes' counts rows, so classes were dropped, and the entity map and page map went with them. Before the change the fixture published at tier 3 with fullSampleBytes 4,742,590.

Change

The bound is a fallback for a report that does not fit. capReportForPublish first assembles the full sample with every class's evidence whole; if that fits the budget it publishes as before, byte for byte. Only when it overruns does sampleCheck bound each class's element or resource evidence to one stored finding's payload (REPORT_LIMITS.maxFindingPayload, 16 KiB), always dropped from a counts row, and the full sample is priced again. Whatever is left out is replaced by the omitted / payload-limit marker (componentEvidence, siteResourceEvidence), adding to a marker the class already carried, the ladder stream-findings.ts applies to a stored finding.

Review fix (run_mx0h9qpdhgdy5tcj): the first version applied the bound at tier 0 even when the whole report fit, so a 25-page fixture with 3 generic links per page (75 occurrences, 338 KB) lost its fix evidence. I diffed the published body of that fixture against origin/main: identical apart from the three generatedAt/timestamp fields. fullSampleBytes now records the bounded full sample when the report still does not fit.

Also: the text renderer now prints a siteResourceEvidence omission next to the component one (Resource evidence unavailable for N occurrence(s): ...).

Acceptance criteria

  • Oversized input identified and stated: componentOccurrences, 4.50 MB of the 4.74 MB full sample (table above). Entity map and page map are small.
  • Comparable 25-page fixture fits tier 0, nothing dropped: detail.tier === 0, no classesReduced, classesDropped, entityMapDropped, pageMapDropped or fullSampleBytes; entity map and page map present (publish-cap-evidence-2430.test.ts).
  • Regression test with a stated byte budget: the published body of the 150-links fixture must stay under 400 KiB at tier 0; about 240 KB with the fix, 4.74 MB unbounded. Disabling the over-budget gate (bound always on) fails the small-report tests.
  • A report that fits keeps its evidence: the 3-links fixture publishes at tier 0 with all 75 occurrences, no marker, and byte-identical to the unbounded full sample (publish-cap-evidence-2430.test.ts).

Checks

bun test ./packages/audit-engine/tests --timeout 30000   (sequential)
 2493 pass, 3 skip, 0 fail
bun test ./packages/report/tests/component-fix-groups.test.ts  -> 9 pass
packages/audit-engine and packages/report: format:check / lint / typecheck -> clean
oxfmt --check on the two changed report files -> clean

Docs: none. Skill: none. Not touched: the entity-map page-index budget (filed separately).

…-cap sample stays small #2430

Closes #2430

Signed-off-by: longshore-nc9[bot] <360568931+longshore-nc9[bot]@users.noreply.github.com>
…rruns the budget #2430

Signed-off-by: longshore-nc9[bot] <360568931+longshore-nc9[bot]@users.noreply.github.com>
Signed-off-by: longshore-nc9[bot] <360568931+longshore-nc9[bot]@users.noreply.github.com>
@longshore-nc9
longshore-nc9 Bot force-pushed the fix/2430-publish-cap-sample branch from e2b1c6c to 92bf37f Compare November 28, 2026 15:31
@nc9
nc9 merged commit 68b225b into main Nov 28, 2026
14 checks passed
@nc9
nc9 deleted the fix/2430-publish-cap-sample branch November 28, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

audit-engine: publish-cap full sample reaches ~45 MB on a 25-page report and forces tier 3

1 participant