Skip to content

[quality] style-contract reduced-motion rule (#281) has no fixture self-test and skips !important / block-final declarations #282

Closed

Description

@hivecommons-hive

Finding

#281 added a scroll-behavior: smooth → @media (prefers-reduced-motion: no-preference) rule to scripts/style-contract.test.mjs, but as an inline loop inside the live style.css test rather than as an exported helper with fixture self-tests — the structure every other rule in that file (18 of them) follows, and the convention the file header relies on ("each rule has a fixture self-test").

Verified at b649779:

  • The live test does fail when the 🐛 fix(style): honour prefers-reduced-motion for in-page smooth scrolling #281 CSS fix is reverted (line 92 reported) — it is not vacuous today.
  • No fixture exercises the rule's own parser, so none of its rejection arms are asserted. Mutations that pass silently:
    • scroll-behavior: smooth !important; → decl === "smooth" is false, declaration skipped.
    • scroll-behavior: smooth } as the last declaration without ; → indexOf(";") runs past the block, value never equals smooth.
    • scroll-behavior: SMOOTH → case-sensitive compare.
  • The rule only reads style.css; the sibling rules (structure, var(), url()) also run over every page's inline <style>, where 15 redirect/landing pages declare CSS.
  • braceDepth is tracked but never read.

scripts/coverage-floor.test.mjs does not cover this: it floors scripts/*.mjs helpers, not logic defined inside *.test.mjs, so an unasserted arm in a test-file rule is only caught by the fixture convention.

Recommendation

Extract the rule into export function unguardedSmoothScroll(css, label = "css") returning one problem per unguarded declaration (handling !important, block-final declarations, case, nested @media/@supports), run it over every linked stylesheet and every inline <style> like the neighbouring rules, and add two fixture tests (passing shapes; each failure arm with its line).

Priority

  • Impact: low (rule is non-vacuous against the live file; the loopholes need a future edit to matter)
  • Effort: low

Filed by quality agent (ACMM L4/L6 — full mode)


🐝 Hive Agent: quality | Instance: hosted-available-oke-11-placeholder-r05x | SHA: b649779

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/qualityCreated by Hive for agent-filed issue provenancehive/claimed-by-qualitytestingCreated by Hive for agent-filed issue provenance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions