Skip to content

feat(check): --viewport + --warning-floor-px audit dials (default-inert) - #1

Open
emmanuelbruno wants to merge 1 commit into
mainfrom
feature/cli-audit-dials
Open

emmanuelbruno wants to merge 1 commit into
mainfrom
feature/cli-audit-dials

Conversation

@emmanuelbruno

Copy link
Copy Markdown
Contributor

Summary

Two additive, optional check CLI dials so the fleet can tune the audit without code changes:

  • --viewport <WxH> — browser page viewport (default 1280x800, the previously hardcoded value at src/runner.mjs, now exported as DEFAULT_VIEWPORT).
  • --warning-floor-px <N> — overflow.slide-viewport severity floor (default 50, the SLIDE_VIEWPORT_WARNING_FLOOR_PX constant in src/checks/overflow.mjs — the fleet-docs 50 px figure verified).

Fleet knob lineage: _quarto-utils PR #44's input table reserves viewport / warning-floor-px passthrough for AFTER the v0.1.6 tag. No consumer impact from this PR: the workflow wrapper does not pass the new flags, and the fleet clones this repo by tag (visual-check.yml → git clone --branch "$TOOL_REF"), so nothing changes until this lands, a v0.1.6 tag is cut, and the follow-up workflow PR ships. package.json is intentionally not bumped (release flow is tag-driven; no code or CI reads the version field).

Default-inert proof

node src/cli.mjs selftest --out … run on clean main @ 38c0bb9 (baseline) and on this branch with no new flags, both 27 PASS / 0 FAIL. Diffing violations.jsonl / scrollers.jsonl / summary.json after normalising only the two volatile fields (random localhost server port, durationSec): empty diff — SHA-256 of the concatenated normalised artifacts identical base vs head:

b770453d3ca0bca5bf094ef5381960f3ec24b0275802b1da6b56d836b9f13237  base
b770453d3ca0bca5bf094ef5381960f3ec24b0275802b1da6b56d836b9f13237  head

Validation (macOS host, Playwright chromium-1248 available — browser tier achieved)

  • check --help lists both flags with defaults sourced from the code constants (DEFAULT_VIEWPORT, SLIDE_VIEWPORT_WARNING_FLOOR_PX) — exit 0.
  • Invalid probes exit 2 with usage error: --viewport abc, --viewport (missing value), --viewport 800x600x1, --warning-floor-px -5, --warning-floor-px (missing value).
  • Floor threading: check --site fixtures --warning-floor-px 10 → the planted 20 px slide-overflow-minor row flips severity:"warning" (default) → "error" (floor 10); the 500 px row stays error in both.
  • Viewport threading: check --site fixtures --viewport 640x480 → evidence screenshots render at 640x480 (vs 1280x800 default, measured via sips), classification diff (port-normalised) empty.
  • Unit-level parse assertions via node -e import of the exported parseViewport / parseWarningFloorPx (direct-run guard added to cli.mjs so it is importable): all pass.
  • .github/workflows/selftest.yml runs node selftest.mjs unchanged on the CI runner as a second line of defence.

Scope note

Exactly 2 flags; no change to check modes, classification logic, registry, fixtures, selftest, or package.json. One known cosmetic gap: src/registry.mjs fixHint prose still hardcodes ">=50px" (static hint text, not classification input — left untouched deliberately).

🤖 Generated with [opencode]

…-warning-floor-px <N> (default 50); defaults reproduce v0.1.5 classification byte-identically (port/duration-normalised selftest diff empty, sha256 b770453d…); invalid values exit 2; check --help lists both with code-sourced defaults; _quarto-utils PR #44 workflow passthrough is the follow-up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant