Skip to content

feat(web): enforce the monochrome rule, gate coverage per-PR, write the standard down - #206

Merged
athvin merged 1 commit into
mainfrom
feat/frontend-monochrome-gate
Oct 20, 2026
Merged

athvin merged 1 commit into
mainfrom
feat/frontend-monochrome-gate

Conversation

@athvin

@athvin athvin commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Final PR of the frontend-quality program. Stacked on #201 (merged).

1. The monochrome rule is enforced now

docs/frontend-design.md §3.3 calls black-and-white "a standing constraint on every surface and component, not a launch-phase simplification", and CLAUDE.md repeats it. Nothing checked it, and the code had drifted: 47 Tailwind palette utilities across 12 component files, using emerald, red and amber to encode meaning.

The rule follows the repo's own template — the no-restricted-syntax rule that bans pending_until_next_reconcile, comment and design-doc citation included.

In most of the 12, hue was a redundant second encoding and simply went away:

Was Now Why it still reads
emerald/red waterfall bars bg-foreground/70 both polarity is the bar's side of the axis, plus the signed weight
emerald/red always/never chips filled vs outlined opposites, not better/worse
emerald "published" chip filled vs muted the live version must be findable at a glance
amber impersonation banner bg-foreground text-background it must still shout; inverted is the loudest grayscale has
emerald/amber histogram zones three lightness steps the ordering already carried it
emerald success icons text-foreground CheckCircle2 vs Circle was already saying it

field-compare-grid already carried an icon and sr-only text, with its own comment that the tint must not be the only signal — so hue was redundant there by the author's own reasoning.

The one exception, left deliberately

--destructive is the only theme token that isn't grayscale. I audited every colour value in the built stylesheet; exactly two are not grayscale, and both are this token:

--destructive: #bf000f   (light)
--destructive: #ff6568   (dark)

Everything else in the bundle is R == G == B or lab() with zero a/b. 25 files, 54 usages.

The lint rule deliberately does not flag it: referencing a semantic token is correct component behaviour, and whether that token carries hue is one theme decision made in one place. Resolving it strips the danger affordance from every error message and destructive action at once, so it wants a design pass rather than a find-and-replace. The re-runnable audit command is in the doc.

Visual baselines: all 30 regenerated, byte-identical

I checked this rather than assuming the copy-back worked — mtimes confirm they were rewritten, and they match HEAD exactly.

It's self-consistent rather than suspicious: the stylesheet now contains no emerald/amber/red value at all, so a baselined screenshot that had rendered one of those pixels would necessarily have changed. The converted components aren't on the ten baselined screens, or need state the pixel-asserted fixtures don't reach.

That does surface a gap, which the doc now records: the visual tier pixel-asserts ten screens, not every component state. "No diff" shouldn't read as full coverage.

2. Coverage gates every PR

pnpm check runs vitest run --coverage. This diverges from the Rust side (llvm-cov nightly) because v8 instrumentation of this tier costs under a second — there was no latency argument for deferring it to the next morning.

Floor: lines 48 / functions 33 / statements 48 / branches 49, just under the measured 49.3 / 34.9 / 49.4 / 50.1, per the house convention of ratcheting up and never down. Verified by raising it to 60 and watching it fail.

