bootstrap: brandkit-seam — the pure brandkit package + golden corpus #27

Closed
opened 2026-07-25 04:54:10 +00:00 by ben · 1 comment
Owner

Parent

Wayfinder map: #7 — the engineering foundation (PROCESS.md Phase 2½, emitted as DAG root slices).

What to build

The pure brandkit Go package — the single authority behind which the brand kit (DDR 0007) reaches every surface (the seam contract in docs/seams/theming.md, deciding for ADR 0035 status tokens and ADR 0038's kanidm boundary). Three coordinated pieces, one authority: brand-kit.schema.json (the canonical kit shape the operator's edits validate against), the brandkit package itself (the only place any theming computation lives — preset expansion, derived tokens, contrast-safe picks, per-surface projection, coverage), and the compiled static artifacts render-time consumers load as a file and never re-derive. TypeScript never computes a token.

Compile is THE seam operation and must be pure and deterministic — no I/O, no clock, so equal Kits produce byte-identical Artifacts and re-application is idempotent; it errors only on an invalid Kit or a Surface bug, never on an unrenderable token (that is a Coverage outcome). A Surface is one theming target with a closed Capability token set; adding a surface is implementing that contract and nothing else moves. Validate is called before persisting and returns contrast shortfalls as Diagnostics (warnings), never blocking founding on a colour choice. Coverage Report makes DDR 0007's accepted uneven fidelity inspectable.

Notes: the golden (Kit → Artifacts, Report) corpus is part of this slice — the deterministic-compile fixtures the design-verify seam tests hang off — together with the ADR 0038 boundary encoded as a test: idp-login's capability is {brand.name, logo.mono} and admits no color.* token, structurally unreachable rather than filtered by convention. The two thin transports (the helper's stdio preview, the control plane's POST /brand/compile-preview) land with their consuming feature slices, not here — this slice is the pure package plus its corpus.

Acceptance criteria

  • Given the seam contract, when the package is built, then brand-kit.schema.json, Validate, Compile, the Surface contract, Registry, and the coverage Report all exist as specified.
  • Given two equal Kits, when Compile runs, then it produces byte-identical Artifacts with no I/O or clock (idempotent, an unchanged kit never churns a surface), erroring only on an invalid Kit or a Surface bug.
  • Given the golden corpus, when the seam tests run, then the (Kit → Artifacts, Report) fixtures pass.
  • Given the ADR 0038 boundary, when the boundary test runs, then idp-login's capability admits {brand.name, logo.mono} and no color.* token — reading outside the narrowed DictView fails.
  • Given a kit with a contrast shortfall, when Validate runs, then the shortfall is a Diagnostic (warning), never an error that blocks founding.

Blocked by

  • #23 — needs the Go workspace + dev shell.

Task manifest

task: bootstrap:brandkit-seam
implements_seam: docs/seams/theming.md
implements_edge: —   # engineering slice; no flow edge
wireframe: —         # no wireframe; the seam contract IS the design
interface: brandkit — brand-kit.schema.json, Validate(Kit) []Issue,
  Compile(Kit, Registry) (Artifacts, Report, error) [pure, deterministic],
  the Surface contract (ID/Capability/Render) + Registry, and the coverage Report
seam: brandkit seam tests (Go) — the golden (Kit -> Artifacts, Report) corpus plus a
  unit test asserting idp-login admits no color.* token (ADR 0038 as a test)
acceptance:
  - given: the seam contract
    when: the package builds
    then: brand-kit.schema.json, Validate, Compile, the Surface contract, Registry, and Report exist as specified
  - given: two equal Kits
    when: Compile runs
    then: it yields byte-identical Artifacts with no I/O or clock, erroring only on an invalid Kit or Surface bug
  - given: the golden corpus
    when: the seam tests run
    then: the (Kit -> Artifacts, Report) fixtures pass
  - given: the ADR 0038 boundary
    when: the boundary test runs
    then: idp-login's capability admits {brand.name, logo.mono} and no color.* token, reads outside the DictView fail
  - given: a kit with a contrast shortfall
    when: Validate runs
    then: the shortfall is a Diagnostic warning, never a blocking error
depends_on: [skeleton]
out_of_scope: [the helper stdio + control-plane compile-preview transports (land with
  their consuming feature slices), Settings/founding kit-edit UIs (their features), a
  parallel TS re-implementation (rejected — highest drift risk)]
