mirror of
https://github.com/hanzoai/ci.git
synced 2026-10-27 09:19:34 +00:00
The dashboard carried its own :root block — a hand-copy of the house palette, and being a copy it had already drifted off it. The status colours were GitHub Primer's (#3fb950 / #f85149 / #d29922) where the house says #10b981 / #ef4444 / #f59e0b. Every surface black was a shade wrong and blue-tinted (#0b0b0d) against a scale that is strictly neutral (--surface-0 #080808). The hairline border was an opaque #25252b where the house hairline is a 6% white wash. The font stacks named neither Geist Sans nor JetBrains Mono. Of nine colours exactly one — the accent — still matched. That is what a second component source looks like a few months in, and it is why this page had to stop being one. The values now come from @hanzo/brand, and they arrive as that package's own published artifact rather than as hex codes retyped here: styles/variables.css, which it ships as a plain custom-property sheet (exports["./styles/*"], documented for a bare <link>), vendored verbatim and go:embed-ed. dashboard.css holds what is left over — layout: what is a row, what sticks, what collapses on a phone — and names no colour, radius or type size of its own. Not a @hanzo/gui port, deliberately. gui is React over Tamagui and needs a bundler, which would put npm and a JS build on the path that ships the board you read when the builds are broken, and would trade one request that returns the answer for a shell that fetches it a second later. What this page ever needed from the design system was its token vocabulary, not its components — and gui's own shell reads these same var(--hanzo-*) names, so a Go binary and a React app now spend one vocabulary from one source. go.mod stays empty; the image stays the binary and a CA bundle. Two offline gates keep it honest, because vendoring alone would only move the copy rather than end it: - TestBrandCSSIsUpstreamBytes pins the sheet to the sha256 of the version it claims to be. Without it, "just darken that one border" is a one-character local edit that silently rebuilds the second palette and nothing ever catches it. This is go.sum's argument. - TestDashboardCSSNamesNoColours fails on any hex or rgb() the page writes for itself. The old :root block did not arrive wrong; it arrived one reasonable exception at a time. Neither gate touches the network, so proving we use one design system costs the pipeline no npm and no registry. TestRenderedPageShowsOnlyTheViewersOrg additionally pins at the HTML layer what scope_test.go pins at the predicate layer: a lux viewer's rendered page contains no other org's rows and no other org's name in the nav. The renderer is where that leak lived, and it is now the renderer that is asserted. Rendered and checked in a browser, not just compiled: every token resolves (surface-0 #080808, text-primary #fafafa, accent-muted #a78bfa, success/error/warning #10b981/#ef4444/#f59e0b, hairline rgba(255,255,255, .06), radius-card 8px, JetBrains Mono), color-scheme comes out dark via the sheet's own .dark hook, and header, chips, nav, table and footer now sit on one --space-6 gutter instead of the table drifting 12px left. Co-authored-by: Hanzo Dev <[email protected]>
56 lines
2.5 KiB
Go
56 lines
2.5 KiB
Go
package main
|
|
|
|
import (
|
|
_ "embed"
|
|
"html/template"
|
|
)
|
|
|
|
// brand.go — where this page's design values come from.
|
|
//
|
|
// They come from @hanzo/brand, the one place the fleet's palette, radii, type
|
|
// scale and spacing are defined, and they arrive as that package's OWN
|
|
// published artifact rather than as hex codes retyped here. The distinction is
|
|
// the entire point. Until this file existed the template carried its own
|
|
// :root block, and being a hand-copy it had already drifted off the house:
|
|
// the status colours were GitHub Primer's (#3fb950 / #f85149 / #d29922) where
|
|
// the house says #10b981 / #ef4444 / #f59e0b, the surface blacks were each a
|
|
// shade wrong (#0b0b0d against --surface-0 #080808), and the hairline border
|
|
// was a solid #25252b where the house hairline is a 6%-white wash. Only the
|
|
// accent survived intact. A palette that is copied is a palette that diverges.
|
|
//
|
|
// Vendored, not fetched at build time, and compiled in rather than served off
|
|
// disk. @hanzo/brand publishes this file as a plain custom-property sheet
|
|
// (`exports["./styles/*"]`, documented for a bare <link>), so consuming it
|
|
// costs no npm, no bundler and no React — the image build stays `go build`
|
|
// against an empty go.mod, and the page stays one request that returns the
|
|
// answer. That matters here more than anywhere: this dashboard is read when
|
|
// the build system is broken, which is the worst possible moment for it to
|
|
// need the build system in order to draw itself.
|
|
//
|
|
// Refreshing is a deliberate, reviewed act — fetch, then update the pin:
|
|
//
|
|
// curl -sSfo brand/variables.css https://unpkg.com/@hanzo/brand@<version>/styles/variables.css
|
|
//
|
|
//go:embed brand/variables.css
|
|
var brandCSS string
|
|
|
|
// brandCSSVersion and brandCSSSHA256 record WHICH @hanzo/brand the bytes above
|
|
// are, and a test rejects any other bytes. This is go.sum's argument, not
|
|
// ceremony: without it, "just darken that one border" is a one-character local
|
|
// edit that silently restores the second source of truth this file removed, and
|
|
// nothing would ever catch it.
|
|
const (
|
|
brandCSSVersion = "1.4.5"
|
|
brandCSSSHA256 = "941dfc0080343d25dc1ef2cd780290a2d8fe6cbd81136912281902f2e8e7741f"
|
|
)
|
|
|
|
// dashboardCSS is what this page adds on top: layout, not design. Every colour,
|
|
// radius and size in it is a var() into the sheet above.
|
|
//
|
|
//go:embed dashboard.css
|
|
var dashboardCSS string
|
|
|
|
// pageCSS is the <style> body: tokens first, then the rules that spend them.
|
|
// template.CSS because these are two compile-time constants, never input.
|
|
func pageCSS() template.CSS { return template.CSS(brandCSS + dashboardCSS) }
|