fix(webui): pin the dashboard validators to the control plane's

ui/src/settings/validation.ts hand-mirrors three control-plane validators with
no shared source, and the model-role rule had already diverged: the dashboard
required a stricter regex while the server only asks for a slash, so it refused
values the server accepts.

Add a shared fixture (internal/app/controlplane/testdata/dashboard-validators.json)
that both sides run through their real implementations: a Go test over the
server validators and ui/test/control-plane-validator-parity.test.ts over the
dashboard ones. Either side changing a rule alone now fails the other's test.

Fix the diverged rule to mirror the server's predicate exactly (non-blank role,
model containing a slash), so an empty or whitespace-padded model is judged the
same way the control plane judges it. Regenerate ui/dist and the dev-docs
artifact.
This commit is contained in:
sam committed 2026-10-02 11:59:17 +10:00
1 parent 92eabbed17
commit 656d21520f
8 files changed
+427 -68

No files matched your search

+9
View File
@@ -43,6 +43,15 @@ and a decision record for when it is deliberately not enough:
draft state, copy conditions, filters and payload building live in plain
`.ts` files beside the components and are tested in `ui/test/`. Components
stay thin, so there is normally nothing in an SFC that is archie logic.
- **A dashboard rule that mirrors a server rule is pinned by a shared
fixture, not two independent tests.** `ui/src/settings/validation.ts`
hand-mirrors three control-plane validators, and the model-role rule had
already drifted because nothing tied the two sides together. Each case now
lives once in `internal/app/controlplane/testdata/dashboard-validators.json`:
a Go test in that package runs the real server validators over it, and
`ui/test/control-plane-validator-parity.test.ts` runs the real dashboard
validators over the same cases. Changing one rule alone fails the other
side's test. Add a case to the fixture, never to one side only.
- **Installed primitives are upstream-tested, not re-tested here.**
`reka-ui` (2.10.5 here) maintains colocated tests per component in its own
repo (Vitest/jsdom + axe: Switch, TagsInput, NumberField, Select, the