Skip to content

test(design): prove the accent rail renders, not just that its class is present (#094) - #1415

Closed
BigSimmo wants to merge 21 commits into
mainfrom
claude/design-computed-style-proof
Closed

test(design): prove the accent rail renders, not just that its class is present (#094)#1415
BigSimmo wants to merge 21 commits into
mainfrom
claude/design-computed-style-proof

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Summary

Closes ledger #94 — the design-system gates asserted structure, not rendered effect.

PR #1316 shipped an inert accent rail. .search-band declares border-top: 2px solid var(--clinical-accent), but the same element also carries a border-[color:var(--border)] utility, and Tailwind's utilities layer outranks @layer components regardless of selector specificity. Move that rule into a layer and the rail silently renders as a 1px neutral border — while toHaveClass("search-band") passes the entire time. Class presence is not effect.

Two gates, both verified to go red on that exact regression rather than merely to pass against today's code:

Static — scripts/check-design-system-contract.mjs
UNLAYERED_EFFECT_SELECTORS plus an at-rule walker that reports the enclosing @layer/@media for a selector whose declared effect must beat a utility. Injecting .search-band into @layer components now fails with ".search-band must stay UNLAYERED — it is inside @layer …".

Worth recording: the first draft also failed on that injection, but for the wrong reason — "base rule is missing", because the regex anchored at line start and never found the indented rule, so the unlayered assertion never executed. It would have been correct by accident, and a cosmetic re-indent would have reported a deleted rule. The selector now tolerates indentation. That near-miss is the same class of defect this item exists to fix.

Rendered — tests/ui-smoke.spec.ts
Computed-style assertions at the already-proven /documents/search state:

  • border-top-width is 2px, not the 1px utility border
  • border-top-color equals --clinical-accent resolved through a probe elementgetPropertyValue returns the specified var(--primary-500), which is not comparable to a computed rgb()
  • the rail differs from its own side borders in both colour and width — the precise Search results band: truthful failure state, approved design, and adoption gate #1316 symptom
  • under forcedColors: active the rail survives as 3px thickness, since --clinical-accent resolves to LinkText and hue cannot carry the distinction. Previously asserted only by text-searching globals.css
  • every element with a 44px computed min-height renders at least 44px, and none sits on an inline box where CSS ignores min-height outright

Against the injected regression this reports Expected "2px", Received "1px".

Tap targets are selected by computed min-height, not class substring. A [class*='min-h-tap'] match tests the class rather than the effect — exactly the mistake #94 is about — and also catches breakpoint variants that are inert at the measured width.

RAG impact: no retrieval behaviour change — a test, a static check, and two ledger rows; nothing under src/lib/rag/**, clinical-search, ranking-config, the eval harness or the golden fixture is touched. No production source file changes.

Verification

  • npm run verify:pr-localTest Files 432 passed (432), Tests 4460 passed | 3 skipped
  • New Playwright case — 1 passed (19.2s) on Playwright 1.62.0
  • Negative test, static gate — regression injected → .search-band must stay UNLAYERED …, exit 1; reverted clean
  • Negative test, rendered gate — same injection → Expected "2px", Received "1px", exit 1; reverted clean
  • check:design-system-contract — passed, 611 production files

Three earlier runs of the new test failed, all on my own test bugs rather than product defects: the answer-composer helper used on the documents route (its "Generate source-backed answer" precondition cannot hold there), tap targets selected by class name, and a non-diagnostic assertion that reported only 16 and sent me guessing. The assertion now names the offending element.

Risk and rollout

Test and tooling only — no production source changes. Adds one Chromium case (~19s). Revert is a clean single-commit revert.

Clinical Governance Preflight

No ingestion, answer generation, search/ranking, document access, privacy or clinical output path is touched.

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow introduced or expanded
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains separated from real clinical sources
  • Source metadata, review status and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact checked — no clinical decision-support behaviour changed

Notes

Also records two issues verified this session:

#40 (visual-regression baselines) remains the larger half of this problem and is deliberately not in scope: baselines freeze the current appearance as the reference, so they need a human sign-off on the Clinical Sky look first. It should land before the #38/#39/#16 refactors, which it would protect.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved validation of search styling across standard and forced-colors display modes.
    • Added checks to help prevent undersized interactive controls.
  • Tests

    • Added UI coverage for document search, accent-rail rendering, accessibility sizing, and forced-colors behavior.
  • Documentation

    • Recorded recent review activity and documented two outstanding workflow and identifier-collision issues.

…is present

Closes the #94 gap: design-system gates asserted structure, not rendered
effect. PR #1316 shipped an inert accent rail — `.search-band` sits in the
cascade against a `border-[color:var(--border)]` utility on the same element,
and Tailwind's utilities layer outranks `@layer components` regardless of
specificity — while `toHaveClass("search-band")` passed the whole time.

Two gates, both verified to go RED on that exact regression rather than merely
to pass today:

- `check-design-system-contract.mjs` gains UNLAYERED_EFFECT_SELECTORS and an
  at-rule walker. Injecting `.search-band` into `@layer components` reports
  "must stay UNLAYERED — it is inside @layer …". The first draft failed on the
  same injection for the WRONG reason ("base rule is missing", because the
  regex anchored at line start and never found the indented rule), so the
  unlayered assertion never ran; the selector now tolerates indentation.
- `ui-smoke` asserts computed style at the already-proven /documents/search
  state: border-top-width 2px, border-top-color equal to --clinical-accent
  resolved through a probe element (getPropertyValue returns the specified
  `var(--primary-500)`, which is not comparable), the rail distinct from its
  own side borders in colour and width, 3px thickness under forced-colors
  emulation, and every control with a 44px computed min-height rendering at
  least 44px with none on an inline box. Against the injected regression it
  reports Expected "2px", Received "1px".

Tap targets are selected by computed min-height, not class substring: a
class-name match tests the class rather than the effect, which is the very
mistake this item exists to correct.

Also records ledger #116 (a deregistered worktree silently redirects git at the
shared primary checkout — nearly destroyed another session's uncommitted work
today) and #117 (issues:next-id collides between concurrent agents; three
collisions in 24 hours, resolved only by the union merge driver plus manual
renumbering).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@supabase

supabase Bot commented Jul 30, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 53 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e420652b-653c-4dbb-8687-23afad47df77

📥 Commits

Reviewing files that changed from the base of the PR and between 6b045e5 and 4f4d716.

📒 Files selected for processing (3)
  • docs/branch-review-ledger.md
  • docs/outstanding-issues.md
  • scripts/check-design-system-contract.mjs
📝 Walkthrough

Walkthrough

The pull request adds CSS contract enforcement for the unlayered .search-band effect, extends Playwright smoke coverage for computed styles and tap-target sizing, and records two review entries plus two outstanding issues in documentation ledgers.

Changes

Ledger updates

Layer / File(s) Summary
Review and issue ledger entries
docs/branch-review-ledger.md, docs/outstanding-issues.md
Adds review records for PRs #1415 and #1397, plus open items covering worktree redirection and concurrent issue-ID collisions.

Search UI contract coverage

Layer / File(s) Summary
Unlayered search effect contract
scripts/check-design-system-contract.mjs
Requires .search-band to remain outside Tailwind @layer blocks and reports enclosing at-rule ancestry on violations.
Search band and tap-target smoke coverage
tests/ui-smoke.spec.ts
Checks document-search accent-rail styling, forced-colors thickness, and rendered tap-target sizing.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • BigSimmo/Database#497: Extends the same document-search Playwright coverage around the “Open document” link.
  • BigSimmo/Database#896: Introduced forced-colors clinical accent token changes covered by these assertions.
  • BigSimmo/Database#1184: Refactors related universal search header/banner flows and their smoke tests.

Suggested reviewers: cursoragent, claude

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding rendered-effect tests for the accent rail instead of only class presence.
Description check ✅ Passed The description covers Summary, Verification, Risk and rollout, Clinical Governance Preflight, and Notes with concrete details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

BigSimmo and others added 3 commits July 30, 2026 13:43
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Keep main's closed #115 and open #116. Remap this branch's ledger
additions to #123#124 (after the #117#122 range reserved by open
PRs #1404 and #1396).

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
The conflict resolver mistook an open-item summary containing
`issues:next-id` for the marker conflict and replaced the whole table.
Restore main's open items and keep this branch's remapped #123#124 rows.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 228ffc8583

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/ui-smoke.spec.ts Outdated
Comment thread scripts/check-design-system-contract.mjs Outdated
Comment thread tests/ui-smoke.spec.ts Outdated
cursoragent and others added 6 commits July 30, 2026 05:47
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Three findings, all on the gates themselves rather than the product.

P2 — nested layers escaped the static check. `enclosingAtRule` returned only
the innermost at-rule, so `@layer components { @media (…) { .search-band { … } } }`
reported `@media` and passed while the rule still lost to Tailwind's utilities
layer. Now `enclosingAtRules` returns the full ancestry and any `@layer` in it
fails, with the whole chain in the message. Verified: the nested injection goes
red where it previously passed.

P2 — the tap audit truncated before validating. `measured.slice(0, 20)` ran
before the inline/undersized filters, so an offender past the twentieth match
was discarded and the test could go green on a rendered defect. Every match is
now validated; only the diagnostic lists cap (at 10).

P1 — the 44px filter was brittle. Not resolved by swapping in 48: --spacing-tap
is 2.75rem and the 48px sheet control is a documented exception, so hard-coding
either number encodes one cohort. The floor is now derived from --spacing-tap
via a probe element, every control at or above it is held to its OWN declared
min-height, and the token itself is asserted to resolve ≥44px. Correct at 44,
at 48, and if the token moves.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The open-items table was restored by hand after a #1415 conflict merge wiped it,
which left it off Prettier's formatting. verify:pr-local's format:changed gate
caught it. Table integrity re-verified: 59 open rows, my two rows intact as #123
and #124, no duplicate IDs, ledger guard passing at 1287 records.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Bundled from draft PR #1414. Confirms the maturity PR was ledger-only:
no tests or packages were added; recommendations remain deferred.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@cursor

cursor Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Bundled from draft #1414: appended the pr-diff-review ledger row for already-merged PR #1397 as a separate revertible commit 924699b4 (docs(ledger): record PR #1397 diff review).

Review conclusion carried over: #1397 was ledger-only by design — no tests/packages added; account-route Vitest, #040 baselines, and Python packaging remain follow-ups.

Draft #1414 is closed.

@BigSimmo
BigSimmo enabled auto-merge (squash) July 30, 2026 06:06
@BigSimmo
BigSimmo disabled auto-merge July 30, 2026 06:13
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

CI triage

CI failed on this PR. Automated classification of the 2 failed job(s):

  • Production UIneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • PR requiredneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.

Compared with main CI run #6785 (success).

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

@BigSimmo

Copy link
Copy Markdown
Owner Author

#codex fix failing CI please.

@BigSimmo
BigSimmo enabled auto-merge (squash) July 30, 2026 06:31
@BigSimmo
BigSimmo disabled auto-merge July 30, 2026 06:41
…d-style-proof

# Conflicts:
#	docs/outstanding-issues.md
@BigSimmo

Copy link
Copy Markdown
Owner Author

@cursoragent fix failing merge conflict

@cursor

cursor Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Merge conflict fixed and pushed.

Cause: docs/outstanding-issues.md — both sides appended different open rows after #116.

Resolution (kept both, in ID order):

  • From main: #120#122 (phone-chrome exit, Playwright image lag, CircleCI)
  • From this branch: #123#124 (worktree redirect, next-id race)

Result:

  • Commit 6b045e58 on claude/design-computed-style-proof
  • PR #1415 is MERGEABLE again (git merge-tree clean)
  • check:outstanding-issues passed (next-id=125)
  • CI has re-queued on the new head
Open in Web Open in Cursor 

Resolve the content conflict in docs/outstanding-issues.md by retaining
main's #120#122 (phone-chrome exit, Playwright image lag, CircleCI)
alongside this branch's #123#124 (worktree redirect, next-id race).

Co-Authored-By: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/branch-review-ledger.md`:
- Line 1325: Update the ledger entry for claude/design-computed-style-proof to
replace the stale issue references `#116` and `#117` with `#123` for worktree
redirection and `#124` for concurrent ID collisions, preserving the surrounding
record and traceability details.

In `@docs/outstanding-issues.md`:
- Line 160: Update the `#124` issue title to match the evidence in its supporting
detail by replacing the narrower “same hour” claim with “when agents work
concurrently.” Keep the documented collision examples and all other row content
unchanged.

In `@scripts/check-design-system-contract.mjs`:
- Around line 241-259: Update the UNLAYERED_EFFECT_SELECTORS validation loop to
inspect every occurrence of each selector, rather than relying on the first
match from pattern.exec. Assert that each occurrence has no enclosing `@layer`
rule, while preserving the existing missing-rule assertion and diagnostic
context from enclosingAtRules.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a68b8854-3cd4-409c-a600-a0ca1047510a

📥 Commits

Reviewing files that changed from the base of the PR and between 90b3e34 and 6b045e5.

📒 Files selected for processing (4)
  • docs/branch-review-ledger.md
  • docs/outstanding-issues.md
  • scripts/check-design-system-contract.mjs
  • tests/ui-smoke.spec.ts

Comment thread docs/branch-review-ledger.md Outdated
Comment thread docs/outstanding-issues.md
Comment thread scripts/check-design-system-contract.mjs
@BigSimmo
BigSimmo enabled auto-merge (squash) July 30, 2026 07:16
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 3 file(s) based on 3 unresolved review comments.

A stacked PR containing fixes has been created.

  • Stacked PR: #1425
  • Files modified:
  • docs/branch-review-ledger.md
  • docs/outstanding-issues.md
  • scripts/check-design-system-contract.mjs

Time taken: 4m 21s

BigSimmo and others added 6 commits July 30, 2026 15:47
…d-style-proof

# Conflicts:
#	docs/outstanding-issues.md
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@BigSimmo
BigSimmo disabled auto-merge July 30, 2026 08:01
@BigSimmo
BigSimmo enabled auto-merge (squash) July 30, 2026 08:02
@BigSimmo

Copy link
Copy Markdown
Owner Author

Superseded by #1404 at 84c1f6d83d85b1d7f78a7daf1e5b4c9beb267871. The unique value from this PR is preserved there: the accent rail must resolve to --clinical-accent, remain distinct from the side borders, render 3px under forced colors, and keep tap-sized minimum heights effective. #1404's dedicated production-build Chromium gate passed both style-contract tests. Its registry/parser already supplies the broader unlayered-rule guard, so this duplicate PR can close without losing coverage.

@BigSimmo BigSimmo closed this Jul 30, 2026
auto-merge was automatically disabled July 30, 2026 08:19

Pull request was closed

@BigSimmo
BigSimmo deleted the claude/design-computed-style-proof branch July 30, 2026 09:10
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