needs_human_decision: []
## Parent Wayfinder map: #7 — the engineering foundation (PROCESS.md Phase 2½, emitted as DAG root slices). ## What to build The pure `brandkit` Go package — the single authority behind which the brand kit (DDR 0007) reaches every surface (the seam contract in `docs/seams/theming.md`, deciding for ADR 0035 status tokens and ADR 0038's kanidm boundary). Three coordinated pieces, one authority: `brand-kit.schema.json` (the canonical kit shape the operator's edits validate against), the `brandkit` package itself (the only place any theming computation lives — preset expansion, derived tokens, contrast-safe picks, per-surface projection, coverage), and the compiled static artifacts render-time consumers load as a file and never re-derive. TypeScript never computes a token. `Compile` is THE seam operation and must be pure and deterministic — no I/O, no clock, so equal `Kit`s produce byte-identical `Artifacts` and re-application is idempotent; it errors only on an invalid Kit or a Surface bug, never on an unrenderable token (that is a `Coverage` outcome). A `Surface` is one theming target with a closed `Capability` token set; adding a surface is implementing that contract and nothing else moves. `Validate` is called before persisting and returns contrast shortfalls as Diagnostics (warnings), never blocking founding on a colour choice. Coverage `Report` makes DDR 0007's accepted uneven fidelity inspectable. Notes: the golden `(Kit → Artifacts, Report)` corpus is part of this slice — the deterministic-compile fixtures the `design-verify` seam tests hang off — together with the ADR 0038 boundary encoded as a test: `idp-login`'s capability is `{brand.name, logo.mono}` and admits no `color.*` token, structurally unreachable rather than filtered by convention. The two thin transports (the helper's stdio preview, the control plane's `POST /brand/compile-preview`) land with their consuming feature slices, not here — this slice is the pure package plus its corpus. ## Acceptance criteria - [ ] Given the seam contract, when the package is built, then `brand-kit.schema.json`, `Validate`, `Compile`, the `Surface` contract, `Registry`, and the coverage `Report` all exist as specified. - [ ] Given two equal `Kit`s, when `Compile` runs, then it produces byte-identical `Artifacts` with no I/O or clock (idempotent, an unchanged kit never churns a surface), erroring only on an invalid Kit or a Surface bug. - [ ] Given the golden corpus, when the seam tests run, then the `(Kit → Artifacts, Report)` fixtures pass. - [ ] Given the ADR 0038 boundary, when the boundary test runs, then `idp-login`'s capability admits `{brand.name, logo.mono}` and no `color.*` token — reading outside the narrowed `DictView` fails. - [ ] Given a kit with a contrast shortfall, when `Validate` runs, then the shortfall is a Diagnostic (warning), never an error that blocks founding. ## Blocked by - #23 — needs the Go workspace + dev shell. ## Task manifest ```yaml task: bootstrap:brandkit-seam implements_seam: docs/seams/theming.md implements_edge: — # engineering slice; no flow edge wireframe: — # no wireframe; the seam contract IS the design interface: brandkit — brand-kit.schema.json, Validate(Kit) []Issue, Compile(Kit, Registry) (Artifacts, Report, error) [pure, deterministic], the Surface contract (ID/Capability/Render) + Registry, and the coverage Report seam: brandkit seam tests (Go) — the golden (Kit -> Artifacts, Report) corpus plus a unit test asserting idp-login admits no color.* token (ADR 0038 as a test) acceptance: - given: the seam contract when: the package builds then: brand-kit.schema.json, Validate, Compile, the Surface contract, Registry, and Report exist as specified - given: two equal Kits when: Compile runs then: it yields byte-identical Artifacts with no I/O or clock, erroring only on an invalid Kit or Surface bug - given: the golden corpus when: the seam tests run then: the (Kit -> Artifacts, Report) fixtures pass - given: the ADR 0038 boundary when: the boundary test runs then: idp-login's capability admits {brand.name, logo.mono} and no color.* token, reads outside the DictView fail - given: a kit with a contrast shortfall when: Validate runs then: the shortfall is a Diagnostic warning, never a blocking error depends_on: [skeleton] out_of_scope: [the helper stdio + control-plane compile-preview transports (land with their consuming feature slices), Settings/founding kit-edit UIs (their features), a parallel TS re-implementation (rejected — highest drift risk)] needs_human_decision: [] ```
Author
Owner

