@micha.bigler/ui-core-micha 3.9.1 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/DESIGN.md +11 -0
- package/README.md +16 -0
- package/WORK_ORDERS.md +6 -2
- package/dev/main.jsx +3 -3
- package/dist/index.js +2 -0
- package/dist/testing/checkKitIntegration.js +201 -0
- package/dist/theme/createAppTheme.js +123 -20
- package/dist/theme/themeCompleteness.js +13 -7
- package/dist/theme/tokens.js +42 -0
- package/docs/DARK-TOKENS.md +140 -0
- package/package.json +1 -1
- package/src/index.js +3 -0
- package/src/testing/checkKitIntegration.js +233 -0
- package/src/theme/createAppTheme.js +139 -12
- package/src/theme/themeCompleteness.js +10 -4
- package/src/theme/tokens.js +72 -0
- package/tests/checkKitIntegration.test.jsx +219 -0
- package/tests/createAppThemeDark.test.js +127 -0
- package/tests/createAppThemeLightGuard.test.js +40 -0
- package/tests/fixtures/light-theme-baseline.json +2228 -0
- package/work-orders/UCM-I18N-5.md +80 -0
- package/work-orders/UCM-TEST-1.md +304 -0
- package/work-orders/UCM-THEME-14.md +178 -8
- package/work-orders/assets/UCM-THEME-13-dark-prototype.html +390 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# UCM-I18N-5 — User-list pagination range text is hard-coded English
|
|
2
|
+
|
|
3
|
+
# A. Envelope — authored by the Expertenchat
|
|
4
|
+
|
|
5
|
+
## Goal & expected outcome
|
|
6
|
+
|
|
7
|
+
- Goal: the user list's pagination reads in the user's language.
|
|
8
|
+
- Expected outcome: `UserListComponent`'s `TablePagination` renders its "1–4 of 4" text through a
|
|
9
|
+
translation key (de/en/fr and every locale the bundles carry), the way `labelRowsPerPage`
|
|
10
|
+
already does.
|
|
11
|
+
|
|
12
|
+
## Context — measured 2026-10-01 in jg-ferien's local browser (ucm 3.7.0 installed there)
|
|
13
|
+
|
|
14
|
+
- `/account?tab=users` in German: "Zeilen pro Seite: 25 ▾ · **1–4 of 4**". `UserListComponent.jsx`
|
|
15
|
+
(~l.589-600) sets `labelRowsPerPage={t('UserList.ROWS_PER_PAGE', …)}` but no
|
|
16
|
+
`labelDisplayedRows`, so MUI's English default renders. It is the only `TablePagination` in ucm.
|
|
17
|
+
- Follows `UCM-I18N-4` (hard-coded English in the user list).
|
|
18
|
+
|
|
19
|
+
## Scope + non-goals
|
|
20
|
+
|
|
21
|
+
- In scope: `labelDisplayedRows` via a key with count interpolation; tests; release.
|
|
22
|
+
- Explicit non-goals / do-not-touch: no other change to the user list.
|
|
23
|
+
|
|
24
|
+
## Tier · gates
|
|
25
|
+
|
|
26
|
+
- **Tier 3** — change inside shared-core (small).
|
|
27
|
+
- Done means released AND jg-ferien's pin bumped.
|
|
28
|
+
|
|
29
|
+
## Risks
|
|
30
|
+
|
|
31
|
+
- The "more than" form (`count === -1`) must have a wording too, or it renders "of -1".
|
|
32
|
+
|
|
33
|
+
## Required tests to WRITE (you write them and run YOUR OWN new ones; the orchestrator's run is the gate)
|
|
34
|
+
|
|
35
|
+
1. In `de`, the pagination shows the German range text; in `en` the English one.
|
|
36
|
+
2. Key-parity: every locale bundle has the new key.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
# B. Implementation map — filled by the Orchestrator — ADDRESSED TO THE IMPLEMENTER
|
|
41
|
+
|
|
42
|
+
*(placeholder — no context package yet, no progress contract yet; the Orchestrator fills this
|
|
43
|
+
part on `git pull` and appends the preamble below to the invocation. Do not dispatch on this
|
|
44
|
+
placeholder.)*
|
|
45
|
+
|
|
46
|
+
## Target repo working directory (absolute)
|
|
47
|
+
|
|
48
|
+
`C:\Users\biglmi\Documents\webapps\ui-core-micha` (branch `main`)
|
|
49
|
+
|
|
50
|
+
## Preamble — a REQUIRED block IN this file, not something appended at invocation
|
|
51
|
+
|
|
52
|
+
> The text above is the COMPLETE spec — the committed WO file's content, not a plan to refine; there
|
|
53
|
+
> is no separate plan file. Read the nearest `AGENTS.md`, the relevant `.codex/skills/<role>/SKILL.md`, and the
|
|
54
|
+
> app `MEMORY.md` ONLY for conventions. Stay in scope; do not touch auth/permissions/deps/schema/CI
|
|
55
|
+
> unless the spec says so; do not update `MEMORY.md`. **Do NOT edit `WORK_ORDERS.md` — the register
|
|
56
|
+
> row and the review verdicts are the orchestrator's alone.** **Your tools are for editing source
|
|
57
|
+
> and test files and for running the tests you wrote — nothing else.** Do NOT install dependencies,
|
|
58
|
+
> touch a lockfile, run a package manager, or tidy up stray files; if something in the repo state
|
|
59
|
+
> blocks you, stop and report it as `RESULT: BLOCKED <reason>` instead of fixing it. Do NOT
|
|
60
|
+
> `git add`/`commit`/`push` — leave every
|
|
61
|
+
> change uncommitted in the working tree for the orchestrator's independent review. WRITE the tests
|
|
62
|
+
> the `Required tests` section calls for AND **RUN the tests you just wrote** to confirm they execute
|
|
63
|
+
> and pass — that is the ONLY test run you do (NOT the app's affected/full suite, NOT any review).
|
|
64
|
+
> The orchestrator re-runs the authoritative set + does the independent review after you finish —
|
|
65
|
+
> those are the gate; your own run does not count as the gate.
|
|
66
|
+
>
|
|
67
|
+
> Narrate continuously: a `PLAN: <step1> | <step2> | …` line up front, then a single-line
|
|
68
|
+
> `PROGRESS: [<n>/<total>] <present-tense action>` before every relevant action (and `… done` on
|
|
69
|
+
> completion), spaced so no gap exceeds ~2 min, stdout unbuffered, plus exactly one final
|
|
70
|
+
> `RESULT: DONE|BLOCKED <reason>`.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
# C. Orchestrator only — NOT ADDRESSED TO THE IMPLEMENTER
|
|
75
|
+
|
|
76
|
+
> **If you are the implementer reading this work order as your own specification: STOP at this line.
|
|
77
|
+
> Everything below describes what the Orchestrator does AFTER you finish. You do none of it — no
|
|
78
|
+
> reviewers, no verification run, no register edit, no commit.**
|
|
79
|
+
|
|
80
|
+
*(to be filled by the Orchestrator: execution directive; `reviewer` (all lenses) + `ui_reviewer`; release; jg-ferien pin bump; register rows here and in jg.)*
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# UCM-TEST-1: A kit integration check every app runs in its own suite
|
|
2
|
+
|
|
3
|
+
# A. Envelope, authored by the Expertenchat
|
|
4
|
+
|
|
5
|
+
## Goal & expected outcome
|
|
6
|
+
|
|
7
|
+
The kit's auth screens are the same code in every app, so their behaviour is accepted once, in the kit.
|
|
8
|
+
What differs per app is **how the app wires the kit in**: its i18n setup, its providers around the kit's
|
|
9
|
+
pages, the `i18next` instance the kit reads. Today each bump order writes its own tests for that, app by
|
|
10
|
+
app, and the operator walked the same auth flows by hand in every app.
|
|
11
|
+
|
|
12
|
+
After this order the kit ships **one exported check**, `checkKitIntegration`, that an app calls from a
|
|
13
|
+
single test in its own suite. It returns findings in the style of `assertThemeComplete`: an empty list
|
|
14
|
+
means the app's wiring is sound. Every later bump in every app then re-checks the wiring automatically.
|
|
15
|
+
|
|
16
|
+
**Operator decisions (2026-10-01):** the check lives centrally in the kit, not as copies per app; a
|
|
17
|
+
separate, automated staging smoke covers the runtime (`workflow-templates` `WFT-CI-31`); bumps already
|
|
18
|
+
in flight are not held up, and apps adopt the check with their next bump.
|
|
19
|
+
|
|
20
|
+
## Context the operator established
|
|
21
|
+
|
|
22
|
+
- **Precedent for the shape:** `assertThemeComplete(theme)` returns `{ findings }`, is exported from the
|
|
23
|
+
package root (`src/index.js:12`), and apps assert `findings` equals `[]`.
|
|
24
|
+
- **What apps load from the kit for i18n:** `uiCoreTranslations` (`src/i18n/uiCoreTranslations.js`),
|
|
25
|
+
which spreads the auth, charts, messaging, notifications, onboarding, section-nav and user-menu
|
|
26
|
+
catalogues. Apps spread it into their own i18next resources at start-up, **kit keys last** (e.g.
|
|
27
|
+
`survey_app/frontend/i18n/index.js`).
|
|
28
|
+
- **Which `i18next` the kit reads:** `apiClient` imports the **default** `i18next` instance
|
|
29
|
+
(`src/auth/apiClient.jsx:2,13`) to send `Accept-Language`. Kit components read `t` and `i18n` from
|
|
30
|
+
`useTranslation()` (e.g. `src/pages/LoginPage.jsx:30`). `i18next`/`react-i18next` are peer
|
|
31
|
+
dependencies.
|
|
32
|
+
- **What the per-app bump orders tested by hand** (`survey_app` `SVA-DEP-1`/`SVA-DEP-2`): the kit's
|
|
33
|
+
`SignUpPage` and `PasswordInvitePage` render inside the app's providers
|
|
34
|
+
(`survey_app/frontend/src/AuthRoutesIntegration.test.jsx`), and `i18n.exists('Auth.field.email.invalid')`
|
|
35
|
+
holds in the app's own i18n.
|
|
36
|
+
- **The defect this guards against end to end:** a login with a malformed e-mail showed the raw code
|
|
37
|
+
`invalid` (`UCM-AUTH-10`). The kit's resolver fixes it, but only if the app's i18n carries the kit's
|
|
38
|
+
keys and the kit's pages run on the app's instance.
|
|
39
|
+
- **Consumers measured 2026-09-30:** every consumer runs `vitest` with jsdom. Some mount `LoginPage`
|
|
40
|
+
twice (`webshop-guenter` also in `src/pages/pwa/StaffLoginPage.jsx`). Several mock `react-i18next`
|
|
41
|
+
globally in some test files.
|
|
42
|
+
|
|
43
|
+
## The check (decided)
|
|
44
|
+
|
|
45
|
+
`checkKitIntegration({ i18n, wrapper, pages })` -> `Promise<{ findings }>`, exported from the package
|
|
46
|
+
root. `i18n` is the app's own instance, `wrapper` the app's own provider component (whatever the app
|
|
47
|
+
puts around its routes), `pages` the kit pages the app mounts (default: the kit's auth pages that the
|
|
48
|
+
app imports). Each finding names its check and a reason. Four checks:
|
|
49
|
+
|
|
50
|
+
1. **Catalogue.** Every key in `uiCoreTranslations` resolves through the app's `i18n` in every language
|
|
51
|
+
that both the kit ships (`de`/`en`/`fr`/`sw`) and the app supports. A missing key is one finding,
|
|
52
|
+
with key and language.
|
|
53
|
+
2. **Instance.** The default `i18next` instance is initialised and is the instance the app passed in.
|
|
54
|
+
Otherwise the finding says what will break: `Accept-Language` is missing or wrong.
|
|
55
|
+
3. **Render.** Each page in `pages` renders inside `wrapper` without throwing, and no rendered text
|
|
56
|
+
node is a raw kit key (`Auth.*` or another key of the kit's catalogues) or a bare backend code. The
|
|
57
|
+
check stubs the kit's `apiClient` transport for its own duration, so no request leaves the test, and
|
|
58
|
+
restores it afterwards.
|
|
59
|
+
4. **Error text.** `LoginPage` inside `wrapper` receives, through that stub, exactly the allauth response
|
|
60
|
+
from the original defect (`400`, `errors[0] = {code: "invalid", param: "email", message: ...}`). The
|
|
61
|
+
shown text equals the app-language text of `Auth.field.email.invalid`.
|
|
62
|
+
|
|
63
|
+
## Scope + non-goals
|
|
64
|
+
|
|
65
|
+
In scope: the function and its four checks; its export from the package root; a `README.md` section
|
|
66
|
+
"Consumer integration check" with the one-line test an app writes; `CHANGELOG.md`; a **minor** release.
|
|
67
|
+
|
|
68
|
+
Non-goals:
|
|
69
|
+
- No change in any app. Adoption happens per app with its next bump, as its own row.
|
|
70
|
+
- No runtime dependency added for consumers. Rendering uses the existing peers (`react`, `react-dom`).
|
|
71
|
+
- No check of the app's test mocks. A suite whose mocks lack `i18n` still fails in that suite, as today.
|
|
72
|
+
- No replacement for the kit's own tests. They keep owning the kit's behaviour.
|
|
73
|
+
- No staging or browser check (`WFT-CI-31`).
|
|
74
|
+
|
|
75
|
+
## Tier · precondition / gate
|
|
76
|
+
|
|
77
|
+
- **Tier 3 · tests: each of the four checks with a passing and a failing case; the kit's existing auth
|
|
78
|
+
and i18n tests.** A change inside shared-core, on the auth surface.
|
|
79
|
+
- Precondition: none.
|
|
80
|
+
- Downstream: every app adopts it with its next kit bump. `WFT-CI-31` is independent of this order.
|
|
81
|
+
|
|
82
|
+
## Risks
|
|
83
|
+
|
|
84
|
+
- **A check that cannot fail is decoration.** Each check needs a test showing it reports the specific
|
|
85
|
+
defect: a missing key, a second `i18next` instance, a wrapper that throws, a raw code on screen.
|
|
86
|
+
- **The transport stub must not leak.** If it is not restored, it silently swallows the requests of the
|
|
87
|
+
tests that run after it. Restore it even when a check throws.
|
|
88
|
+
- **Kit keys that the app intentionally leaves untranslated** for a language it does not offer must not
|
|
89
|
+
become findings. Hence "languages both support" in check 1.
|
|
90
|
+
- **Locally, importing the kit's root module crashes vitest's worker pool on this workstation**
|
|
91
|
+
(`fitness-monitor` `FM-15`). That is an environment issue: CI is the evidence. The check itself must not
|
|
92
|
+
add to the import weight of tests that do not call it.
|
|
93
|
+
|
|
94
|
+
## Required tests to WRITE (you write them and run YOUR OWN new ones; the Orchestrator's run is the gate)
|
|
95
|
+
|
|
96
|
+
Kit test suite, one new file:
|
|
97
|
+
|
|
98
|
+
1. A correctly wired fixture app (own `i18n` with `uiCoreTranslations`, a provider wrapper) -> `findings`
|
|
99
|
+
equals `[]`.
|
|
100
|
+
2. One key removed from the fixture's resources -> exactly one catalogue finding naming that key and
|
|
101
|
+
language.
|
|
102
|
+
3. The fixture passes a separate `i18next` instance -> an instance finding.
|
|
103
|
+
4. A wrapper that throws -> a render finding naming the page.
|
|
104
|
+
5. The resolver bypassed (a fixture that shows `err.code`) -> an error-text finding.
|
|
105
|
+
6. After the check, a request through `apiClient` is no longer stubbed.
|
|
106
|
+
|
|
107
|
+
Run, do not write: the kit's existing auth and i18n tests.
|
|
108
|
+
|
|
109
|
+
## Parity guardrail
|
|
110
|
+
|
|
111
|
+
No change to any existing export, component or behaviour. The function is new and test-only in purpose.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
# B. Implementation map, filled by the Orchestrator and ADDRESSED TO THE IMPLEMENTER
|
|
116
|
+
|
|
117
|
+
## Context package
|
|
118
|
+
|
|
119
|
+
### Where this lives, and what it may depend on
|
|
120
|
+
|
|
121
|
+
- New file `src/testing/checkKitIntegration.js` (new subdirectory, mirroring how `src/theme/` groups
|
|
122
|
+
`assertThemeComplete`). Export `checkKitIntegration` from `src/index.js` at the root, next to the
|
|
123
|
+
existing theme-completeness exports (line ~10-21) — same section-style comment, same pattern.
|
|
124
|
+
- **Hard constraint from the Non-goals: "Rendering uses the existing peers (react, react-dom)" —
|
|
125
|
+
this explicitly does NOT include `@testing-library/react`.** Every existing kit test uses RTL, but
|
|
126
|
+
RTL is a devDependency of THIS repo, not a declared peer dependency — if the shipped function
|
|
127
|
+
imported it, every consuming app would need RTL in its own `node_modules` at the exact version
|
|
128
|
+
this kit expects, silently, which is exactly the "no runtime dependency added for consumers" this
|
|
129
|
+
WO forbids. Render with plain `react-dom/client` (`createRoot`) and `act` from `react` — verified
|
|
130
|
+
now: `import { act } from 'react'` resolves and is a function on this repo's installed React
|
|
131
|
+
`19.2.6` (`node -e "console.log(typeof require('react').act)"` → `function`), so use that import,
|
|
132
|
+
not the legacy `react-dom/test-utils` path. Read rendered output via plain
|
|
133
|
+
DOM (`container.textContent`, `document.createTreeWalker`), not `screen`/`within`.
|
|
134
|
+
- `react-router-dom` (`^7.15.1`) and `axios` (`^1.16.1`) ARE existing peers — safe to import
|
|
135
|
+
`MemoryRouter` and to manipulate the shared `apiClient` axios instance directly.
|
|
136
|
+
|
|
137
|
+
### The four checks, in the order the Envelope lists them
|
|
138
|
+
|
|
139
|
+
1. **Catalogue.** Import `{ uiCoreTranslations }` from `'../i18n/uiCoreTranslations'`. For each key,
|
|
140
|
+
for each language in the INTERSECTION of the kit's shipped languages
|
|
141
|
+
(`['de','en','fr','sw']`) and the app's own supported languages, assert
|
|
142
|
+
`i18n.exists(key, { lng: lang })` — **not** `i18n.exists(key)` alone, which only checks the
|
|
143
|
+
CURRENT active language; i18next's `exists`/`t` both accept an `lng` option to check a specific
|
|
144
|
+
language without switching the instance's active one (verify this against the installed
|
|
145
|
+
`i18next` version's own typings/source before relying on it — do not assume from memory).
|
|
146
|
+
Derive "the app's own supported languages" with this priority (first one that yields a
|
|
147
|
+
non-empty array): `i18n.options?.supportedLngs` (filter out falsy entries and the literal
|
|
148
|
+
string `'cimode'`, which i18next auto-adds) → `Object.keys(i18n.options?.resources || {})` →
|
|
149
|
+
`i18n.languages` (least reliable, only the currently-resolved fallback chain — last resort).
|
|
150
|
+
One finding per missing `(key, lang)` pair, naming both.
|
|
151
|
+
2. **Instance.** Import the kit's OWN default `i18next` singleton (`import i18next from 'i18next'`
|
|
152
|
+
— the exact same import `src/auth/apiClient.jsx` already uses). Finding if `!i18next.isInitialized`
|
|
153
|
+
OR `i18n !== i18next` (reference inequality — the whole point is catching an app that created a
|
|
154
|
+
SEPARATE instance via `i18next.createInstance()` and wrapped its tree in its own
|
|
155
|
+
`I18nextProvider`, which is exactly the Risk `UCM-AUTH-10` named: the kit's `apiClient` would then
|
|
156
|
+
send `Accept-Language` from an uninitialized, different instance). Name what breaks in the
|
|
157
|
+
reason text (`Accept-Language` will be missing or wrong) — do not just say "mismatch".
|
|
158
|
+
3. **Render.** For each page component in `pages` (default: `[LoginPage, SignUpPage,
|
|
159
|
+
PasswordInvitePage]` — the three pages `UCM-AUTH-9`/`UCM-AUTH-10` actually touched, and the same
|
|
160
|
+
set `survey_app`'s own `AuthRoutesIntegration.test.jsx` already covers by hand), render
|
|
161
|
+
`<MemoryRouter><Wrapper><Page /></Wrapper></MemoryRouter>` into a fresh detached `div` (own
|
|
162
|
+
`createRoot` per page, `root.unmount()` after each, even on failure — use try/finally per page,
|
|
163
|
+
not one try around the whole loop, so one page's render failure doesn't skip scanning the rest).
|
|
164
|
+
Wrap the render in `act(async () => { ... })` so effects/microtasks settle before you scan.
|
|
165
|
+
Catch a throw during render → one finding naming the page's display name (`Page.displayName ||
|
|
166
|
+
Page.name || 'page'`) and the error message; do NOT let it abort the whole check (catch per-page,
|
|
167
|
+
continue the loop). If it didn't throw, walk every text node
|
|
168
|
+
(`document.createTreeWalker(container, NodeFilter.SHOW_TEXT)`) and flag any whose TRIMMED content
|
|
169
|
+
either (a) exactly equals a key in `uiCoreTranslations` (a literal untranslated key leaking to
|
|
170
|
+
screen — the i18next missing-key echo), or (b) matches a bare lowercase/snake_case single-token
|
|
171
|
+
shape with no spaces, e.g. `/^[a-z][a-z0-9_]*$/` and length > 2 (the exact shape of the original
|
|
172
|
+
defect, a raw backend code like `invalid` — tune this pattern against Required Test #5's fixture
|
|
173
|
+
until it fires on that fixture and not on ordinary rendered prose; do not accept the first regex
|
|
174
|
+
that merely compiles). One finding per offending text node, naming the page and the text found.
|
|
175
|
+
4. **Error text.** This check is not driven by the `pages` array — it ALWAYS specifically exercises
|
|
176
|
+
`LoginPage` (imported directly by this module), because it is testing the kit's resolver wiring
|
|
177
|
+
through a real submit flow, not generic rendering. Render `LoginPage` the same way as check 3.
|
|
178
|
+
Stub the credentials-login POST specifically — exact path, verified now:
|
|
179
|
+
`/api/auth/browser/v1/auth/login` (`src/auth/authConfig.jsx`'s `HEADLESS_BASE` +
|
|
180
|
+
`src/auth/authApi.jsx:99`'s `loginWithPassword`) — to reject with EXACTLY
|
|
181
|
+
the operator's original defect shape:
|
|
182
|
+
`{ response: { status: 400, data: { errors: [{ code: 'invalid', param: 'email', message: '<some
|
|
183
|
+
backend text>' }] } } }` (a plain object is sufficient — `resolveErrorText`/`extractErrorInfo`
|
|
184
|
+
only ever read `.response?.status`/`.response?.data` off the rejected value, nothing
|
|
185
|
+
AxiosError-specific). Fill the email/password inputs via plain DOM (`input.value = '...'` +
|
|
186
|
+
dispatching a real `input`/`change` `Event` so React's controlled-input `onChange` fires —
|
|
187
|
+
`Object.getOwnPropertyDescriptor` trick may be needed to set a native input value in a way React
|
|
188
|
+
notices; this is a well-known React-testing gotcha independent of any test-utility library, look
|
|
189
|
+
it up if the naive `input.value = x; input.dispatchEvent(new Event('input'))` doesn't trigger the
|
|
190
|
+
controlled state update) and submit (dispatch a `submit` Event on the form, or `.click()` the
|
|
191
|
+
submit button). `await act(async () => { ...await flush... })` until the error text renders.
|
|
192
|
+
Assert the rendered text equals `i18n.t('Auth.field.email.invalid')` evaluated in the APP's
|
|
193
|
+
current active language (`i18n.language`), read via the SAME walk-and-scan helper check 3 uses
|
|
194
|
+
(do not duplicate the scanning logic — factor it into one shared helper both checks call).
|
|
195
|
+
|
|
196
|
+
### Stubbing `apiClient` — must never leak, must restore even on throw
|
|
197
|
+
|
|
198
|
+
`apiClient` (`src/auth/apiClient.jsx`, default export, an axios instance) is shared, module-singleton
|
|
199
|
+
state — the SAME instance every kit page uses. Capture `const originalAdapter =
|
|
200
|
+
apiClient.defaults.adapter;` BEFORE check 3 starts, install a replacement
|
|
201
|
+
(`apiClient.defaults.adapter = async (config) => { ... }`) that, by default, REJECTS every request
|
|
202
|
+
(so check 3's page renders — which must not make real network calls at all — fail loudly if they
|
|
203
|
+
accidentally do, rather than hanging on a real fetch), and for check 4 specifically, additionally
|
|
204
|
+
matches on `config.url` to return the fixture rejection ONLY for the login endpoint
|
|
205
|
+
(`HEADLESS_BASE`-relative, check `src/auth/authApi.jsx`'s `loginWithPassword` for the exact path) and
|
|
206
|
+
the default reject-everything behaviour for anything else. **Wrap the ENTIRE checks 3+4 body in a
|
|
207
|
+
`try { ... } finally { apiClient.defaults.adapter = originalAdapter; }`** — the restore must run even
|
|
208
|
+
if a render throws an error this code doesn't catch, even if an `expect`-shaped helper you write
|
|
209
|
+
itself throws. This is Required Test #6's whole point and the Risk note's explicit warning.
|
|
210
|
+
|
|
211
|
+
### `README.md` — "Consumer integration check" section
|
|
212
|
+
|
|
213
|
+
One short section with the one-line test an app writes, e.g.:
|
|
214
|
+
```js
|
|
215
|
+
import { checkKitIntegration } from '@micha.bigler/ui-core-micha';
|
|
216
|
+
import i18n from '../i18n'; // the app's own initialised default i18next instance
|
|
217
|
+
import { AppProviders } from '../AppProviders'; // whatever the app wraps its routes in
|
|
218
|
+
|
|
219
|
+
it('kit integration is sound', async () => {
|
|
220
|
+
const { findings } = await checkKitIntegration({ i18n, wrapper: AppProviders });
|
|
221
|
+
expect(findings).toEqual([]);
|
|
222
|
+
});
|
|
223
|
+
```
|
|
224
|
+
Name the default `pages` set explicitly (`LoginPage`, `SignUpPage`, `PasswordInvitePage`) and that an
|
|
225
|
+
app can pass its own `pages` array to cover more/fewer pages.
|
|
226
|
+
|
|
227
|
+
### Test file — new, next to the existing kit tests (e.g. `tests/checkKitIntegration.test.js`)
|
|
228
|
+
|
|
229
|
+
Build ONE minimal fixture i18next instance + a trivial `Wrapper` (e.g. just renders `children`, or a
|
|
230
|
+
thin `AuthContext.Provider` with a fake user so `LoginPage`'s own context read doesn't throw) reused
|
|
231
|
+
across the 6 Required Tests, each test mutating ONE thing away from "correctly wired":
|
|
232
|
+
1. Correctly wired fixture (own real `i18next.createInstance()` seeded with `uiCoreTranslations` in
|
|
233
|
+
all 4 kit languages, THIS instance also assigned as the global default — i.e. do not create a
|
|
234
|
+
second competing instance for the "passing" case, since check 2 would then always fail; for a
|
|
235
|
+
realistic "app's own instance IS the default" fixture either call `i18next.init(...)` on the
|
|
236
|
+
real default singleton directly, matching how an app actually does it, or structure the fixture
|
|
237
|
+
so the "instance" check specifically is satisfiable) → `findings` is `[]`.
|
|
238
|
+
2. Remove one key's resources for one language from the fixture → exactly one catalogue finding
|
|
239
|
+
naming that key and language.
|
|
240
|
+
3. Pass a SEPARATE `i18next.createInstance()` as `i18n` instead of the default singleton → an
|
|
241
|
+
instance finding.
|
|
242
|
+
4. A `wrapper` that throws during render → a render finding naming the page.
|
|
243
|
+
5. **The actual regression proof:** stub the login POST to reject with the operator's exact shape
|
|
244
|
+
but WITHOUT going through the kit's resolver (simulate "the resolver bypassed" by using a fixture
|
|
245
|
+
`LoginPage`-equivalent harness only if you must — more directly: this is best proven by reverting
|
|
246
|
+
`resolveErrorText`'s field-key step locally, confirming check 4 then reports an error-text
|
|
247
|
+
finding instead of passing, then restoring — narrate this in `PROGRESS` as the transient
|
|
248
|
+
mutation proof, same pattern as `UCM-AUTH-11`/`UCM-THEME-15` in this repo, rather than leaving a
|
|
249
|
+
permanently reverted copy in the committed suite).
|
|
250
|
+
6. After calling `checkKitIntegration(...)` once, assert `apiClient.defaults.adapter` is back to
|
|
251
|
+
whatever it was before the call (capture the reference beforehand) — proves restoration even on
|
|
252
|
+
the success path; also add a case that makes an internal step throw (e.g. a page whose render
|
|
253
|
+
throws) and still assert the adapter was restored afterwards (the `try/finally` must cover the
|
|
254
|
+
failure path too, not just the happy path).
|
|
255
|
+
|
|
256
|
+
Run, do not write: the kit's existing auth and i18n tests (grep `tests/` for
|
|
257
|
+
`i18nAggregate`/`authErrors`/`resolveErrorText`/`loginPageErrorResolution` — these are the
|
|
258
|
+
directly-dependent set the Orchestrator re-runs as the gate).
|
|
259
|
+
|
|
260
|
+
## Do-not-touch / invariants
|
|
261
|
+
|
|
262
|
+
- No change to any existing export, component, or behaviour (Parity guardrail) — this is a new,
|
|
263
|
+
additive, test-only function.
|
|
264
|
+
- Do not add `@testing-library/react` (or any other new package) to `dependencies`,
|
|
265
|
+
`peerDependencies`, or `devDependencies` for this function's own sake.
|
|
266
|
+
- Do not touch `apiClient.jsx`'s actual interceptors/exports — only reach into
|
|
267
|
+
`apiClient.defaults.adapter` from the NEW module, temporarily, with a guaranteed restore.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
# C. Orchestrator only, NOT ADDRESSED TO THE IMPLEMENTER
|
|
272
|
+
|
|
273
|
+
> **If you are the implementer reading this work order as your own specification: STOP at this line.**
|
|
274
|
+
> Everything below describes what the Orchestrator does AFTER you finish. You do none of it: no
|
|
275
|
+
> reviewers, no verification run, no register edit, no `git add`/`commit`/`push`.
|
|
276
|
+
|
|
277
|
+
### Execution directive
|
|
278
|
+
|
|
279
|
+
Check `.claude/codex-status.md` first (newest-first; read it with `head`). No line for today means use
|
|
280
|
+
Codex. Before `git push`, run `git log origin/main..HEAD` and push only if every listed commit is this
|
|
281
|
+
order's (parallel sessions share this checkout).
|
|
282
|
+
|
|
283
|
+
### Review routing
|
|
284
|
+
|
|
285
|
+
Tier 3: independent `reviewer` (all configured lenses) and `ui_reviewer`, concurrent, one batch, before
|
|
286
|
+
the commit. No `sec_reviewer`: the function adds no runtime path, it only reads what is already there.
|
|
287
|
+
|
|
288
|
+
### Verification
|
|
289
|
+
|
|
290
|
+
Run the check once against a real consumer before release. `survey_app` is on `3.9.x` and has the closest
|
|
291
|
+
existing test (`frontend/src/AuthRoutesIntegration.test.jsx`). Do it from a scratch copy or a local pack,
|
|
292
|
+
never by committing to that repo. Name the result in the register Notiz.
|
|
293
|
+
|
|
294
|
+
### Register + commit + release
|
|
295
|
+
|
|
296
|
+
Row -> `done` with the review Notiz in the `AGENTS.md` shape and the published version. The publish
|
|
297
|
+
runs on push to `main` when `package.json`/`src/**` change; verify it through the job log
|
|
298
|
+
(`npm view` lags for provenance publishes). Adoption rows per app are added by the Expertenchat when
|
|
299
|
+
each app's next bump is scoped.
|
|
300
|
+
|
|
301
|
+
### Mini-handover
|
|
302
|
+
|
|
303
|
+
`Orchestrator: implement work-orders/UCM-TEST-1.md in ui-core-micha (main). git pull first, read the WO,
|
|
304
|
+
then follow orchestrate-codex.`
|
|
@@ -14,9 +14,38 @@ both of its themes through the factory.
|
|
|
14
14
|
|
|
15
15
|
## Value source
|
|
16
16
|
|
|
17
|
-
**`docs/DARK-TOKENS.md`, frozen by the operator in `UCM-THEME-13
|
|
18
|
-
from that sheet. A value the implementation needs that the sheet does not carry is a
|
|
19
|
-
Do not improvise it.
|
|
17
|
+
**`docs/DARK-TOKENS.md`, frozen by the operator in `UCM-THEME-13` (2026-10-02, `7330f91`).** Every dark
|
|
18
|
+
value in code comes from that sheet. A value the implementation needs that the sheet does not carry is a
|
|
19
|
+
stop-and-report. Do not improvise it.
|
|
20
|
+
|
|
21
|
+
## Decided rules (operator, 2026-10-01 and 2026-10-02; amended into this order 2026-10-02)
|
|
22
|
+
|
|
23
|
+
1. **Complete baseline.** Every mode-dependent token class has its dark value from the sheet, including
|
|
24
|
+
`ink.*`, `text.*`, `background.default/paper/subtle`, `divider`, `controlBorder.*`, all five status keys
|
|
25
|
+
(`main/light/dark/contrastText` via `withMainShades`, plus `text/fill/fillText/bg`), `dataSeries` and
|
|
26
|
+
`shadow.*`.
|
|
27
|
+
2. **Outlined first, as in light.** Resting surfaces keep `shadow.rest: none`. **Overlays get their own,
|
|
28
|
+
lighter surface in dark**: the sheet's overlay surface (`#232A31`) is the paper of `MuiDialog`,
|
|
29
|
+
`MuiMenu`, `MuiPopover` and `MuiDrawer` in dark, with the sheet's overlay shadow; the modal backdrop
|
|
30
|
+
(`MuiBackdrop`) uses the sheet's scrim. Light has no such surface and does not change.
|
|
31
|
+
3. **Primary in dark: derived only when it fails.** An app always passes `palette.primary` (the factory
|
|
32
|
+
requires it). In dark, that value is kept if it clears 4.5:1 on the dark page, and otherwise lightened in
|
|
33
|
+
0.05 steps until it does. Its `contrastText` is whichever of `#FFFFFF` and the dark page colour
|
|
34
|
+
contrasts more. This is how "derived unless the app sets its own" is expressed in an API where every
|
|
35
|
+
app sets one: an app that wants a particular dark primary passes one that already clears the floor
|
|
36
|
+
(webshop-guenter `#D49040`, 7.35:1, stays). Worked examples are in the sheet.
|
|
37
|
+
4. **Status safety net, the dark counterpart of `UCM-THEME-15`.** On a dark page other than the baseline
|
|
38
|
+
page, a **baseline-supplied** status `main` (and `controlBorder.error`) that would fail against the page or
|
|
39
|
+
its own `bg` is lightened until it passes. App-supplied values are never altered (`UCM-THEME-15` rule 3,
|
|
40
|
+
read per key off `appConfig.palette`). Never throws; capped like the darkening.
|
|
41
|
+
5. **Data series follow a rule, not only a list.** In dark, each light series colour is lightened until it
|
|
42
|
+
clears 3:1 on the theme's own `background.paper`. On the baseline paper that yields exactly the sheet's
|
|
43
|
+
list; on an app's own paper (webshop-guenter `#171209`) it adapts.
|
|
44
|
+
6. **Contrast surfaces are the theme's own.** In dark, every derivation and `contrastFindings` judge against
|
|
45
|
+
the theme's page and paper, never a fixed `#FFFFFF`. Light keeps today's pair.
|
|
46
|
+
7. **Autofill needs no new code path.** The palette-aware block (`src/theme/createAppTheme.js:97-108`)
|
|
47
|
+
already resolves from `background.paper` and `ink.primary` and wins over the static light block in
|
|
48
|
+
`tokens.js`. It is correct in dark once the dark palette is in place; confirm it in a test.
|
|
20
49
|
|
|
21
50
|
## Context the operator established
|
|
22
51
|
|
|
@@ -32,7 +61,10 @@ Do not improvise it.
|
|
|
32
61
|
- `BASELINE_INTENTIONAL_DEFAULT_EXEMPTIONS` includes `palette.background.paper` with the reason "The
|
|
33
62
|
canonical surface is deliberately MUI white". That reason is false for a dark theme.
|
|
34
63
|
- The palette-aware slots use palette values (for example the autofill inset uses `background.paper`),
|
|
35
|
-
so they follow the resolved palette once it is right.
|
|
64
|
+
so they follow the resolved palette once it is right. `tokens.js` also carries a static light `autofill`
|
|
65
|
+
block (`#FFFFFF`, `#212529`); it is shadowed by the palette-aware one (measured 2026-10-02).
|
|
66
|
+
- `UCM-THEME-15` (3.8.0) added `deriveDarkenedPageColour`/`deriveAlphaPageColour` next to
|
|
67
|
+
`deriveFocusColour`; the dark branch extends those, it does not add a parallel set.
|
|
36
68
|
- The kit has components registered against the baseline (`src/theme/kitSxRegistry.js`, `THEME-4`/
|
|
37
69
|
`THEME-5`). A kit component that hard-codes a light value would show that value only in dark mode.
|
|
38
70
|
|
|
@@ -42,7 +74,9 @@ In scope:
|
|
|
42
74
|
1. `tokens.js`: a dark baseline palette with the sheet's values, and whatever exemption entries a
|
|
43
75
|
dark theme needs, each with a true reason.
|
|
44
76
|
2. `createAppTheme`: select the baseline palette by `palette.mode`. Make the focus derivation work in
|
|
45
|
-
both directions against the mode's surfaces.
|
|
77
|
+
both directions against the mode's surfaces. Rules 2 to 6 above: the overlay surface, scrim and overlay
|
|
78
|
+
shadow on the four overlay components in dark; the primary derivation; the status safety net; the
|
|
79
|
+
series rule.
|
|
46
80
|
3. `themeCompleteness.js`: contrast checks against the theme's own surfaces, not a fixed white. Mode-
|
|
47
81
|
specific exemptions.
|
|
48
82
|
4. Kit components that resolve a hard-coded light value instead of a token: **list** every one.
|
|
@@ -76,6 +110,11 @@ Non-goals:
|
|
|
76
110
|
derived by darkening, both fail on dark.
|
|
77
111
|
- **The `background.paper` exemption reason is currently mode-blind.** Leaving it would record a false
|
|
78
112
|
statement as the reason in every dark theme.
|
|
113
|
+
- **Rule 3 cannot keep a dark primary that fails the floor.** An app that deliberately wants one gets it
|
|
114
|
+
lightened. That is intended (an accessibility floor), not a defect.
|
|
115
|
+
- **Two sheet values sit close to their threshold** (`controlBorder.main` 3.14:1 on paper, series slot 1
|
|
116
|
+
3.07:1). Build them from the rules, not as literals, so a later paper change re-derives instead of
|
|
117
|
+
silently failing.
|
|
79
118
|
|
|
80
119
|
## Required tests to WRITE (you write them and run YOUR OWN new ones; the Orchestrator's run is the gate)
|
|
81
120
|
|
|
@@ -91,6 +130,18 @@ Kit test suite, narrow, next to the existing theme tests:
|
|
|
91
130
|
3. **Focus contrast.** `controlBorder.focus` clears 3:1 against both page surfaces in each mode.
|
|
92
131
|
4. **Status family on dark.** Each status key resolves `main/light/dark/contrastText` from the dark
|
|
93
132
|
baseline, not MUI's defaults.
|
|
133
|
+
5. **Primary in dark (rule 3).** On the baseline dark page: `#468AB2` stays, `#2F4F96` resolves to
|
|
134
|
+
`#6D84B6`, `#432CA1` to `#8576C2`, each with `#14181B` as `contrastText`; `#D49040` stays.
|
|
135
|
+
6. **Status net (rule 4).** On webshop-guenter's page `#0E0B08` no baseline status colour moves; on a
|
|
136
|
+
page chosen so that one fails, that one is lightened and passes; an app-supplied status `main` that
|
|
137
|
+
fails stays exactly as supplied.
|
|
138
|
+
7. **Overlay surface (rule 2).** In dark, the paper of `MuiDialog`, `MuiMenu`, `MuiPopover` and `MuiDrawer`
|
|
139
|
+
resolves to the sheet's overlay surface and `MuiBackdrop` to its scrim; the light theme's values for
|
|
140
|
+
the same slots are unchanged (covered by test 1).
|
|
141
|
+
8. **Series rule (rule 5).** On the baseline paper the dark series equal the sheet's list; on
|
|
142
|
+
`#171209` every slot clears 3:1.
|
|
143
|
+
9. **Autofill (rule 7).** In dark, the resolved autofill inset is the dark paper and the text is
|
|
144
|
+
`ink.primary`.
|
|
94
145
|
|
|
95
146
|
Run, do not write: the kit's existing theme and `kitSxRegistry` tests.
|
|
96
147
|
|
|
@@ -103,9 +154,128 @@ branch.
|
|
|
103
154
|
|
|
104
155
|
# B. Implementation map, filled by the Orchestrator and ADDRESSED TO THE IMPLEMENTER
|
|
105
156
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
157
|
+
Work from this package; do not explore broadly from scratch; open only the named files to verify. If
|
|
158
|
+
you must dig deeper, delegate to a read-only Explore sub-agent.
|
|
159
|
+
|
|
160
|
+
## Target working directory (absolute)
|
|
161
|
+
|
|
162
|
+
`C:\Users\biglmi\Documents\webapps\ui-core-micha` (branch `main`). Never the workspace root.
|
|
163
|
+
|
|
164
|
+
## Context package
|
|
165
|
+
|
|
166
|
+
Value source for every dark value: `docs/DARK-TOKENS.md` (read it fully first). Do not invent a value;
|
|
167
|
+
one the sheet lacks is `RESULT: BLOCKED <value>`.
|
|
168
|
+
|
|
169
|
+
**`src/theme/tokens.js`**
|
|
170
|
+
- `BASELINE_PALETTE` (l.~52-123) is the light baseline. Add `BASELINE_PALETTE_DARK` next to it with the
|
|
171
|
+
same shape, every key from the sheet: `ink`, `text`, `background`, `divider`, `controlBorder`
|
|
172
|
+
(`main`/`hover`/`error`), the five status keys (use `withMainShades(main, '#14181B')` for
|
|
173
|
+
success/warning/error/info, plus `text`/`fill`/`fillText`/`bg`; `stale` has no `main`, as in light),
|
|
174
|
+
`dataSeries.categorical`. Do NOT hardcode series slots 1 and 5, `controlBorder.main/hover`, or the
|
|
175
|
+
primary as literals: those are rule-derived (see below); the sheet's numbers are the expected OUTPUT.
|
|
176
|
+
The dark `dataSeries` base is the light `SERIES_COLOURS`, lightened by the factory.
|
|
177
|
+
- Export a dark overlay surface (`#232A31`), a dark overlay shadow (`0 8px 28px rgba(0,0,0,.45)`) and the
|
|
178
|
+
scrim (`rgba(0,0,0,.55)`) as named constants.
|
|
179
|
+
- `BASELINE_STATIC.shadow` (~l.200) carries `rest`/`overlay`; the dark theme needs the dark overlay value
|
|
180
|
+
there. `BASELINE_STATIC.components` has static `MuiDialog.paper`/`MuiDrawer.paper`/`MuiMenu.paper`
|
|
181
|
+
boxShadow `OVERLAY_SHADOW` (~l.340-355): in dark these are overridden, never edited for light.
|
|
182
|
+
- The static light `autofill` block (~l.147) is shadowed by the palette-aware one; leave it, confirm by test.
|
|
183
|
+
- `BASELINE_INTENTIONAL_DEFAULT_EXEMPTIONS` (end of file): the `palette.background.paper` entry says "MUI
|
|
184
|
+
white". Provide the list by mode: in dark, drop that entry (the dark paper differs from MUI's default, so
|
|
185
|
+
no exemption is needed), keep the others. The light list stays byte-identical.
|
|
186
|
+
|
|
187
|
+
**`src/theme/createAppTheme.js`**
|
|
188
|
+
- `createAppTheme` (l.~176): the three-layer `createTheme(app, BASELINE_PALETTE, app)` resolution. Read
|
|
189
|
+
`appConfig.palette.mode`; `'dark'` selects `BASELINE_PALETTE_DARK` and passes `mode: 'dark'` through to the
|
|
190
|
+
theme; anything else is the unchanged light path. Do not read `prefers-color-scheme`.
|
|
191
|
+
- `contrastSurfaces = ['#FFFFFF', background.default]` (l.~186): in dark this must be the theme's own
|
|
192
|
+
`[background.default, background.paper]`; light stays exactly `['#FFFFFF', default]`.
|
|
193
|
+
- `deriveFocusColour`/`clearsContrast` (l.~48-60) only darken and use MUI `getContrastRatio`. In dark add a
|
|
194
|
+
lightening counterpart (lighten in 0.05 steps, same 0.9 cap) alongside, not a rewrite. Same for
|
|
195
|
+
`deriveDarkenedPageColour`: add a lightened sibling next to it. For dark `controlBorder.main/hover`:
|
|
196
|
+
`rgba(230, 235, 239, a)` from `ink.primary`, `a` = the smallest alpha (0.01 steps) that clears 3:1 on
|
|
197
|
+
page and paper, hover = main + 0.15; the sheet's 0.38 / 0.53 are the expected result.
|
|
198
|
+
- Rule 3 (primary), rule 4 (status net: baseline-supplied status `main` and `controlBorder.error`, judged
|
|
199
|
+
against page AND its own `bg`, lightened; per-key check off `appConfig.palette` exactly as the existing
|
|
200
|
+
light loops do), rule 5 (series: each baseline light series colour lightened in 0.05 steps until it clears
|
|
201
|
+
3:1 on the theme's own `background.paper`; app-supplied series untouched, the final merge argument already
|
|
202
|
+
lets them win), rule 6 (own surfaces) are all computed here, dark branch only. Primary `contrastText` =
|
|
203
|
+
whichever of `#FFFFFF` / `background.default` contrasts more. The app may pass `primary` as `{ main }`.
|
|
204
|
+
- `createPaletteAwareComponents(palette)` (l.~84): add dark-only overlay slots: `MuiDialog`, `MuiMenu`,
|
|
205
|
+
`MuiPopover`, `MuiDrawer` `paper` -> background colour = overlay surface `#232A31`, `boxShadow` = dark
|
|
206
|
+
overlay shadow; `MuiBackdrop.root` -> scrim. Keep the overlay surface a local constant unless a palette
|
|
207
|
+
key is clearly cleaner and trips no completeness check. Emitted only when mode is dark, so the light
|
|
208
|
+
component tree is untouched.
|
|
209
|
+
- Preserve the final merge order (BASELINE_STATIC, palette-aware components, `appConfig`, the dataSeries
|
|
210
|
+
re-merge). The dark theme's `shadow.overlay` = the dark value.
|
|
211
|
+
|
|
212
|
+
**`src/theme/themeCompleteness.js`**
|
|
213
|
+
- `contrastFindings` (l.~268-345): `backgrounds = { white: '#FFFFFF', page: default }` (~l.298). In dark use
|
|
214
|
+
the theme's own page and paper instead of a fixed white. Light keeps the exact same keys
|
|
215
|
+
(`...-on-white`, `...-on-page`) and values; existing tests assert those surface names. For dark name them
|
|
216
|
+
`...-on-paper` / `...-on-page`.
|
|
217
|
+
- `assertThemeComplete` (~l.620): `MUI_DEFAULT_THEME` is the light MUI default. Verify a dark theme neither
|
|
218
|
+
produces a false "still MUI default" finding nor a false pass; fix only what is wrong.
|
|
219
|
+
|
|
220
|
+
**Kit components with hard-coded light values:** `src/components/QrSignupManager.jsx` has an inline CSS
|
|
221
|
+
block (l.~225-274: `#f5f7fb`, `#122033`, `#d9e2f2`, `#ffffff`, `#e8f0ff`, `#23408e`, `#f8faff`) and
|
|
222
|
+
`bgcolor: '#ffffff'` at l.361. **The l.361 white is a QR quiet zone and stays.** List every hard-coded
|
|
223
|
+
light colour under `src/` outside `src/theme/` and tests in your final report. Switching one to an existing
|
|
224
|
+
palette token is in scope (check its consumers and `tests/QrSignupManager.registrationContext.test.jsx`
|
|
225
|
+
first); a spot that would need a new token is reported, not built. `src/auth/UserMenu.jsx:44` and
|
|
226
|
+
`src/components/charts/chartLabels.js` only mention colours in comments.
|
|
227
|
+
|
|
228
|
+
**Docs / release:** `DESIGN.md` gets a concise dark-mode section (how to opt in, primary rule, status net,
|
|
229
|
+
overlay surface, series rule, what an app owns in dark). `CHANGELOG.md` entry. `package.json` version
|
|
230
|
+
`3.10.0` -> `3.11.0` (and `package-lock.json` where the version appears for this package).
|
|
231
|
+
|
|
232
|
+
**Existing tests to follow** (style, imports): `tests/createAppTheme.test.js`,
|
|
233
|
+
`tests/createAppThemePageContrast.test.js` (imports `assertThemeComplete`, `createAppTheme` from
|
|
234
|
+
`../src/theme`), `tests/themeCompleteness.test.js`. New dark tests go in `tests/createAppThemeDark.test.js`,
|
|
235
|
+
the light guard in `tests/createAppThemeLightGuard.test.js`.
|
|
236
|
+
|
|
237
|
+
**Light regression guard (required test 1):** BEFORE editing any source, capture the output of
|
|
238
|
+
`createAppTheme({ palette: { primary: { main: '#0F62FE' } } })` and of one overriding app config (fontFamily,
|
|
239
|
+
a custom page background, an app-supplied status main) as a JSON fixture
|
|
240
|
+
(`tests/fixtures/light-theme-baseline.json`, stable serialization, functions as strings), from the
|
|
241
|
+
unmodified code, and assert equality afterwards. Prove it can fail: one test mutates a light value in a
|
|
242
|
+
clone of the snapshot and asserts the comparison reports a difference.
|
|
243
|
+
|
|
244
|
+
**Invariants / pitfalls**
|
|
245
|
+
- Light output byte-identical: no key-order change that alters serialization, no new keys on the light theme.
|
|
246
|
+
- Only the first `createTheme` argument is augmented (comment at the top of `tokens.js`): every status
|
|
247
|
+
entry needs explicit `main/light/dark/contrastText`.
|
|
248
|
+
- MUI `getContrastRatio` vs the kit's alpha-aware `calculateContrastRatio`: use the kit's for anything with
|
|
249
|
+
alpha, as THEME-15 did.
|
|
250
|
+
- Build `controlBorder.main/hover`, the series and the primary from the rules, not literals; the tests
|
|
251
|
+
assert the rules reproduce the sheet's values.
|
|
252
|
+
- Do not touch auth, CI, dependencies, `WORK_ORDERS.md`, or `docs/DARK-TOKENS.md` (read-only here).
|
|
253
|
+
|
|
254
|
+
## Required tests, restated
|
|
255
|
+
|
|
256
|
+
The nine tests of Part A, in the new files named above. Run only the tests you wrote.
|
|
257
|
+
|
|
258
|
+
## Preamble
|
|
259
|
+
|
|
260
|
+
The text above is the COMPLETE spec: the committed WO file's content, not a plan to refine; there is no
|
|
261
|
+
separate plan file. Read the nearest `AGENTS.md`, the relevant `.codex/skills/<role>/SKILL.md`, and the app
|
|
262
|
+
`MEMORY.md` ONLY for conventions. Stay in scope; do not touch auth/permissions/deps/schema/CI unless the
|
|
263
|
+
spec says so; do not update `MEMORY.md`. **Do NOT edit `WORK_ORDERS.md`: the register row and the review
|
|
264
|
+
verdicts are the orchestrator's alone.** **Your tools are for editing source and test files and for running
|
|
265
|
+
the tests you wrote, nothing else.** Do NOT install dependencies, touch a lockfile (the version line in
|
|
266
|
+
`package-lock.json` is the one exception, a plain text edit), run a package manager, or tidy up stray
|
|
267
|
+
files; if something in the repo state blocks you, stop and report it as `RESULT: BLOCKED <reason>` instead
|
|
268
|
+
of fixing it. Do NOT `git add`/`commit`/`push`: leave every change uncommitted in the working tree for the
|
|
269
|
+
orchestrator's independent review. WRITE the tests the `Required tests` section calls for AND **RUN the
|
|
270
|
+
tests you just wrote** to confirm they execute and pass: that is the ONLY test run you do (NOT the
|
|
271
|
+
affected/full suite, NOT any review). Run them with `npx vitest run <your test files>`. The orchestrator
|
|
272
|
+
re-runs the authoritative set and does the independent review after you finish; those are the gate.
|
|
273
|
+
|
|
274
|
+
Narrate continuously: a `PLAN: <step1> | <step2> | ...` line up front, then a single-line
|
|
275
|
+
`PROGRESS: [<n>/<total>] <present-tense action>` before every relevant action (and `... done` on
|
|
276
|
+
completion), spaced so no gap exceeds ~2 min, stdout unbuffered, plus exactly one final
|
|
277
|
+
`RESULT: DONE|BLOCKED <reason>`. Your final report must also list every hard-coded light colour found under
|
|
278
|
+
`src/` outside the theme folder.
|
|
109
279
|
|
|
110
280
|
---
|
|
111
281
|
|