Repository navigation
fix(rules): meta-title whitespace, charset placement advice, tel (0) trunk prefix (#658, #659, #663) - #676
Merged
Conversation
…e collapsed #658 Signed-off-by: Nik Cubrilovic <[email protected]>
… header-vs-page conflicts #659 Signed-off-by: Nik Cubrilovic <[email protected]>
…l-mailto #663 Signed-off-by: Nik Cubrilovic <[email protected]>
Signed-off-by: Nik Cubrilovic <[email protected]>
Signed-off-by: Nik Cubrilovic <[email protected]>
…lto #663 Signed-off-by: Nik Cubrilovic <[email protected]>
#659 Signed-off-by: Nik Cubrilovic <[email protected]>
…ice on #669 #659 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
marked this pull request as ready for review
October 11, 2026 21:07
|
Reviewed the diff for the charset, meta-title and tel-mailto rule changes. I found no blocking problems. I only read the code and did not run the test suite.
Performance and security: |
This was referenced Oct 12, 2026
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.
Three rule fixes reported from the 84-site audit corpus.
Closes #658
Closes #663
Refs #659 (the header-based criteria wait on #674, see below)
#658
core/meta-title: measure the displayed titleThe rule measured
title.lengthon the raw<title>source, so a theme that indents the title across lines (Shopware, Shopify) gotTitle too longfor its indentation. It now measures the title asdocument.titlegives it: runs of ASCII whitespace (space, tab, LF, FF, CR) collapse to one space and the ends are trimmed. The finding'svalueand item label show that collapsed text. A no-break space is not collapsed. A whitespace-only title is reported missing, the same as<title></title>. Over-long and too-short titles still warn.#659
core/charset: placement advice vs encoding problems<head>: statusinfo, messageUTF-8 is declared correctly; consider placing the charset meta first in head (best practice).infois score-neutral (calculateRuleScoreskips it), below thewarn/failof the missing and conflicting cases, which keep their status.<meta>(either form) that does not end within the first 1024 bytes of the raw HTML warnsCharset meta is not within the first 1024 bytes(HTML Standard 4.2.5.4), even when the header also says UTF-8. The scan is bounded to the first 1024 UTF-16 code units, skips comments and other tags the way the prescan does, handles quoted>and open quotes, and counts UTF-8 bytes. Pages crawled with browser rendering are not measured, because their HTML is the serialized DOM.Conflicting charset declarations: header <h>, page <p>. I chosewarnbecause the header decides the decoding, so the effective encoding is the same non-UTF-8 the rule already warns about (Non-UTF-8 charset declared), whilefailstays reserved for no declaration at all. Two different non-UTF-8 labels are not called a conflict, since the labels can name one encoding. The judged value is now the header's when it names one (the browser's precedence), and a quoted header charset is unquoted.Not end to end yet (#674): the crawler keeps only the media type of
Content-Type(packages/crawler/src/fetcher.tsnormalizeContentType), so in a real auditctx.page.headers["content-type"]never carries a charset. A page declared UTF-8 only by its header reportsNo charset declaration foundtoday (on 0.0.108 too), and the conflict warning cannot fire. Met end to end: placement advice and the 1024-byte check (criteria 1 for meta declarations, 2, 3). Met only in rule unit tests until #674 lands: header-declared UTF-8 and the header/meta conflict (criterion 1 for headers, criterion 4's conflict case). The rule docs and CHANGELOG say so.#663
links/tel-mailto: optional trunk prefix(0)<a href="tel:+4960616309800">+49 (0)6061 630 980 0</a>is no longertel-mismatch. The display text (never the href) is read with the parenthesised trunk prefix omitted, and when that matches the href the link gets a newtel-trunk-prefixcheck atinfo:<count> tel link(s) show the optional trunk prefix (0) in an international number; drop it (ITU-T E.123), itemtext "<text>": use "<international form>". This reading is limited to calling codes whose national trunk prefix is 0 and is omitted internationally, per the ITU-T dialling procedures list (annex to Operational Bulletin 994), cited in the code: +31, +32, +33, +41, +43, +44, +49, +61, +64, +353. Countries with no trunk prefix keep their zero (Italy +39, Spain +34 stay mismatches), and a display number that really differs still reportstel-mismatch. The(0)reading runs before the 3-consecutive-digit gate, so grouped numbers such as+33 (0)1 23 45 67 89are covered, and it needs at least 7 interpreted digits.Heads up: info checks are invisible in reports today (#669)
The placement advice (#659) and the tel formatting advice (#663) are
infochecks. Info checks never appear in the CLI text, LLM or JSON output, because report grouping skips a rule that has no warn or fail. So both pieces of advice are score-neutral and are not shown in reports until #669 lands. They are in the stored rule results (verified below). For the reporter: after this change those pages simply stop showing the finding.Verification
packages/rules/tests/core-meta-title.test.ts,core-charset.test.ts, and a links/tel-mailto: distinguish optional German trunk-prefix notation from a destination mismatch #663 block intel-mailto.test.ts. 49/49 pass. Run against the origin/main rule code, the new behaviour tests fail (22 of them, plus 3 more for the review fixes). The controls and unchanged cases pass on both.title-pattern-outlier,template-verdict-page-independence,private-target-skip,noindex-skip,rule-verdict-scope(485), audit-enginetemplate-fanout-parity-goldenandfingerprint-parity(60).tsgo --noEmiton packages/rules is clean.tangly check --strictpasses.rule-cache-replay-golden.test.ts: 10 of 11 pass locally. "a page where a rule timed out is not stored" hangs to its 180 s timeout on this machine with pristine origin/main rule files too (3-run matrix: all-main hung 2 of 3), andrule-time-budget.test.tsfails 9/20 here on main, so this looks like a local node:vm watchdog flake, not this change. CI on Linux is the judge.--http --refresh -m 1 --rule-include <rule>):warn Title too long(121 chars, raw) before; pass with valueTret- & Kinderroller kaufen - Preiswertafter. Control unchanged.warn ... not at start of headbefore; stored rule resultinfo UTF-8 is declared correctly; ...after. Control passes.warn Charset meta is not within the first 1024 bytesafter.+49 (0)6061 630 980 0:tel-mismatchbefore; storedtel-trunk-prefixinfo withuse "+49 6061 630 980 0"after.+49 (0)6061 630 980 1stilltel-mismatch.<meta-data>, no<metainside another tag's attribute, an open quote runs to the window end) and the(0)reading ahead of the digit gate. Kept as a documented limit: the decoded body has lost any UTF-8 BOM, so such a page is measured 3 bytes short (its BOM decides the decoding anyway).Docs and skill
Docs updated in this PR:
docs/rules/core/meta-title.mdx,docs/rules/core/charset.mdx,docs/rules/links/tel-mailto.mdx(message templates, the country list with sources, the #674 limit). CHANGELOG has entries under Unreleased. The squirrelscan agent skill needs no change: no CLI surface, rule id or option changed.