Fix detector URL scans and advisory handling - #709
Conversation
Recover joined URL arguments without splitting local paths, derive advisory behavior from registry severity across consumers, inspect readable linked CSS in URL scans, and report only the dominant primary font. AI assistance disclosure: Implemented and verified with Codex under maintainer direction.
There was a problem hiding this comment.
🔵 Needs a closer look
It changes core detector URL-scan inputs, advisory exit-code semantics, and browser bundle behavior across multiple runtimes, so a final human review is warranted despite strong test coverage.
Pull request overview
This PR fixes several correctness gaps in the detector’s URL-mode and advisory handling, aligning behavior across the CLI, JSON output, browser bundle, and design hook while adding regression coverage for the previously shipped bugs (Issue #625).
Changes:
- Fixes multi-URL “joined argv token” handling by only splitting targets when every whitespace-delimited part is itself a URL.
- Makes
severity: 'advisory'the canonical source of truth for advisory behavior (exit codes, filtering, hook behavior), while preservingadvisory: trueas a compatibility/output flag. - Expands URL-mode pattern scans to include readable linked stylesheet CSS (same-origin / CORS-readable), while still dropping selector-scoped findings that don’t match the live DOM.
File summaries
| File | Description |
|---|---|
| tests/hook.test.mjs | Extends hook filtering tests to cover advisory inclusion config and severity: 'advisory' classification. |
| tests/fixtures/antipatterns/linked-url-patterns.html | Adds a browser fixture page to validate linked-stylesheet pattern scanning in URL mode. |
| tests/fixtures/antipatterns/linked-url-patterns.css | Adds linked CSS that should trigger a pattern while ensuring unused selectors aren’t reported in live URL findings. |
| tests/detect-cli-stdin-dispatch.test.mjs | Updates stdin dispatch test to accept advisory-only runs as non-blocking (exit 0) and assert advisory serialization. |
| tests/detect-antipatterns.test.js | Updates CLI contract tests for advisory-only exit behavior and stderr/stdout stream expectations. |
| tests/detect-antipatterns-browser.test.mjs | Adds browser regression tests for joined multi-URL expansion, linked CSS scanning, advisory serialization, and dominant-font reporting. |
| skill/scripts/hook-lib.mjs | Teaches hook advisory detection to honor severity: 'advisory' in addition to legacy flags. |
| README.md | Documents output streams (stderr vs stdout), URL-mode linked CSS behavior, and limits of detector signal. |
| cli/engine/rules/checks.mjs | Adjusts overused-font to report only the uniquely dominant primary font family (no ties / no “secondary primary”). |
| cli/engine/registry/antipatterns.mjs | Moves advisory classification to severity: 'advisory' and derives the advisory id set from severity. |
| cli/engine/findings.mjs | Stamps advisory: true based on the registry-derived advisory id set (severity-driven), while keeping severity serialized. |
| cli/engine/detect-antipatterns-browser.js | Updates the browser bundle to align advisory semantics, dominant-font logic, and linked stylesheet CSS inclusion in URL scans. |
| cli/engine/cli/main.mjs | Adds joined multi-URL expansion logic, aligns advisory partitioning with severity, and documents output streams in --help. |
| cli/engine/browser/injected/index.mjs | Updates the injected browser path to include readable linked stylesheet CSS in the HTML pattern corpus for URL scans. |
Review details
- Files reviewed: 14/14 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Greptile SummaryThe browser detector now aligns linked stylesheet analysis with rendered page behavior, including conditional rules, container queries, selector applicability, and browser-resolved animation keyframes. The CLI also correctly recovers accidentally whitespace-joined URL inputs while preserving legitimate URL and filesystem paths containing spaces. Confidence Score: 5/5No blocking failure remains. Browser and command-line behavior was exercised against real Chromium and the public CLI interface. The checked behaviors correctly filter inactive or unreachable CSS, retain active styles and effective animations, enforce promoted findings, and preserve valid targets containing spaces.
What T-Rex did
Reviews (12): Last reviewed commit: "Fix keyframe easing detection" | Re-trigger Greptile |
Flatten linked stylesheet grouping rules and collect only selector rules that target the live DOM, preventing unused grouped and selector-less patterns from leaking into URL findings. AI assistance disclosure: Implemented and verified with Codex under maintainer direction.
AI assistance disclosure: Codex implemented and verified these fixes under maintainer direction.
AI assistance disclosure: Codex implemented and verified this fix under maintainer direction.
Resolve pseudo-element selectors to live hosts, reject unresolvable linked CSS findings, and make the regression assertions independent. Also ignore comment delimiters when recovering CSS rule selectors. AI assistance disclosure: This commit was prepared with Codex under maintainer direction.
Exclude linked container-query groups when their current applicability cannot be resolved, with a browser regression proving inactive styles do not leak. AI assistance disclosure: This commit was prepared with Codex under maintainer direction.
|
Addressed the final Greptile container-query finding in eec431e. Linked |
Use a temporary custom-property probe so the browser decides whether a nested style rule actually applies in the current container layout. AI assistance disclosure: Codex helped implement and test this fix under maintainer direction.
|
Addressed the latest Greptile finding in 720222e. The linked-stylesheet walker no longer drops all Regression coverage now proves both sides in the same fixture: an inactive container rule is excluded and an active container rule is included and detected. Validation: AI assistance disclosure: Codex helped implement, test, and summarize this fix under maintainer direction. |
Keep valid empty pseudo-class matches authoritative and omit selector-less linked at-rules that cannot be tied to rendered nodes. AI assistance disclosure: Codex helped implement and test this fix under maintainer direction.
|
Validation for ecfcd77:
The two negative cases use independent signatures: inactive pseudo-class CSS would emit AI assistance disclosure: Codex helped implement, test, and summarize this fix under maintainer direction. |
Preserve quoted attribute values and escaped identifiers while resolving real pseudo-elements to live hosts. AI assistance disclosure: Codex helped implement and test this fix under maintainer direction.
|
Validation for a5af5b2:
New coverage distinguishes selector syntax from literal data: a quoted AI assistance disclosure: Codex helped implement, test, and summarize this fix under maintainer direction. |
AI assistance disclosure: Codex helped implement and verify this fix under maintainer direction.
AI assistance disclosure: Codex helped implement and verify this fix under maintainer direction.
AI assistance disclosure: Codex helped implement and verify this fix under maintainer direction.
AI assistance disclosure: Codex helped implement and verify this fix under maintainer direction.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1902ef0. Configure here.
Serialize effective per-keyframe easing back into the linked stylesheet corpus so overshoot motion is detected. Add a browser regression with a neutral animation name.\n\nAI assistance disclosure: Codex helped implement and test this fix under maintainer direction.

Summary
Validation
Refs #625
AI assistance disclosure: Implemented and verified with Codex under maintainer direction.
Note
Medium Risk
Large changes to browser URL scanning and CSSOM filtering can shift which findings appear or disappear; advisory/exit-code behavior changes may affect CI gates that assumed former slop rules were blocking failures.
Overview
Improves URL/browser detection and advisory behavior across CLI, JSON, hooks, and the injected browser engine.
Browser URL scans now fold readable linked stylesheets into the HTML pattern corpus, but only for rules that resolve to live DOM hosts. Inactive
@media/@supports/ pseudo-class rules and unused selectors are dropped;@containerrules are verified with a computed-style probe; keyframes are serialized from the Web Animations API when available. Selector attribution uses smarter pseudo-element → host resolution instead of blunt stripping (so inactive:not()rules are not falsely broadened).Advisory rules use registry
severity: 'advisory'(replacingadvisory: true). Runtimeadvisoryflags and exit-code partitioning derive from effective severity everywhere, including per-finding promotions in the browser serializer.CLI: documents stderr vs stdout (
--jsonon stdout, human output via2>);expandJoinedUrlTargetssplits a single argv string of multiple URLs without breaking paths that contain spaces.overused-fontflags only the uniquely most-used family (no more 15% “primary” threshold).enclosingCssSelectorignores{/;inside CSS comments when attributing matches.Tests and fixtures cover joined URLs, linked-CSS/container/keyframes cases, and advisory JSON/exit behavior.
Reviewed by Cursor Bugbot for commit 04c5f0b. Bugbot is set up for automated code reviews on this repo. Configure here.