Repository navigation
feat(engine): score a capped report from its check tallies (repo#2657) - #642
Conversation
|
Review of #642 (read from the diff only; I didn't run the tests). Summary: this moves the sampled-path score for capped reports onto
No critical or high issues found. |
f408f00 to
a1af809
Compare
|
Reviewed the diff for
I found nothing that should block the merge. The stacked-PR design is clear, and the new tests cover the main scenarios (capped against uncapped parity, carried passes, skipped checks). |
|
Triage of both claude-review rounds on a1af809. Fixes are committed locally (ba9e8d7). They ride the rebase onto main after #640 lands, in a single push. Second round (02:15)
First round (02:11)
|
The capped report (repo#2656) lists 10 pages per issue class and no pass rows, so the server's sampled-path rescore can no longer count rows: it would score 10 pages of every class and no passes. runCloudSmartAudits takes the report's checkTallies. With them and the resolution signal, the score comes from this run's tallies plus the carried side the merge leaves open: carried findings on pages this run did not evaluate for that check, and clean-carried synthetic passes for pages the tallies do not already count. Returned as scoringTallies, with reportTotals for the report's passed/warnings/failed (carried-clean passes stay out of report.passed, as on the sampled path today). The union body keeps the capper's classes instead of unfolding them. The merge itself is unchanged. buildCheckTallies leaves out what the rescore leaves out: page replays (the merge's isReplayedCheck, now shared in published-checks.ts) and checks on pages that returned 404/410. The "fixed on all pages checked this run" note reads a capped report's tallies when its rows hold no passes, and drops the clean-page count it cannot get from them. Signed-off-by: Nik Cubrilovic <[email protected]>
… not count (repo#2657) A finding the merge carries on a page this run evaluated for its check (the sample clipped the page, or the signal key was truncated) is already in the tallies and in its class's true count. It stays open in the store, but the union no longer shows it as carried or counts it in coverage.carriedFindings, so the coverage line matches the uncapped report's. Signed-off-by: Nik Cubrilovic <[email protected]>
…; read the query-blind hash as the union does (repo#2657) A page this run crawled is in the tallies for every check that evaluated it and earns nothing for the others, so a capped report's union never credits it a clean-carried pass, even when it carries a finding (the sample can drop a page whose checks all skipped, which the uncapped path still counted as crawled). And a page's query-blind hash only marks it not evaluated when no crawled page owns that spelling, so /p skipped no longer re-scores a carry on /p?id=1 that the tallies already count. Signed-off-by: Nik Cubrilovic <[email protected]>
…shows (repo#2657) carriedLastSeen kept entries for carries the union leaves out (pages the tallies count), and the API's tagging pass then labelled the fresh check on that page carried. Signed-off-by: Nik Cubrilovic <[email protected]>
…h its tallies (repo#2657) The capper removes checks on pages that returned 404/410 this run before it counts the tallies and folds the classes, so the two agree and a capped report shows what the server's rescore scores. An aggregate from an earlier fold is reopened only when its pages name a removed page; its total drops by the removed pages its sample named and stays a floor for any it had clipped. A class whose every page is gone leaves the report. buildCheckTallies goes back to one argument; a missing tally entry is documented as 0 scored where the rescore reads it. Signed-off-by: Nik Cubrilovic <[email protected]>
…s statuses first, truncated-key and passes-only tests (repo#2657) removedPageUrls reads the producer's pageStatuses when it sent them, else its pages, the same precedence the published statuses are built with, so the capper and the server cannot disagree on a page. New tests: a truncated signal key (a clipped page still failing is counted once, by the tallies), rules of passes only (no rows published, still scored), and the pageStatuses precedence. Comments on why freshTally is not bounded by pages, why every tallied rule has a union key, and on carriedLastSeen and unfolded members' pageUrl. Signed-off-by: Nik Cubrilovic <[email protected]>
a1af809 to
df2caa7
Compare
|
Review of #642 (read the diff and PR description; I did not run the tests, and I read the The approach holds up.
Nothing here should block the merge. |
…repo#2657) site-pages-contract-coverage.test.ts requires every upsertSitePages implementation in the repo to run describeSitePagesContract; the test double added for repo#2657 did not. Signed-off-by: Nik Cubrilovic <[email protected]>
|
Review of the engine half of the capped-report rescore. I read the (medium) (medium) (low) (low) (low) (nit) In (nit) No critical issues found. The merge itself is unchanged, and the parity test (capped vs uncapped body giving the same score) is a good proof of intent. Nothing blocks merging. |
…e shown carries as a new map (repo#2657) notEvaluatedThisRun and withoutUnscorablePages now share signalHashes (own hash plus the #2063 query-blind spelling when no crawled page owns it), so the two cannot drift. The capped path returns its filtered carriedLastSeen as a new map instead of deleting from the one it built. freshTally's comment says why the tallies are not bounded: a publisher could always reach any score by leaving its fail rows out. New test: a tally for a rule the report does not carry is not scored. Signed-off-by: Nik Cubrilovic <[email protected]>
|
Triage of the 06:24 review (on df2caa7). The fixes are in 03b4888, which also carries the site-pages contract fix (134dae6).
Local: tsgo clean. capped-rescore, site-pages-contract-coverage, cloud-merge, sampled-audited-pages, publish-cap, carried-provenance-merge, item-locator-resolve, complete-store-parity, scan-truncated-carry and bounded-carried-merge pass, 214/214. |
|
Review of the rescore from The change hangs together. The carried and fresh sides are kept disjoint by
Security: I saw no new concerns. The tallies are untrusted input and are clamped by |
|
Review triage (integrator, head 03b4888):
|
Stacked on #640 (
feat/report-capper-2656). Review that first; this PR's base is its branch, so the diff here is only the rescore. Part of squirrelscan/repo#2655, closes the engine half of squirrelscan/repo#2657. The private half (API wiring + the real-shape fixture parity test) is a separate draft PR in squirrelscan/repo, stacked on squirrelscan/repo#2662.Why
A capped report lists 10 pages per issue class and drops every per-page pass row. The server's sampled-path rescore (every CLI publish,
SMART_AUDITS_CLOUD_ENABLED) counts rows, so on a capped body it would score 10 pages of each class and no passes at all. The capper already shipscheckTallies(this run's counts per rule and check name, counted before sampling); this PR makes the rescore read them.What changes
runCloudSmartAuditstakescheckTallies. With them and the resolution signal, on the sampled path:carriedLastSeen), andcoverage.carriedFindingscounts what is shown: the merge carries those when the sample clipped the page or the signal key was truncated;scoringTallies(scored withcalculateHealthScoreFromTallies, as the complete-store path already is) plusreportTotals, which keeps carried-clean passes out ofreport.passedlike the sampled path does today.buildCheckTallies(the merge'sisReplayedCheck, moved topublished-checks.tsso both read one definition), and checks on pages that returned 404/410, dropped up front (withoutRemovedPages) so the tallies and the classes agree and a capped report shows what the server scores. An aggregate from an earlier fold is reopened only when its pages name a removed page (its total drops by those and stays a floor for any it had clipped); a class whose every page is gone leaves the report. Agreed with the feat(engine): one report capper and a 1 MiB published-report constant (repo#2656) #640 lane, which handed this change over; three of feat(engine): one report capper and a 1 MiB published-report constant (repo#2656) #640's test expectations change accordingly (60→58 pages, 120→116 occurrences, the pre-folded case now on an all-200 input plus a new pre-folded-with-404 test).ruleMixedProvenanceNote/groupIssuesByCategorytake the report's tallies: on a capped report (no pass rows) the "Fixed on all N pages checked this run" note now fires as "Fixed on all pages checked this run; M pages pending re-check." instead of silently disappearing. A per-check-name tally cannot give the clean-page count, so it is left out rather than guessed.Codex reviewed the diff twice; its findings on synthetic passes for crawled pages, the query-blind hash and carried tagging are fixed with tests, the rest are listed below.
Proof
packages/audit-engine/tests/capped-rescore.test.tspublishes the same audit uncapped (today's body) and capped against identically seeded stores and asserts identical health score, category and group scores, passed/warnings/failed and coverage:details.additional, skipped, info, an advisory rule, a missing robots.txt penalty);/p?id=1because/pwas not evaluated adds nothing to the score.A missing (rule, check name) in
checkTalliesreads as 0 scored (the capper leaves out info-only classes), documented where the rescore reads it.Mutations checked: scoring every carried finding, the old synthetic-pass rule, the query-blind read, and tallies that count 404 pages each fail the suite. The real-shape fixture parity (first audit, merge off, zero findings, partial re-audit) and the 10,000-page tally size pin are in the private PR, squirrelscan/repo#2663.
Known deviations from the uncapped rescore (documented in code)
additional: 40): the uncapped union scores each such carried item as one more failed check on top of the fresh one; the tallies count the page once. Capped can read higher by those items.Docs / skills
No user-facing behaviour or docs change: scores and counts are unchanged by design; the note wording change only applies to capped reports, which no producer publishes until the wiring lands. No skill change needed.