A local-first multi-agent app development platform, built on PenguinHarness
The shared UI package gains its test harness and de-slop guards, and the web style guards scan both source roots
- Date: 2026-09-16
- Type: process
- Scope:
ui,web - PR: #762
The theme system's shared UI package (@prismshadow/penguin-ui) gained a Node-only test suite
that judges the theme files by their computed values and holds the package and the Web App to the
theme work's de-slop rules, and the Web App's style-guard tests were made to scan packages/ui/src
beside packages/web/src, failing by name when either root yields no files instead of passing over
nothing as components move between the two.
Package tests
token-contract: every theme × mode (light, dark) defines every name intokens.ts— the base rule, plus the dark rule in dark — inside@layer ui-themeon the canonical selectors, once each, with nothing outside the contract, and a dark rule never repeats a base value; a non-default theme also re-points all eleven gray steps. The contract holds 188 names, with--ui-radius-control(bridged asrounded-control),--ui-stack-0and--ui-stack-4and without--ui-glass-highlightor--ui-fg-on-emphasis, and every--ui-*name spelled in the package, the Web App or the gallery (stylesheets and string literals) must be a contract name. The Web App's and the gallery's entry stylesheets importthemes/github.cssbefore the other two themes, whose dark rules rely on that order.contrast: WCAG 2 ratios resolved from the theme CSS — text on every surface (4.5:1), tone inks on the page surfaces (3:1,neutralexempt), tone text on its tint and solid-badge labels (4.5:1), and the accent label on the theme accent and on every user preset (4.5:1). Shortfalls are recorded in an exception list that fails once an entry starts passing.no-app-stringsandno-theme-reads: the package imports nothing from the web app's dictionaries, and nothing outside the theme machinery reads the theme id.demo-coverage: every component directory carries a*.demo.tsx, with an empty exemption list.font-licenses: every font dependency has its licence mirrored undersrc/fonts/LICENSES/, matching the installed package's text, and every font the stylesheets load comes from one. A font with no package, listed insrc/fonts/vendored-fonts.json, may ship only as woff2 slices in its own directory, with a licence text inLICENSES/that names its title; TTF and OTF files are refused everywhere.boot-script:BOOT_SCRIPTpaints whatapplyThemeAttributeswould for every combination of stored preferences, andpackages/web/index.htmlcarries it verbatim.- A theme file that is still a stub, a package with no fonts or components yet, and an index.html with no inline script are reported as named skipped cases rather than passes.
De-slop guards
src/testing/deslop.tsreads Tailwind classes out of the TypeScript AST (string literals and template text, never comments) and out of@applylists, with each JSX element's classes, direct children and enclosing component, and checks 22 rules: transitions name colour, opacity or shadow properties (transforms only in the chevron and the sheet, launcher and drawer files); no hover or press transforms;duration-150/duration-200or the duration tokens; nested radii; borders on clipping rounded boxes; halos and pulses on status marks; icons on a tint of their own ink; coloured left-border callouts; a tone's tint beside the same tone's line; mood words in badges; one spinner file and noborder-t-transparent; gaps, stacks and padding on the rhythm steps; no literal text sizes;uppercaseand wide tracking only through the eyebrow and display hooks, and no eyebrow directly above a heading; tabular figures in stat chips, counts and key-value values; no mono in button, nav, heading or menu labels; no bordered surface inside another; no gradient or backdrop blur without a job; shadows from the shadow tokens; colours from tokens; no emoji in dictionaries or fixtures; no eyebrow on a page header.packages/ui/test/deslop.test.tsruns every check overpackages/ui/srcwith an empty allowlist, and checks the theme files' heading tokens: no h2–h5 is uppercased and no heading is set in mono.packages/web/test/deslop.test.tsruns the same checks overpackages/web/srcagainst an allowlist of the 374 hits the app held in 96 files, counted exactly per file and rule, each entry naming the wave that removes it; palette classes are not checked in the Web App.packages/ui/test/hooks.test.tsholds the package, the Web App and the gallery to the six style hooks ofsrc/hooks.ts, allows each hook only inside the components that host it, and checks the markup the recipes select on:data-liveon.ui-live,.ui-displayon an h1, andhead,body,footorpaneslots in.ui-frame.
Test helpers
src/testing/gained a source-root scanner with per-root file counts, a CSS rule reader, a theme-file analyzer that resolvesvar()through the theme cascade, colour parsing (hex,rgb(),hsl(),oklch(),color-mix(in srgb, …)) with WCAG contrast, static-render helpers and the de-slop rule engine.packages/uigained avitest.config.ts; itstestscript no longer passes on an empty suite.
Web guards
packages/web/test/helpers/roots.tsnames the two source roots and providesexpectEveryRootScanned,sourceFileandexpectSingleHome.- The 21 style guards —
control-size,icon-scale,tone,disclosure-anchor,disclosure-body,company-click-targets,required-mark,info-popover,help-fold,title-reveal,session-activity,session-row-menu,company-beta,todo-notice,modal-focus,esc-layers,portal-panel-dismiss,context-menu,inner-html-stability,group-list,autofill— scan both roots, assert each yielded files, and assert every module they read lives in exactly one place; files are named by repo-relative path. GlyphIcondraws its stroke from--ui-icon-strokewith a 1.7 fallback, andicon-scaleasserts that and checks each theme's token against the line-family weights 1.7 / 1.6 / 1.4.