Repository navigation
feat(autofix): font-display-swap — measurement-picked repair - #200
Merged
Merged
Conversation
…could not move The born-passing A/B (evaluation-260819-2016) showed font-display-missing as the one floor knowledge-teaching did not shift (6→6 across arms): a generator picks fonts before it thinks about loading behaviour, so this floor belongs to the machine. fixFontDisplaySwap inserts font-display: swap as the first declaration of @font-face blocks lacking the descriptor and appends display=swap to Google-Fonts hrefs (? vs & handled); both edits locate on the non-markup mask so quoted samples in pre/code are never rewritten, and the repair is gated by the same checkFontDisplayMissing that reports the finding. On the A/B corpus: 12→0 findings in one pass. Registered in RULES, the check catalog (with its repair subject), and the autofix help; red-first tests including author-choice respect, ?/& href forms, pre/code exclusion, and idempotency.
…, index-anchored The checker and repair now read ONE world (blankDeadMarkup in taste-checks-shared: scripts + comments dead, pre/code elements live — the HTML parser instantiates them, so the checker was right and the repair's mask was wrong): only rel~=stylesheet links flag or get rewritten (a preconnect hint to the fonts origin is correct markup — Google's own canonical snippet was being rewritten, and the same false positive existed in the checker as a warning all along); @font-face repairs scan real CSS regions only (style blocks + style attributes), so prose quoting CSS in a paragraph is never edited; href edits locate by /d capture indices, killing the indexOf class where a duplicate URL in another attribute received the edit forever (unbounded growth + permanent autofix-not-clean); &display= counts as compliant on both sides; overlapping edits are skipped defensively (a miss beats corruption). Red-first fixtures for every blocker shape, each asserting CHECKER AND FIXER agree; the phantom entity-encoded pre test replaced. Adversarial E2E: triple --write converges after one pass, preconnect and prose intact, the A/B corpus still goes 12→0.
Owner
Author
|
Stage-4 review resolved (fix round in
Re-verified: A/B corpus still 12→0 in one pass; adversarial file (preconnect + dup-URL + brace-in-font-url + prose snippet) converges with correct output. Gates: typecheck, lint, build, 3625 passed / 203 files. On the unresolved pre/code question: ruled as the checker's semantics — elements in |
jangtrinh
added a commit
that referenced
this pull request
Oct 29, 2026
* feat(autofix): font-display-swap — the repair for the floor teaching could not move The born-passing A/B (evaluation-260819-2016) showed font-display-missing as the one floor knowledge-teaching did not shift (6→6 across arms): a generator picks fonts before it thinks about loading behaviour, so this floor belongs to the machine. fixFontDisplaySwap inserts font-display: swap as the first declaration of @font-face blocks lacking the descriptor and appends display=swap to Google-Fonts hrefs (? vs & handled); both edits locate on the non-markup mask so quoted samples in pre/code are never rewritten, and the repair is gated by the same checkFontDisplayMissing that reports the finding. On the A/B corpus: 12→0 findings in one pass. Registered in RULES, the check catalog (with its repair subject), and the autofix help; red-first tests including author-choice respect, ?/& href forms, pre/code exclusion, and idempotency. * fix(autofix): font-display round — one mask contract, stylesheet-only, index-anchored The checker and repair now read ONE world (blankDeadMarkup in taste-checks-shared: scripts + comments dead, pre/code elements live — the HTML parser instantiates them, so the checker was right and the repair's mask was wrong): only rel~=stylesheet links flag or get rewritten (a preconnect hint to the fonts origin is correct markup — Google's own canonical snippet was being rewritten, and the same false positive existed in the checker as a warning all along); @font-face repairs scan real CSS regions only (style blocks + style attributes), so prose quoting CSS in a paragraph is never edited; href edits locate by /d capture indices, killing the indexOf class where a duplicate URL in another attribute received the edit forever (unbounded growth + permanent autofix-not-clean); &display= counts as compliant on both sides; overlapping edits are skipped defensively (a miss beats corruption). Red-first fixtures for every blocker shape, each asserting CHECKER AND FIXER agree; the phantom entity-encoded pre test replaced. Adversarial E2E: triple --write converges after one pass, preconnect and prose intact, the A/B corpus still goes 12→0.
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.
The born-passing A/B (plans/reports/evaluation-260819-2016) identified
font-display-missingas the ONE floor that teaching could not move (6→6 across both knowledge arms — generators pick fonts before thinking about loading behaviour). Per the triage doctrine: a floor teaching can't move and a machine can fix belongs to autofix.@font-facewithout the descriptor →font-display: swap;inserted as first declaration (existing author choices respected via the shared checker gate — checker and repair sharecheckFontDisplayMissing).<link>hrefs withoutdisplay=→&display=swap/?display=swapappended.<pre>/<code>/scripts never rewritten.Measured on the A/B corpus: 12→0 findings in one pass. Red-first tests (author-choice respect, ?/& forms, pre/code exclusion, idempotency, runAutofix registration); catalog row with repair subject (the catalog pairing test derives autofix ids from RULES, so the row was mandatory, not optional). Gates: typecheck, lint, build, 3620 passed / 203 files.
🤖 Generated with Claude Code