From 33a7bd452c1bf4e69490e5645f863f25cf5e154c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 31 Aug 2026 02:22:34 +0000 Subject: [PATCH] feat(brand): draw the small-size optical cut at chrome sizes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The follow-up recorded in PR #2462 and deliberately left undone there, now that the artwork decision has been made: the app rendered the mark's *display* geometry at every size, including the 28-32px chrome where the brand's own construction calls for a different cut. **Why this is the real fix.** The mark is a construction, not a bitmap, so it does not simply get smaller. Two pieces of its negative space close up first — the 4.2-unit cut between the strokes and the 7.26-unit crescent around the point — and when the crescent closes, the dot fuses into the S. That fuses the top of the mark into one solid blob above a lower stroke that is already the thinner read, which is exactly the top-heavy look this branch previously compensated for with the deeper `--brand-mark-emphasis` ink. The ink stays; the cause is now addressed rather than offset. `docs/brand/psychsift-logo.md` §"Small sizes" already specifies the remedy and `brand-mark.ts` already ships it: `BRAND_STROKE_PATH_SMALL` opens the cut to 7.2 units and `BRAND_POINT_SMALL` slides the point 10 units out of its cradle, opening the crescent from 7.26 to 11.55. Only the favicon and the raster icon routes used them. Nothing in the app did. **The one thing that did not exist, and how it was derived rather than drawn.** The bare (untiled) glyph had no small-size placement. `brand-mark.ts` says in terms not to redraw the construction by hand, and this does not: the doc fixes both ink boxes (display spans 0-55.33, chrome 0-65.33, both 0-100.38 tall) and every committed placement centres that box in the 512 viewBox — verified against all three, each landing on 256.000 within 0.003, the rounding of a two-decimal box figure. Two consequences follow arithmetically. The point keeps its `cy` and `r`, so the vertical extent is identical and the scale is unchanged at 5.1006 (100.3813 x 5.1006 = 512.0, which is the bare variant's whole purpose). The point moves exactly 10 units and is the box's right edge, so the box widens by 10 and its centre by 5: 114.8907 - 5 x 5.1006 = 89.3877. The same arithmetic reproduces the committed tiled pair (143.1125 - 5 x 4.0804 = 122.7103, as shipped), which is the check that this is the rule actually in use rather than one that merely fits. **Threshold.** 32px, from the doc's own "at 32 px and below two things close up". Sub-32px production sites now draw the chrome cut: the collapsed sidebar rail (28px), the phone drawer header (28/32px), the account-setup workspace mark (32px), and the ward sidebar glyph (32px). Everything at 36px and above keeps the display cut. Design-scratch mockups are untouched. The three pieces are selected together through one `brandMarkOptics()` call, so a caller cannot half-apply the variant — the doc is explicit that mixing one variant's point with the other's placement puts the glyph off-centre. Verification - `tests/brand-mark-optics.test.ts` — 14 passed. Every rule mutation-tested with the failure predicted before running: dropping `optical="chrome"` from a 28px site, adding it to a 40px one, shifting the new transform 5px off centre, and pairing the chrome placement with the display point each failed exactly the intended assertion; all four restored byte-identical. - Writing that test surfaced a defect in the test itself, fixed before it could mislead: `ward-management-navigation.tsx` imports two CSS modules that BOTH define `.brandGlyph`, at 2.5rem and 2rem, so an identifier-blind resolver merged them and reported real sites as spanning the threshold. It now resolves the specific import. It also caught `sidebar-live-mockup.tsx` — design scratch named with the singular `-mockup`, which the usual `mockups` filter misses. - `npm run brand:check` — `src/app/icon.svg matches the brand-mark source` (this adds exports; it changes no existing value, so the generated assets are untouched). - Design-system contract passed, every ratchet at or under baseline; adoption 55 components / 84 roots; design-sync contract 55 components / 7 guidelines. - Full unit suite: `11744 passed | 1 skipped` across 931 files. Three pre-existing failures in `clinical-hazard-controls`, `privacy-readiness-contract` and `rag-plan-package-parity` — none touches brand geometry, and CI's Unit coverage passed these on the previous PR, so they are container-local. - Lint clean at `--max-warnings 0`; typecheck exit 0, unscoped; whole-tree format committed with the work. RAG impact: no retrieval behaviour change - this diff touches no file under src/lib/rag/** and none of the protected ranking surfaces (clinical-search, retrieval-selection, released-search-order, ranking-config, answer-ranking, answer-verification), adds no comparator key, and leaves the golden fixture and eval harness untouched. Verified by listing the diff's paths against that set. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01YRGeyyiZNrXnFJjVVnykgp --- .../clinical-dashboard/ClinicalSidebar.tsx | 12 +- .../account-setup-dialog.tsx | 2 +- src/components/clinical-dashboard/brand.tsx | 45 ++-- .../ward-management-navigation.tsx | 4 +- .../ward-management/ward-sidebar-content.tsx | 2 +- src/lib/brand-mark.ts | 50 +++++ tests/brand-mark-optics.test.ts | 192 ++++++++++++++++++ 7 files changed, 287 insertions(+), 20 deletions(-) create mode 100644 tests/brand-mark-optics.test.ts diff --git a/src/components/clinical-dashboard/ClinicalSidebar.tsx b/src/components/clinical-dashboard/ClinicalSidebar.tsx index 73c2c298a..5d9966ec2 100644 --- a/src/components/clinical-dashboard/ClinicalSidebar.tsx +++ b/src/components/clinical-dashboard/ClinicalSidebar.tsx @@ -936,14 +936,14 @@ function ClinicalCollapsedRail({
{collapseLocked ? ( ) : ( <> {/* Tablet: the expanded panel does not exist below lg, so show a static brand mark instead of a dead expand control. */}