Done — shipped in commit b56b6eb (sandcastle: bootstrap:brandkit-seam #27).

The pure brandkit Go package lives at internal/brandkit/, built test-first at the manifest's seam (brandkit seam tests (Go) — the golden (Kit → Artifacts, Report) corpus + the ADR 0038 boundary test).

Acceptance criteria — all met:

  • ✅ Package exists as specified — brand-kit.schema.json (embedded via go:embed), Validate, Compile, the Surface/Capability/DictView contract, Registry, and the coverage Report (kit.go, token.go, validate.go, compile.go, surface.go).
  • ✅ Deterministic, idempotent Compile — Compile is pure/no-I/O/no-clock (package imports only embed/errors/fmt/math/sort/strings); two equal Kits produce byte-identical Artifacts (TestCompile_DeterministicByteIdentical), erroring only on an invalid Kit or a Surface bug (TestCompile_RejectsInvalidKit, TestCompile_ErrorsOnSurfaceBug), never on an unrenderable token (TestCompile_UnrenderableTokenIsCoverageNotError).
  • ✅ Golden corpus passes — internal/brandkit/testdata/golden/*.snapshot, four fixtures (explicit palette, preset expansion, per-service extras, contrast shortfall) driven by TestCompile_GoldenCorpus (regen: go test ./internal/brandkit -update).
  • ✅ ADR 0038 boundary as a test — idp-login's capability is exactly {brand.name, logo.mono}, admits no color.*, and reading a colour from its narrowed DictView fails with ErrOutsideCapability (TestIdpLoginBoundary); proven end-to-end that the compiled kanidm fragment never contains the accent (TestCompile_IdpLoginArtifactHasNoColour).
  • ✅ Contrast shortfall is a Diagnostic — Validate returns it as a warning, never a blocking error, and such a kit still compiles (TestValidate_ContrastShortfallIsWarningNotError).

Six v1 surfaces registered (portal, dashboard, operator-app, idp-login, svc:nextcloud, svc:mattermost); the four-way coverage Report makes DDR 0007's uneven fidelity inspectable (Mattermost's single accent honestly Downgraded).

Verified: go build/vet ./..., go test ./internal/brandkit (all green), golangci-lint run clean.

Out of scope (deferred to their consuming feature slices, per the manifest): the helper stdio preview + control-plane POST /brand/compile-preview transports, the Settings/founding kit-edit UIs, and any parallel TS re-implementation.

STATUS.md and docs/slices/bootstrap.yaml (brandkit-seam → status: done) updated in the same commit.

Done — shipped in commit `b56b6eb` (`sandcastle: bootstrap:brandkit-seam #27`). The pure `brandkit` Go package lives at `internal/brandkit/`, built test-first at the manifest's seam (`brandkit seam tests (Go)` — the golden `(Kit → Artifacts, Report)` corpus + the ADR 0038 boundary test). **Acceptance criteria — all met:** - ✅ *Package exists as specified* — `brand-kit.schema.json` (embedded via `go:embed`), `Validate`, `Compile`, the `Surface`/`Capability`/`DictView` contract, `Registry`, and the coverage `Report` (`kit.go`, `token.go`, `validate.go`, `compile.go`, `surface.go`). - ✅ *Deterministic, idempotent Compile* — `Compile` is pure/no-I/O/no-clock (package imports only `embed`/`errors`/`fmt`/`math`/`sort`/`strings`); two equal `Kit`s produce byte-identical `Artifacts` (`TestCompile_DeterministicByteIdentical`), erroring only on an invalid Kit or a Surface bug (`TestCompile_RejectsInvalidKit`, `TestCompile_ErrorsOnSurfaceBug`), never on an unrenderable token (`TestCompile_UnrenderableTokenIsCoverageNotError`). - ✅ *Golden corpus passes* — `internal/brandkit/testdata/golden/*.snapshot`, four fixtures (explicit palette, preset expansion, per-service extras, contrast shortfall) driven by `TestCompile_GoldenCorpus` (regen: `go test ./internal/brandkit -update`). - ✅ *ADR 0038 boundary as a test* — `idp-login`'s capability is exactly `{brand.name, logo.mono}`, admits no `color.*`, and reading a colour from its narrowed `DictView` fails with `ErrOutsideCapability` (`TestIdpLoginBoundary`); proven end-to-end that the compiled kanidm fragment never contains the accent (`TestCompile_IdpLoginArtifactHasNoColour`). - ✅ *Contrast shortfall is a Diagnostic* — `Validate` returns it as a warning, never a blocking error, and such a kit still compiles (`TestValidate_ContrastShortfallIsWarningNotError`). Six v1 surfaces registered (portal, dashboard, operator-app, idp-login, svc:nextcloud, svc:mattermost); the four-way coverage `Report` makes DDR 0007's uneven fidelity inspectable (Mattermost's single accent honestly `Downgraded`). **Verified:** `go build/vet ./...`, `go test ./internal/brandkit` (all green), `golangci-lint run` clean. **Out of scope** (deferred to their consuming feature slices, per the manifest): the helper stdio preview + control-plane `POST /brand/compile-preview` transports, the Settings/founding kit-edit UIs, and any parallel TS re-implementation. `STATUS.md` and `docs/slices/bootstrap.yaml` (`brandkit-seam` → `status: done`) updated in the same commit.
ben closed this issue 2026-07-25 06:44:23 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#27
No description provided.