Repository navigation
fix(engine): resolve renamed item locators on a still-failing page #474 - #494
Merged
Merged
Conversation
nc9
marked this pull request as ready for review
October 6, 2026 13:12
With the publish resolution signal, an unmatched prior item on a page that still failed the check was always carried, because the signal is page-level. A rule that renamed its item ids, or a fixed item next to an unfixed one, stayed open while the page failed for anything else. The sampled cloud merge now resolves such an item when this run's list for that page and check is provably complete: items with no recorded remainder, not rebuilt from or shadowed by a folded aggregate, no check array cut. So a capped list is never read as complete: - seven page rules that sliced items silently now record details.additional - hidden-text and dev-leakage report details.scanTruncated when a work budget stops the scan, and only an explicit false counts as complete - a bare list at a cap older releases did not record stays incomplete Signed-off-by: Nik Cubrilovic <[email protected]>
12 tasks done
16 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #474
Cause
addPriorinpackages/audit-engine/src/merge-core.tsonly resolves an unmatched prior item when the page drops out of the resolution signal'sfailingByCheckset. That set is page-level, so on a page that still fails the check for any item, every prior item with no fresh match was carried, with its last-seen refreshed each run. A rule that renamed its item ids (the #462dialogtodialog.newsletter-popupchange) or a fixed item next to an unfixed one stayed open indefinitely.Only the sampled publish path is affected (every
squirrelCLI publish takes it). The local CLI merge and the complete-store cloud finalize have no signal and already resolve unmatched priors on crawled pages.Fix
runCloudSmartAudits(sampled branch) works out which (page, rule, check) item lists are provably complete and passes them to the merge as the new optionalcompleteItemChecksinput.computeMerge's output shape is unchanged.itemListCompletevouches for it, the rule+check has no folded aggregate in this publish (an unfolded check holds only the fold's attribution, and a sibling aggregate with anotherfoldKeycan hold more of the page's items), and the rule's check array was not cut (checksTruncated).itemListCompleterejects a recorded remainder (details.additional, any value other than 0),details.scanTruncated, and an aggregate.Keeping capped lists out
a11y/identical-links-same-purpose,a11y/label-content-name-mismatch,a11y/link-in-text-block,a11y/tabindex(both checks),perf/animated-content(animated-gifs),perf/source-maps(source-maps-inline),schema/rating-scope(both checks). Each now recordsdetails.additional, the convention the fold, the publish sampler and the other rules already use. A source-scan test fails if a page rule's fail/warn check writesitems: x.slice(0, N)without it.LEGACY_SILENT_ITEM_CAPStreats a bare list sitting exactly at one of those caps as incomplete. Git history since the public source import shows no other page rule gaining a remainder, so these are the only silent caps an older CLI on this codebase sends.content/hidden-text(20,000-element walk, 400,000-char / 4,000-rule stylesheet index) andcontent/dev-leakage(element, attribute, hit and text caps) now always emitdetails.scanTruncated. For those two checks only an explicitfalsecounts as complete, so an older CLI that sends no marker never does.Proof
Real run: CLI from source against a local fixture (
python3 -m http.server),--http -f json --refresh, two audits. The publish body each audit would POST was rebuilt with the CLI's ownslimForPublish(resolution signal included) and both were fed throughrunCloudSmartAuditsover an in-memorySmartAuditStore.Rename (audit 1 with the pre-#462
aria-dialog-name, audit 2 with the current rule; the page keeps two unnamed dialogs):Kept true positive (12 positive-tabindex buttons; audit 2 moves b10 and b11 first, so b8 and b9 drop out of the ten-item list while still on the page):
Without the rule change and the legacy cap table, the second pair resolved (checked before adding the table), which is the trap this guards.
Tests
packages/audit-engine/tests/item-locator-resolve.test.ts(20):computeMergewith and without the signal (rename resolves, capped carries, other page's key ignored, matched locator untouched, not-evaluated page carries);itemListComplete(remainder, malformed remainder, aggregate, no items, scan marker, budgeted check needs explicitfalse, legacy cap, the real tabindex rule at 12 elements);runCloudSmartAuditsend to end (complete list resolves, remainder carries, folded aggregate carries, sibling aggregate with anotherfoldKeycarries,checksTruncatedcarries, two same-name checks with one capped carries). The two resolve tests fail with the new branch disabled, and the two aggregate tests fail with the aggregate guard disabled.packages/rules/tests/item-cap-remainder.test.ts(10): tabindex and label-content-name-mismatch remainders, hidden-text element and stylesheet budgets, dev-leakage hit cap, explicitfalseon a full scan, and the source guard (fails on the pre-fix tabindex).--timeout 60000.tsgo --noEmitclean inpackages/rulesandpackages/audit-engine.[email protected] check --strictpasses.Side effects
details.additionalcounts toward fail units (capped at 20 per check and page).label-content-name-mismatchandtabindex-very-highare fail checks, so a page with more than ten of those now scores the remainder too, as every other capped rule already does. Warn checks stay check-level, so the other five rules' scores do not move.scanTruncated.Changelog suggestion