The threshold comment records why this isn't ~70%: roughly 1,300 of src/lib's lines are src/lib/query/** — TanStack Query hooks that need a QueryClient and a backend to say anything, and which the Playwright tier already drives. Chasing them in jsdom would raise the number without raising confidence.

3. docs/frontend-testing.md

The standard, in the shape of docs/parity-roadmap.md: locked scope decisions, the four tiers and which one a change belongs in, what each gate is for, the dormancy note for the full-stack tier, and a dated change log naming the gate each entry was verified against.

Its "Proving a gate works" section is the rule this whole program ran on — every gate observed failing on a deliberate violation before being trusted green — with the semgrep rule that reported "0 findings" while its pattern failed to parse as the worked example.

Verification

  • pnpm check green: eslint (monochrome rule enforcing), prettier, tsc, authz gate, 272 tests, coverage floor enforced.
  • next build clean; /login and /reset still static.
  • Functional tier, desktop-chromium: 128 passed, 1 skipped, 0 failed. The three grow.spec.ts wizard specs that failed locally earlier in this program now pass, confirming that was local mock-server state pollution rather than a break — CI passed them throughout.
  • Monochrome rule verified to fail on a reintroduced text-emerald-600.
  • All 30 baselines regenerated in mcr.microsoft.com/playwright:v1.63.0-jammy.

🤖 Generated with Claude Code

…he standard down

Three things that each close a gap between what this repo says it does and
what it checks.

### The monochrome rule is enforced now

docs/frontend-design.md §3.3 calls black-and-white "a standing constraint
on every surface and component, not a launch-phase simplification", and
CLAUDE.md repeats it. Nothing checked it, and the code had drifted: 47
Tailwind palette utilities across 12 component files, using emerald, red
and amber to encode meaning.

A no-restricted-syntax rule now rejects palette utilities in string and
template literals — the same mechanism, and the same comment-with-a-
design-doc-citation shape, as the existing pending_until_next_reconcile
rule.

In most of the 12 the hue was a redundant second encoding and simply
went away: the waterfall already showed polarity by which side of the
centre axis a bar sat on plus the signed weight; success states already
used CheckCircle2 vs Circle; field-compare-grid already carried an icon
AND sr-only text, with its own comment saying the tint must not be the
only signal. Where two things genuinely needed separating, the
replacement is filled-vs-outlined (always/never assertions) or a
lightness step (the three histogram zones) — not a new colour. The
impersonation banner became inverted foreground/background, because that
banner does have to shout.

All 30 visual baselines were regenerated in the pinned Linux image and
came back byte-identical. That is self-consistent rather than
suspicious: the stylesheet now contains no emerald/amber/red value at
all, so a baselined screenshot that had rendered one of those pixels
would necessarily have changed. The converted components are not on the
ten baselined screens, or need state the pixel-asserted fixtures do not
reach. Noted in the doc, since "no diff" should not read as full
coverage.

One exception, deliberately left: `--destructive` is the only theme token
that is not grayscale. An audit of every colour in the built stylesheet
leaves exactly two non-grayscale values, #bf000f and #ff6568, both this
token, across 25 files. The lint rule does not flag it — referencing a
semantic token is correct component behaviour, and whether that token
carries hue is one theme decision. Resolving it removes the danger
affordance from every error and destructive action at once, so it wants
a design pass, not a find-and-replace. The re-runnable audit command is
in the doc.

### Coverage gates every PR

`pnpm check` runs `vitest run --coverage`, so the floor is part of the
same gate as lint and tsc. This diverges from the Rust side, which runs
llvm-cov nightly, because v8 instrumentation of this tier costs under a
second — there was no latency argument for deferring it to the next
morning.

Floor set to lines 48 / functions 33 / statements 48 / branches 49, just
under the measured 49.3/34.9/49.4/50.1, per the house convention of
ratcheting up and never down. Verified by raising it to 60 and watching
it fail.

The threshold comment records why this is not ~70%: roughly 1,300 of
src/lib's lines are src/lib/query/** — TanStack Query hooks needing a
QueryClient and a backend to say anything, which the Playwright tier
already drives. Chasing them in jsdom would raise the number without
raising confidence.

### docs/frontend-testing.md

The standard, in the shape of docs/parity-roadmap.md: locked scope
decisions, the four tiers and which one a change belongs in, what each
gate is for, the dormancy note for the full-stack tier, and a dated
change log naming the gate each entry was verified against.

Its "Proving a gate works" section is the rule the rest of this program
ran on — every gate observed FAILING on a deliberate violation before
being trusted green — with the semgrep rule that reported "0 findings"
while its pattern failed to parse as the worked example.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit 59a4f25 into main Oct 20, 2026
14 checks passed
athvin pushed a commit that referenced this pull request Oct 20, 2026
Adding the cargo ecosystem in #187 closed a real gap — the repo's own
security notes flagged that nothing bumped Rust advisories — but it
opened five PRs at once, and that turned out to matter.

Each cargo PR carries a different Cargo.lock, so Swatinem/rust-cache
(keyed on the lockfile) misses and the workspace compiles near-cold.
Five of those in parallel starved the runners enough to push
`fmt + clippy + docs` past its 30-minute timeout — on the dependabot
branches and on main. The job takes ~16 minutes uncontended; #206 took
28m39s under this load, so the timeout was already marginal and the
burst tipped it over.

The grouping config batches minor/patch into one PR, but majors are
deliberately separate — a major is a migration to schedule, not a bump
to merge on green — so a week with several major releases is exactly
when this happens. arrow 59.3.1, rand 0.10.3 and two datafusion 55.2.0
bumps all landed together.

Capping at 2 fixes the cause rather than the symptom; Dependabot queues
the rest and opens them as these merge, so no update is lost. npm stays
at 5, since those PRs do not compile Rust.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Oct 20, 2026
* ci(frontend): filter pushes to main, not just PRs

Dropping the `paths:` filter was necessary to make the frontend jobs
required status checks — a workflow a path filter skips never reports, so
a required check sits pending forever. But `detect` only filtered
`pull_request`, so every push to main ran the whole gate, and the first
Rust-only merge after #206 duly spent ~5 minutes in the Playwright
container to re-test a tree it had already tested: a squash commit and
the PR head it came from are near-identical, and that PR ran this exact
gate to green minutes earlier.

rust.yml always runs on main for a good reason — it IS the gate
protecting that branch, so it must never self-skip there. That reasoning
does not transfer to this workflow, which was copied from it.

`push` now diffs `event.before...event.after` through the same
`^frontend/` filter the PR case uses. It fails SAFE: an all-zeroes
`before` (a branch's first push) or one git cannot resolve (after a
force-push) runs the gate rather than skipping it — a wasted run beats a
silent one. Nightly and manual runs are unchanged, and so is the
`pull_request` path, so required checks keep behaving exactly as
verified.

All eight event paths were exercised against real commits before pushing
— #206 as a frontend-touching merge, #207 as a Rust-only one — covering
push/PR × touching/not-touching plus the two degenerate `before` values
and schedule/dispatch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: cap cargo Dependabot at 2 open PRs

Adding the cargo ecosystem in #187 closed a real gap — the repo's own
security notes flagged that nothing bumped Rust advisories — but it
opened five PRs at once, and that turned out to matter.

Each cargo PR carries a different Cargo.lock, so Swatinem/rust-cache
(keyed on the lockfile) misses and the workspace compiles near-cold.
Five of those in parallel starved the runners enough to push
`fmt + clippy + docs` past its 30-minute timeout — on the dependabot
branches and on main. The job takes ~16 minutes uncontended; #206 took
28m39s under this load, so the timeout was already marginal and the
burst tipped it over.

The grouping config batches minor/patch into one PR, but majors are
deliberately separate — a major is a migration to schedule, not a bump
to merge on green — so a week with several major releases is exactly
when this happens. arrow 59.3.1, rand 0.10.3 and two datafusion 55.2.0
bumps all landed together.

Capping at 2 fixes the cause rather than the symptom; Dependabot queues
the rest and opens them as these merge, so no update is lost. npm stays
at 5, since those PRs do not compile Rust.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

2 participants