Repository navigation
fix(audit): a name Firefox ships outranks one it merely resembles - #24
Merged
Merged
Conversation
`suggest()` consulted the shipped-chrome pack last, after both fuzzy matchers. So a token that Firefox ships under its own spelling could still be reported as a typo for an unrelated live element -- and because `similar` is patchable, `--patch` wrote it as a confident fix. WhiteSur found it. `#placesToolbar` is the Library window's toolbar in places.xhtml, a window the live audit never opens, so it was missing from the live set. `#PlacesToolbar` -- the main window's bookmarks toolbar, a different element in browser.xhtml -- is a close enough spelling to clear the near-miss gate, so the audit proposed swapping one for the other. Its siblings in the same file (#placesMenu, #placesView, #placesViewsBox, #placeContent, #placesList) all resolved correctly to offscreen, but only because no live name happens to collide with them. Left alone, the theme's weekly watch would have opened a pull request moving Library styling onto the bookmarks bar. The pack lookup now runs before the fuzzy matchers and after the exact namespace flip. That ordering is the point: an exact same-name match in the other namespace is direct evidence of a rename and still wins, while a 0.80-similarity match to a different name never outranks Firefox shipping the literal name. Against WhiteSur on Firefox 153 the selector findings go from two to one and the offscreen tier from 78 to 79. Also: the findings header said "1 selector need attention". This change makes the singular case ordinary, so it is fixed here. Co-Authored-By: Claude Fable 5 <[email protected]>
`fxcss upgrade --audit` selected the findings that should stop an upgrade
with `!= "unresolved"`, the inverse of the `in ("renamed", "similar")` test
`report()` and `--strict` use. That counts `offscreen` -- a name the shipped
chrome demonstrably still carries, in a document this tool cannot open -- as
a reason to refuse.
It was latent while almost nothing resolved to offscreen. The preceding
commit makes the pack authoritative, which moves names into that tier (78 to
79 against WhiteSur on Firefox 153), so it would have started refusing
upgrades over healthy selectors.
Fixed by naming the set once, in `audit.actionable()`, and calling it from
both places rather than restating the predicate at each call site -- the
restating is what let them diverge.
Co-Authored-By: Claude Fable 5 <[email protected]>
adamXbot
added a commit
that referenced
this pull request
Aug 31, 2026
…indow The live audit only ever opens a browser window, but a theme also styles the Library, DevTools and about: pages through @-moz-document. Extraction was blind to that scoping, so every such rule was compared against the browser window's DOM -- which is not evidence about it either way, and which invents renames between unrelated documents. WhiteSur's `#placesToolbar` is the case that found it. That is the Library window's toolbar, `places.xhtml:1154` in the shipped omni.ja and `places.xhtml:164` on ESR 140, so the theme is correct. The live DOM lacks it, and `_is_near_miss` then matched browser.xhtml's `#PlacesToolbar` -- the main window's bookmarks toolbar, a different element one letter of case away -- at which point --patch called the rewrite confident. Applying it would have unstyled the Library. extract_tokens now records the @-moz-document condition each token sits under, and suggest() skips every DOM-derived branch when a use is scoped to a document this audit does not open. The shipped chrome is still consulted: omni.ja carries those documents, so a name Firefox ships resolves to `offscreen` as before. Only when the pack cannot answer either does the new `other-document` confidence apply -- distinct from `unresolved`, which means "looked and found nothing" rather than "not entitled to look". Both are non-actionable, so --strict and --patch ignore them. Two things this had to get right: Findings are grouped per scope, not per token. A token can be written both globally and inside an @-moz-document block, and --patch rewrites the exact file:line sites a finding carries -- so one shared verdict let the confident half drag the unjudgeable half into the patch, the very failure the scope check exists to prevent. Caught in review by the session working #24. The findings sort gained a (file, line) tiebreak, since two findings can now share a token. A condition wrapped across lines is read whole. Evaluated from its first line alone it finds no url() at all, scores as excluding the audited window, and silently hides every finding inside -- worse than the false positive this fixes, since it fails in the direction of silence. All three shapes are pinned: the brace on the prelude's last line, the brace on its own line, and a wrapped multi-condition list. Measured against WhiteSur on Firefox 153: findings 2 -> 1, offscreen 78 -> 79, and the emitted patch no longer contains the bad rename. The remaining finding is real and fixed by that theme's #221. Co-Authored-By: Claude Opus 5 <[email protected]>
adamXbot
added a commit
that referenced
this pull request
Aug 31, 2026
An unbalanced brace inside an unquoted url() closes the block early if brace counting runs on anything less neutralised than `cleaned` -- and every rule after it silently goes back to being judged against the browser window, reinstating the false positive this fixes. Balanced braces cancel out, so it takes a deliberately unmatched one to catch. Found by the session working #24, against their own implementation; this one is already correct, and now says so. Also pins mixed condition lists in both directions, since `_scope_covers` handles them by construction rather than by an explicit branch. Co-Authored-By: Claude Opus 5 <[email protected]>
adamXbot
added a commit
that referenced
this pull request
Aug 31, 2026
…indow (#25) * fix(audit): a rule scoped to another document is not judged by this window The live audit only ever opens a browser window, but a theme also styles the Library, DevTools and about: pages through @-moz-document. Extraction was blind to that scoping, so every such rule was compared against the browser window's DOM -- which is not evidence about it either way, and which invents renames between unrelated documents. WhiteSur's `#placesToolbar` is the case that found it. That is the Library window's toolbar, `places.xhtml:1154` in the shipped omni.ja and `places.xhtml:164` on ESR 140, so the theme is correct. The live DOM lacks it, and `_is_near_miss` then matched browser.xhtml's `#PlacesToolbar` -- the main window's bookmarks toolbar, a different element one letter of case away -- at which point --patch called the rewrite confident. Applying it would have unstyled the Library. extract_tokens now records the @-moz-document condition each token sits under, and suggest() skips every DOM-derived branch when a use is scoped to a document this audit does not open. The shipped chrome is still consulted: omni.ja carries those documents, so a name Firefox ships resolves to `offscreen` as before. Only when the pack cannot answer either does the new `other-document` confidence apply -- distinct from `unresolved`, which means "looked and found nothing" rather than "not entitled to look". Both are non-actionable, so --strict and --patch ignore them. Two things this had to get right: Findings are grouped per scope, not per token. A token can be written both globally and inside an @-moz-document block, and --patch rewrites the exact file:line sites a finding carries -- so one shared verdict let the confident half drag the unjudgeable half into the patch, the very failure the scope check exists to prevent. Caught in review by the session working #24. The findings sort gained a (file, line) tiebreak, since two findings can now share a token. A condition wrapped across lines is read whole. Evaluated from its first line alone it finds no url() at all, scores as excluding the audited window, and silently hides every finding inside -- worse than the false positive this fixes, since it fails in the direction of silence. All three shapes are pinned: the brace on the prelude's last line, the brace on its own line, and a wrapped multi-condition list. Measured against WhiteSur on Firefox 153: findings 2 -> 1, offscreen 78 -> 79, and the emitted patch no longer contains the bad rename. The remaining finding is real and fixed by that theme's #221. Co-Authored-By: Claude Opus 5 <[email protected]> * test(audit): pin the scope shapes a tidy fixture would miss An unbalanced brace inside an unquoted url() closes the block early if brace counting runs on anything less neutralised than `cleaned` -- and every rule after it silently goes back to being judged against the browser window, reinstating the false positive this fixes. Balanced braces cancel out, so it takes a deliberately unmatched one to catch. Found by the session working #24, against their own implementation; this one is already correct, and now says so. Also pins mixed condition lists in both directions, since `_scope_covers` handles them by construction rather than by an explicit branch. Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude Opus 5 <[email protected]>
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.
suggest()consulted the shipped-chrome pack last, after both fuzzy matchers. So a token Firefox ships under its own spelling could still be reported as a typo for an unrelated live element.The case that found it
WhiteSur uses
#placesToolbar. That is a real element: the Library window's toolbar,places.xhtml:1154, sitting beside the#placesMenuthe same CSS block styles. The rule lives inside@-moz-document url("chrome://browser/content/places/places.xhtml"), and fxcss has no@-moz-documenthandling at all — it extracts every token in the theme and compares them against DOM collected only frombrowser.xhtmlstates. So the token was absent from the live set and fell through to the near-miss branch, where_differing_chars("placesToolbar", "PlacesToolbar") == 1read the capitalisation as a typo and offered#PlacesToolbar— the main window's bookmarks toolbar,browser.xhtml:6472, a different element in a different document.Its siblings in the same file —
#placesMenu,#placesView,#placesViewsBox,#placeContent,#placesList— all resolved correctly tooffscreen. They only got there because no live name happens to collide with them;#placesToolbarwas unlucky in having a near-twin one capital letter away.Scope of the harm
write_patchonly emitsrenamedfindings, so thissimilarfinding was never written into a patch — I checked the generated patch against WhiteSur master and it contains only the unrelatedrenamedfix. The damage is narrower than that, and still worth fixing:--strictnon-zero on a theme that is actually correct, which is what stops the watch going quiet.The fix
The pack lookup now runs before the fuzzy matchers and after the exact namespace flip. That ordering is deliberate on both sides:
Verification
Against WhiteSur master on Firefox 153:
#placesToolbarnow reportsnot in any live state, but shipped in omni.ja!chrome/browser/content/browser/places/places.xhtml. The one remaining finding is a genuinely dead selector, removed in AdamXweb/WhiteSurFirefoxThemeMacOS#221; with both landed the full CI line exits 0 and writes an empty patch.OffscreenBeatsFuzzyTestspins all three edges: the shipped name wins over a near-miss, the near-miss still fires when nothing ships the name, and the exact namespace flip still outranks the pack. The first fails against 0.19.0 (similar → #PlacesToolbar) and passes here. All 233 unit tests green.What this does not fix
This makes the pack authoritative, which covers every token Firefox still ships under its own name. It does not teach the audit about document scoping: token extraction stays scope-blind, so a token inside an
@-moz-documentblock that is absent from the pack entirely can still draw a fuzzy suggestion from a different document's live DOM. WhiteSur has three more such blocks (devtools.css:24,in-content.css:28,userContent.css:52). That is being addressed separately, on top of this branch.Root-cause detail on the
@-moz-documentblind spot came from a parallel investigation by another session, reached independently and verified here against the installed omni.ja and searchfox esr140.🤖 Generated with Claude Code