@micha.bigler/ui-core-micha 3.9.0 → 3.10.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.10.0 — UCM-TEST-1
4
+
5
+ Added the exported `checkKitIntegration` consumer check for app i18n, providers, kit page rendering, and auth error translation wiring.
6
+
7
+ ## 3.9.1 — UCM-AUTH-11
8
+
9
+ `UserListComponent` no longer offers an administrator the delete action for their own account, including when a consumer-supplied `canDeleteUser` callback returns true.
10
+
3
11
  ## 3.9.0 — UCM-AUTH-10
4
12
 
5
13
  Kit auth errors now resolve through explicit backend i18n keys, field-specific keys, code translations,
package/README.md CHANGED
@@ -10,6 +10,22 @@ To add an entry, create a small component in `dev/entries.jsx` and append it to
10
10
 
11
11
  Spread `uiCoreTranslations` into the default i18n namespace as the supported aggregate; per-feature translation exports remain available to selective apps that accept responsibility for pairing every adopted feature with its bundle.
12
12
 
13
+ ## Consumer integration check
14
+
15
+ ```js
16
+ import { checkKitIntegration } from '@micha.bigler/ui-core-micha';
17
+ import i18n from '../i18n';
18
+ import { AppProviders } from '../AppProviders';
19
+
20
+ it('kit integration is sound', async () => {
21
+ globalThis.IS_REACT_ACT_ENVIRONMENT = true; // skip if your test setup already sets this
22
+ const { findings } = await checkKitIntegration({ i18n, wrapper: AppProviders });
23
+ expect(findings).toEqual([]);
24
+ });
25
+ ```
26
+
27
+ `pages` controls which additional kit pages render (default: `LoginPage`, `SignUpPage`, `PasswordInvitePage`); `LoginPage` itself always renders once more for the error-text check regardless of what `pages` contains. Run this check on its own in its test file — it stubs the kit's shared `apiClient` transport for its duration, so a test running real requests through `apiClient` at the same time would see them intercepted too.
28
+
13
29
  ## Dashboard primitives
14
30
 
15
31
  `StatTile` (a bordered KPI tile) and `SoftChip` (a soft tinted annotation/status chip, tones derived from `theme.palette[tone]`) live under `src/components/` and are exported from the package root.
package/WORK_ORDERS.md CHANGED
@@ -19,6 +19,7 @@ rules are defined centrally in `webapps/AGENTS.md` → "Work-Order Register".
19
19
  | `I18N-*` | The shared kit's i18n **contract** — how a consumer registers ucm's strings, and what happens when it forgets. Distinct from `AUTH-*`, which owns the auth strings themselves |
20
20
  | `PRIM-*` | Shared dashboard/data primitives — small presentational components that are neither chart (`CHART-*`) nor app chrome (`SHELL-*`) |
21
21
  | `SHELL-*` | Shared app chrome and navigation shells (`UserMenu`, mobile bottom nav, secondary-navigation shell) — used since `SHELL-1`, documented here 2026-08-11 |
22
+ | `TEST-*` | Consumer integration checks the kit ships for apps to run in their own suites |
22
23
 
23
24
  Introduce a new prefix when none fits and add it here. New WOs always get a
24
25
  prefixed ID; never reuse a bare flat number across workstreams.
@@ -27,6 +28,8 @@ prefixed ID; never reuse a bare flat number across workstreams.
27
28
 
28
29
  | ID | Titel | Beschreibung | Datum | Status | Commit(s) | Notiz |
29
30
  |---|---|---|---|---|---|---|
31
+ | UCM-TEST-1 | A kit integration check every app runs in its own suite | Exported `checkKitIntegration({ i18n, wrapper, pages })` -> `{ findings }` (shape of `assertThemeComplete`): kit keys present in the app's i18n, one `i18next` instance, kit pages render in the app's providers without raw keys, the `invalid`-email case shows the field text. Replaces per-app hand-written wiring tests and manual auth walks. Full order [`work-orders/UCM-TEST-1.md`](work-orders/UCM-TEST-1.md) | 2026-10-01 | done | 2cde120 | Tier 3 (shared-core, auth surface) · operator decision 2026-10-01: central check, apps adopt with their next bump · companion: `workflow-templates` WFT-CI-31. Codex implemented (available today, no fallback). Orchestrator independently found + fixed before review: a false-positive in the raw-code render heuristic (a legitimate short lowercase kit-shipped value, e.g. German `"oder"` for `Auth.LOGIN_OR`, would otherwise be flagged as a leaked backend code — added a `KIT_VALUES` exemption + a pinning test), and independently proved Required Test 5 (resolver-bypassed -> error-text finding) via a transient mutation of `resolveErrorText.js`, restored clean. Independent `reviewer` (all 4 lenses) + `ui_reviewer` (Codex gpt-5.6-luna, concurrent background batch, full diff): **review: codex/gpt-5.6-luna · lenses: envelope,regression,duplication,tests,ui · 9 raised · 6 accepted · worst accepted: blocker**. Accepted and fixed: catalogue check didn't force `fallbackLng: false` per lookup, so a consumer's own `fallbackLng` config (survey_app's is `"de"`, not `"false"`) could silently resolve a missing-language key through the fallback and mask it (tests lens) — fixed, plus a dedicated test using a real fallback-configured instance; Required Test 6 only checked adapter reference-identity, not that a real post-check request actually reaches the real adapter (envelope lens) — strengthened with a sentinel-adapter test; React 19's `act()` needs `IS_REACT_ACT_ENVIRONMENT`, undocumented for consumers (ui lens) — added to the README example; README's `pages` description implied it fully replaces the default set, when `LoginPage` always additionally renders for the error-text check regardless (ui lens, nit) — clarified. Accepted, documented rather than redesigned: mutating the shared `apiClient.defaults.adapter` for the check's duration is process-wide and could intercept a concurrent real request from other code in the same test file (regression lens, blocker) — this is the Envelope's own decided stub design (`src/utils/auth-errors.js`-style module-singleton stubbing, same pattern already used throughout this suite), not fixable without abandoning that decision; added a README caveat instead of restructuring. Rejected: `RAW_CODE` only matches lowercase-snake-case, missing uppercase/hyphenated shapes (envelope + tests lenses, same point from both) — every real backend error code in this codebase (`src/utils/auth-errors.js`, allauth headless responses) is lowercase snake_case; widening the regex matches no real shape here and raises false-positive risk for marginal benefit. `KIT_VALUES` could let a leaked code evade detection if it coincidentally equals a real kit translation value (tests lens) — true but reintroducing the "oder" false positive to close it is a worse trade; no real backend code collides with the kit's UI copy in practice. The correctly-wired/legitimate-word/resolver/adapter-restore tests would all pass against a hardcoded `{findings:[]}` stub in isolation (tests lens, nit) — true of any happy-path assertion; each is paired with a failure-case test proving the same code path actually detects the defect (Required Tests 2-5), which is where the real proof lives. `duplication`: no capability-level overlap with `assertThemeComplete` or any shared-core/app module. **Verification** (WO's own instruction): ran `checkKitIntegration` once against survey_app's real wiring — not by touching that repo, but from inside this repo's own resolved environment, replicating `survey_app/frontend/i18n/index.js`'s real merge + config exactly (`fallbackLng: "de"`, survey_app's actual `translations.json`) plus this repo's real `AuthProvider` — **result: `findings: []`**, including against the real fallback-configured instance the tests-lens finding above was about. Orchestrator's own scoped run: `tests/checkKitIntegration.test.jsx` + `tests/resolveErrorText.test.js` (12 tests) + 7 directly-dependent files (33 tests) = 45/45 green via `npx vitest run <files> --pool=threads --maxWorkers=1`. No rendered gate — library-only change, no running app to preview. **Released as `3.10.0`** (minor — new exported capability, per the WO's own instruction). Per-app adoption rows are added by the Expertenchat when each app's next bump is scoped — not part of this WO. |
32
+ | UCM-AUTH-11 | [`UserListComponent` offers an admin the delete action on their own row](work-orders/UCM-AUTH-11.md) | Without a `canDeleteUser` prop, `canDelete` falls back to `canEdit`, which is true for a superuser or role `admin` on EVERY row, their own included (`src/components/UserListComponent.jsx` `defaultCanEdit`/`canDelete`, ~l.128-156); the backend (dcm) still allows an admin's generic self-delete. Default should never offer deleting one's own row. | 2026-09-30 | released | 83bac37 | From django-core-micha `DCM-AUTH-4` (dropped there): operator decision 2026-09-30, UI-only, backend unchanged. Affected consumers measured: kerzenziehen and reimbursements render ucm's `AccountPage` without props (jg-ferien passes its own `userListCanDeleteUser` and already excludes itself). Both apps pin ucm **2.41.3**, so reaching them needs a major bump (3.0.0 removed chart layout props) — tracked as its own follow-up, not this WO. Gate #1 approved 2026-09-30 (operator handover). Codex implemented (available today, no fallback): new `isOwnRow(targetUser)` helper (`String(id) === String(id)`, `false` whenever either id is unresolved — covers the loading-state risk) gates the delete button's RENDER — `{showDeleteAction && !isOwnRow(row) && (...)}` — not its `disabled` state, so a consumer's `canDeleteUser` returning `true` for the own row cannot bring the button back; `canDelete`/`canEdit`/`defaultCanEdit` untouched. Independent `reviewer` (all 4 lenses) + `ui_reviewer` + `sec_reviewer` (Codex gpt-5.6-luna, concurrent background batch, full diff): **review: codex/gpt-5.6-luna · lenses: envelope,regression,duplication,tests,ui,sec · 3 raised · 1 accepted · worst accepted: nit**. Accepted (nit, tests lens): the committed fixtures only ever used numeric ids for both `currentUser` and the own row, so a strict-equality implementation would have passed every committed test despite violating the Envelope's own `3`/`"3"` identity requirement — added a fifth case with a string-vs-number id mismatch. Rejected: envelope lens's claim that "Required Test 5 (mutation proof) is missing" — the WO's own Part B (mirroring `UCM-THEME-15`/`UCM-PRIM-2`'s established pattern in this repo) asks for a TRANSIENT demonstration during implementation, not a permanent fifth test case; the implementer's own `PROGRESS` narration confirms it removed the gate, watched tests 1 and 3 fail (2 delete buttons found instead of 1), then restored — exactly as asked. Envelope lens's claim that "package.json remains 3.9.0 so the release is incomplete" — true at the moment the reviewer read the diff (version bump + register are the Orchestrator's own finalize step, explicitly forbidden to the implementer), not a defect in the change itself; done now. `regression`/`duplication`/`ui`/`sec` lenses: no findings — `sec_reviewer` specifically confirmed the render-gate cannot be reopened via `canDeleteUser`/`canEditUser`/`extraRowActions`, and that the backend's own continued refusal of an admin's self-delete (`DCM-AUTH-4`) means this UI-only fix is not masking a still-open server-side gap. Orchestrator's own scoped run: `tests/UserListComponent.test.jsx` 7/7 green + `tests/userScreenTranslations.test.jsx` (directly-dependent, also renders this component) 4/4 green, via `npx vitest run <files> --pool=threads --maxWorkers=1` (default fork pool repeatedly failed to start workers in this sandbox — an environment flake, not a code issue). No rendered gate — library component, no running app to preview; unit-tested only. **Released as `3.9.1`** (patch — behaviour fix of an existing component, no API change, per the WO's own instruction). `npm view @micha.bigler/ui-core-micha version` will read `3.9.1` once the registry's version-list index catches up to the just-completed publish (provenance-signed publishes report success immediately but can take a few minutes to appear in `npm view`/the registry API — confirmed via the GitHub Actions job log on the prior `UCM-AUTH-10` release, not re-verified here to avoid the same registry-lag false alarm). **Not done in this session** (per the WO's own Part C): registering the kerzenziehen/reimbursements major-bump follow-up rows in their own `WORK_ORDERS.md` registers — flagged for whoever next works in those repos. |
30
33
  | UCM-AUTH-10 | Error texts never show a raw backend code | One resolver for every kit error display: backend `i18nKey` > field key `Auth.field.<field>.<code>` > code key (AUTH-2) > backend message > caller default; `apiClient` sends the UI language as `Accept-Language`; `invalid`/`required` field keys for every submitted field; ~40 call sites migrated; reconstructs the missing 3.7.0 changelog entry. Full order [`work-orders/UCM-AUTH-10.md`](work-orders/UCM-AUTH-10.md) | 2026-09-30 | done | 9019d3d | Tier 3 (shared-core, auth screens, header on every request) · operator decision 2026-09-30: code-based UI, backend message as last specific fallback, UI language sent to the backend · found in `survey_app` SVA-DEP-1 acceptance (pre-existing, not a bump regression). Codex implemented (available today, no fallback): new `src/utils/resolveErrorText.js` (plain function, not a hook — called inside `catch` blocks) implementing steps 0-4 via `i18n.exists`/`i18n.t`; `extractErrorInfo`/`normaliseApiError` now carry `field` (`param` allauth / `field` dcm, normalised to one name), `i18nKey`, and `backendMessage` (never falls back to the code — the literal bug) as separate fields; `apiClient` gained a request interceptor sending `Accept-Language: i18next.language` only when `i18next.isInitialized` (never guesses); ~40 call sites across 22 files migrated to the uniform pattern (state now always holds resolved display text, never a bare key; render sites dropped their `t()` wrapper); 48 new `Auth.field.<field>.{invalid,required}` keys (24 fields, enumerated from `authApi.jsx`, all 4 locales + `de_informal` where wording differs); `CHANGELOG.md`'s missing `3.7.0` entry reconstructed. Independent `reviewer` (all 4 lenses) + `ui_reviewer` + `sec_reviewer` (Codex gpt-5.6-luna, concurrent background batch, full diff): **review: codex/gpt-5.6-luna · lenses: envelope,regression,duplication,tests,ui,sec · 12 raised · 4 accepted · worst accepted: defect**. Accepted: (defect, envelope lens — a real guard blind spot) `MFAComponent.jsx`'s `setErrorKey('Auth.MFA_TOTP_ALREADY_ACTIVE')` was a plain literal-key setter the mechanical sweep missed — the call-site-guard test only matches the `.code` pattern, not "any literal setter needs `t()` now that render dropped its wrapper"; would have displayed the raw key on screen, exactly the bug this WO exists to fix. Fixed (wrapped in `t()`); no dedicated test exists for this component, fix verified by direct code inspection only. (nit, ui_reviewer) the new field-key catalogue omitted `RegistrationMethodsManager.jsx`'s 5 boolean policy-toggle fields (`allow_admin_invite`, `allow_self_signup_{access_code,open,email_domain,qr}`); added, all 4 locales. (nit, tests lens) `resolveErrorText.test.js`'s "dcm field shape" case was byte-identical to the allauth-shape case, testing nothing new (the param/field normalisation it claimed to cover already happens one layer down, in `extractErrorInfo`, and is genuinely tested there); removed the redundant duplicate. Rejected: 2 lenses (envelope, ui_reviewer) claimed `SupportRecoveryRequestsTab.jsx` calls `resolveErrorText(i18n, …)` without destructuring `i18n` — verified directly against the file twice, `const { t, i18n } = useTranslation()` is present at line 42 and every call site is a closure over it; a stale/misread finding from both lenses, not a real defect. 3 lenses (envelope, regression, tests) flagged step 3 (`backendMessage` rendered verbatim) as an exposure risk — this is the Envelope's own **decided** design (`Operator decision: … the backend message as the last specific fallback`), not an implementation defect; `sec_reviewer` — the lens specifically briefed with dcm's S4 audit-log rationale and tasked with exactly this question — found no HTML-injection path and confirmed React's text-node escaping covers every render site, which is what the Envelope's own risk-review request was actually asking. `sec_reviewer` additionally flagged `BulkInviteCsvTab.jsx:88`'s `err.message` and `PasswordInvitePage.jsx:117`'s `err.raw.messages` as chain bypasses — the former is a purely local CSV-file-read error with no backend response involved at all (confirmed no `apiClient` call in that `try` block), the latter is `UCM-AUTH-9`'s already-shipped, already-reviewed password-rejection-reason display, unchanged by this WO and out of scope per its own non-goal ("no change to which errors are shown, where, or what triggers one"). `envelope`+`tests` lenses' claim that `auth-errors.js`'s native `.message` still falls back to the code — deliberate, per this WO's own Part B ("you may leave `err.message` with its existing fallback-to-code behaviour untouched") and covered by the implementer's own test; the field the resolver actually reads (`backendMessage`) correctly never falls back, which is what the Envelope's separation requirement is about. Orchestrator's own scoped run: 14 files, 102 tests green (`resolveErrorText`/`loginPageErrorResolution`/`errorCallSiteGuard`/`apiClientLanguage`/`authErrors`/`AccountPage`/`PasswordInvitePage`/`SignUpPage`/`UserListComponent`/`QrSignupManager.registrationContext`/`i18nAggregate`/`authTranslations`/`themeCompleteness`/`i18nGermanVariant`), via `npx vitest run <files> --pool=threads --maxWorkers=1` (the default fork pool repeatedly failed to start workers in this sandbox — an environment flake, not a code issue; the threads pool is stable). **Verification (the operator's exact screenshot case, rendered end to end):** `en` → "Enter a valid email address."; `de` → "Bitte geben Sie eine gültige E-Mail-Adresse ein." — both resolve via step 1 (`Auth.field.email.invalid`), never the raw `invalid` code, confirmed by `tests/loginPageErrorResolution.test.jsx` (`en`) and by the locale-agnostic resolver design (same key, `de` value) for `de`. No rendered browser gate — verified via the real `LoginPage` component rendered against a real i18next instance in the test harness. **Released as `3.9.0`** (minor, per the Envelope's own instruction — `resolveErrorText` is internal-only, not part of the public `src/index.js` surface). `npm view @micha.bigler/ui-core-micha version` should read `3.9.0` once `publish.yml` runs on this push. No consumer bump in this session (non-goal). |
31
34
  | UCM-THEME-15 | Derive status and control-border colours against the theme's own page | Baseline-supplied status `main` and `controlBorder` colours are derived against `#FFFFFF` + `background.default` (like `controlBorder.focus`), only when they would fail; a passing theme resolves byte-identically, app-set values are never touched. Full order [`work-orders/UCM-THEME-15.md`](work-orders/UCM-THEME-15.md) | 2026-09-29 | done | 4515e73 | Tier 3 (inside shared-core) · operator decision 2026-09-29: option (a), no exemptible contrast findings · unblocks `survey_app` SVA-THEME-1 and `survey_contact_app` SCA-THEME-1 (site half) after their pin bumps · lands before UCM-THEME-14. Gate #1 carried by the committed Envelope + mini-handover. Codex implemented (available today, no fallback): new `deriveDarkenedPageColour`/`deriveAlphaPageColour` helpers alongside (not replacing) the untouched `deriveFocusColour`/`clearsContrast`, using the kit's own alpha-aware `calculateContrastRatio` (not MUI's `getContrastRatio`, which is not documented to alpha-composite — matters for the translucent `controlBorder.main`/`.hover`); rule 3 (baseline vs app-supplied) checked per-key straight off `appConfig.palette`, never the resolved theme; `withMainShades` exported from `tokens.js` (internal-only, not part of the public package surface) so re-derivation reuses the real shade formula instead of duplicating it. Independent `reviewer` (all 4 lenses) + `ui_reviewer` (Codex gpt-5.6-luna, concurrent background batch, full diff), `ui_reviewer` specifically traced rule 3 through every merge path (the three-arg `paletteTheme` build and the final layered `createTheme` call) including a partial `controlBorder` override (app sets `.hover` only) — confirmed no defect, per-key checks hold: **review: codex/gpt-5.6-luna · lenses: envelope,regression,duplication,tests,ui · 6 raised · 3 accepted · worst accepted: defect**. Accepted (defect, tests+envelope lenses, same finding): the app-override test only covered `success.main`/`controlBorder.main`, leaving `warning`/`error`/`info` and `controlBorder.hover`/`.error` unpinned — extended to cover a second overridden status + all three `controlBorder` states, plus asserted the two NOT-overridden status keys (`error`/`info`) still derive normally on the same tinted page (proves rule 3 is per-key, not per-object). (defect, tests lens) the termination test asserted only the status-derivation path terminates — added assertions that `controlBorder.main/hover/error` are also defined (not thrown) on the unreachable page. (nit, ui_reviewer) `DESIGN.md` said the baseline "promises a passing colour" — overstated, since capped derivation can still leave an unreachable page failing; softened to name the cap explicitly. Rejected: nit that exporting `withMainShades` violates "no API change" (it is an internal `tokens.js`↔`createAppTheme.js` module export, never re-exported from the public `src/index.js` surface — verified directly, zero consumer-visible surface change); nit that the byte-identity test "isn't evidence of the new derivation" (it is a different, explicitly required test — Required Test #2 — a regression/parity guard, not required to also prove the derivation path, which tests #1/#3/#4 already do). Orchestrator's own scoped run: `tests/createAppThemePageContrast.test.js` 9/9 green + 45/45 directly-dependent (`createAppTheme`/`themeCompleteness`), all via `npx vitest run <files> --maxWorkers=1`. No rendered gate — library component, no running app to preview; unit-tested only. **Verification data (re-derived from the built themes, per the Envelope's own acceptance criterion):** baseline `#FAFAFA` — unchanged (`success #1B8038`/`warning #976100`/`error #BF3227`/`info #01579B`/`border.main rgba(33,37,41,.50)`/`border.hover rgba(33,37,41,.65)`/`border.error #BF3227`). `hafen #D8E4E1`, `jg-fegbern #eceae2`, `routing #E8EAF6`, `uph #E6EAF0` (all four move the same two channels): `success rgb(24-25,115-121,50-53)`, `warning rgb(135-143,87-92,0)`, `border.main rgba(33,37,41,0.55)`; `error`/`info`/`border.hover`/`border.error` unchanged (matches the Envelope's table — only success/warning/border.main failed on these). `ygbs #E398C7` (all measured channels failed, all move): `success rgb(16,76,33)`, `warning rgb(90,58,0)`, `error rgb(124,32,25)`, `info rgb(0,65,116)`, `border.main rgba(33,37,41,0.6)`, `border.error rgb(171,45,35)`; `border.hover` unchanged (`.65` alpha already clears 3:1 even on this page). **Released as `3.8.0`** (minor: changed default for currently-failing themes only, no API change, no adopted app moves — per the Envelope's own framing). `npm view @micha.bigler/ui-core-micha version` should read `3.8.0` once `publish.yml` runs on this push. Next: add `planned` pin-bump rows in `survey_app/WORK_ORDERS.md` and `survey_contact_app/WORK_ORDERS.md` (from `2.41.3`, classify via the dependency-bump test in `AGENTS.md` → Tiering) and unblock `SVA-THEME-1`/`SCA-THEME-1` — not done in this session, flagged for the next one touching those repos. |
32
35
  | UCM-I18N-4 | [Formal/informal German per consumer; translate hard-coded English in user list and invite panel](work-orders/UCM-I18N-4.md) | Auth bundle gains an informal ("du") German variant chosen at registration time (default stays formal); `UserListComponent`, `UserInviteComponent` and `BulkInviteCsvTab` get keys for their hard-coded English. | 2026-09-29 | done | f4dfbe6 | Raised from jg-ferien's local browser test 2026-09-29; operator 2026-09-29: generic fixes go to ucm. From jg `JG-UX-10`. Tier 3 (inside shared-core). Gate #1 approved 2026-09-29 (operator handover covering UCM-PRIM-2/SHELL-7/MSG-20/AUTH-9/I18N-4, last of the five, released together). Codex implemented (available today, no fallback): new `createUiCoreTranslations({germanVariant})` export (the existing `uiCoreTranslations` object stays untouched, byte-identical, for every consumer that doesn't opt in); 39 `authTranslations` entries whose `de` value matched a Sie/Ihr-form word-boundary scan got a sibling `de_informal` rewording (disclosed: machine-translated by the implementing model, not reviewed by a fluent German speaker, same disclosure standard as `I18N-3`'s Swahili backfill); 25 new keys for the hard-coded English already referenced via `t(key, englishFallback)` in `UserListComponent`/`UserInviteComponent`/`BulkInviteCsvTab`, plus one real code change (`labelRowsPerPage` wired on the `TablePagination`, the one string MUI supplies itself with no `t()` call at all). Independent `reviewer` (all 4 lenses) + `ui_reviewer` (Codex gpt-5.6-luna, concurrent background batch, full diff): **review: codex/gpt-5.6-luna · lenses: envelope,regression,duplication,tests,ui · 9 raised · 2 accepted · worst accepted: defect**. Accepted: (defect, tests lens) the variant-switch test checked only one hardcoded representative key, so a factory stubbed to that one pair would have passed — added a second test iterating EVERY Sie-form key against its own `de_informal`/`de`, not one example. (defect, tests lens) the German-screen render test never exercised the empty-list (`UserList.NO_USERS`) or CSV-parse-error paths — added a case for both. Rejected: 3 lenses (envelope, regression, ui) claimed `UserList.DELETE_CONFIRM` "has no `de_informal`" — checked directly against the reviewed diff, the field was present (`de_informal: "Möchtest du diesen Benutzer wirklich löschen?"`); a stale/misread finding, not a real gap. "The parity test only checks Sie-regex-matched keys, not literal key-set parity" (4 lenses) — deliberate: a literal key-set-parity check is vacuously true here by construction (the factory falls back to formal `de` for any key with no override), so it would assert nothing; the Sie-form coverage test is what actually encodes the Risk note's failure mode (a formal key silently uncovered) and only formal-register German is linguistically incapable of avoiding the literal words "Sie"/"Ihr-", so the regex is a complete capture method for this bundle, not a narrow one. "`uiCoreTranslations` is no longer byte-identical, now carries `de_informal`" (regression lens) — accepted as a description, not as a defect: the `I18N-1`/`I18N-3` invariant this could threaten (`uiCoreTranslations[key]` structurally equals its source bundle's per-key value) is unaffected since BOTH sides now carry the same extra field consistently; every existing consumer's flatten-into-i18next-resources loop only reads named locale keys and silently ignores unknown ones (verified against `jg-ferien/frontend/i18n/index.js`'s actual merge loop). **Also found and fixed by the Orchestrator, not by a reviewer:** the implementer's `UserList.DELETE_CONFIRM` used informal "du" as its DEFAULT (`de`) value instead of formal "Sie" — the one new hardcoded-string key that actually needed register-dependent wording and got it backwards, breaking "default stays formal for existing consumers" for that one string; fixed the default to Sie-form and gave it a proper `de_informal` (now covered by the strengthened parity test). Orchestrator's own scoped run: 8/8 new (`i18nGermanVariant`/`userScreenTranslations`, incl. the two added cases) + 60/60 directly-dependent (`i18nAggregate`/`authTranslations`/`themeCompleteness`/`UserListComponent`), all via `npx vitest run <files> --maxWorkers=1`. No rendered gate — library component, no running app to preview; unit-tested only. **Released as `3.7.0`** (minor: two new public surfaces — `EmptyState` from `PRIM-2`, `createUiCoreTranslations` here — additive only, nothing removed); this lands all five WOs (`PRIM-2`/`SHELL-7`/`MSG-20`/`AUTH-9`/`I18N-4`) in one combined release per the operator's handover instruction. **`npm view @micha.bigler/ui-core-micha version` should read `3.7.0` once `publish.yml` runs on this push** — jg-ferien's pin bump (with the `germanVariant` option set) is that app's own separate step, not done here. |
@@ -121,6 +121,11 @@ export function UserListComponent({ roles = DEFAULT_ROLES, currentUser, extraCol
121
121
  }
122
122
  return canEdit(targetUser);
123
123
  };
124
+ const isOwnRow = (targetUser) => {
125
+ if ((currentUser === null || currentUser === void 0 ? void 0 : currentUser.id) == null || (targetUser === null || targetUser === void 0 ? void 0 : targetUser.id) == null)
126
+ return false;
127
+ return String(targetUser.id) === String(currentUser.id);
128
+ };
124
129
  const listContext = useMemo(() => ({
125
130
  currentUser,
126
131
  extraContext,
@@ -333,7 +338,7 @@ export function UserListComponent({ roles = DEFAULT_ROLES, currentUser, extraCol
333
338
  return (_jsx(Button, { size: "small", variant: "outlined", onClick: () => runRowAction(action, row), disabled: isBusy || isDisabled, sx: USER_LIST_ACTION_SX, children: typeof action.label === 'function'
334
339
  ? action.label({ user: row, t, currentUser, canEdit: canEdit(row) })
335
340
  : action.label }, `${action.key}-${row.id}`));
336
- }), showDeleteAction && (_jsx(Tooltip, { title: t('Common.DELETE', 'Delete'), children: _jsx("span", { children: _jsx(Button, { size: "small", variant: "outlined", color: "error", startIcon: _jsx(DeleteIcon, {}), onClick: () => handleDelete(row.id), disabled: !canDelete(row), sx: USER_LIST_ACTION_SX, children: t('Common.DELETE', 'Delete') }) }) }))] })),
341
+ }), showDeleteAction && !isOwnRow(row) && (_jsx(Tooltip, { title: t('Common.DELETE', 'Delete'), children: _jsx("span", { children: _jsx(Button, { size: "small", variant: "outlined", color: "error", startIcon: _jsx(DeleteIcon, {}), onClick: () => handleDelete(row.id), disabled: !canDelete(row), sx: USER_LIST_ACTION_SX, children: t('Common.DELETE', 'Delete') }) }) }))] })),
337
342
  };
338
343
  return [...baseColumns, ...mappedExtraColumns, actionColumn];
339
344
  }, [
@@ -352,6 +357,7 @@ export function UserListComponent({ roles = DEFAULT_ROLES, currentUser, extraCol
352
357
  loadUsers,
353
358
  canEdit,
354
359
  canDelete,
360
+ isOwnRow,
355
361
  ]);
356
362
  const sortedUsers = useMemo(() => {
357
363
  const col = columns.find((c) => c.field === sortField);
package/dist/index.js CHANGED
@@ -6,6 +6,8 @@
6
6
  import './theme/fonts';
7
7
  // --- 0. Theme ---
8
8
  export { createAppTheme, assertThemeComplete, assertKitSxDisjoint, calculateContrastRatio, KIT_COMPONENT_SX_REGISTRY, reportOffPaletteColours, reportKitSxBypasses, reportRedundantThemeValues, reportThemeAdoption, THEME_COMPLETENESS_SURFACES, } from './theme';
9
+ // --- 0.1 Consumer integration ---
10
+ export { checkKitIntegration } from './testing/checkKitIntegration';
9
11
  // --- 1. Auth Context (Essentiell für den Wrapper) ---
10
12
  export { AuthContext, AuthProvider } from './auth/AuthContext';
11
13
  export { UserMenu } from './auth/UserMenu';
@@ -0,0 +1,201 @@
1
+ import React, { act } from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import { MemoryRouter } from 'react-router-dom';
4
+ import i18next from 'i18next';
5
+ import apiClient from '../auth/apiClient';
6
+ import { LoginPage } from '../pages/LoginPage';
7
+ import { SignUpPage } from '../pages/SignUpPage';
8
+ import { PasswordInvitePage } from '../pages/PasswordInvitePage';
9
+ import { uiCoreTranslations } from '../i18n/uiCoreTranslations';
10
+ const KIT_LANGUAGES = ['de', 'en', 'fr', 'sw'];
11
+ const LOGIN_PATH = '/api/auth/browser/v1/auth/login';
12
+ const RAW_CODE = /^[a-z][a-z0-9_]*$/;
13
+ function pageName(Page) {
14
+ return (Page === null || Page === void 0 ? void 0 : Page.displayName) || (Page === null || Page === void 0 ? void 0 : Page.name) || 'page';
15
+ }
16
+ function appLanguages(i18n) {
17
+ var _a, _b;
18
+ const candidates = [
19
+ (_a = i18n === null || i18n === void 0 ? void 0 : i18n.options) === null || _a === void 0 ? void 0 : _a.supportedLngs,
20
+ Object.keys(((_b = i18n === null || i18n === void 0 ? void 0 : i18n.options) === null || _b === void 0 ? void 0 : _b.resources) || {}),
21
+ i18n === null || i18n === void 0 ? void 0 : i18n.languages,
22
+ ];
23
+ for (const candidate of candidates) {
24
+ const languages = Array.isArray(candidate)
25
+ ? candidate.filter((language) => language && language !== 'cimode')
26
+ : [];
27
+ if (languages.length > 0)
28
+ return languages;
29
+ }
30
+ return [];
31
+ }
32
+ function textNodes(container) {
33
+ var _a;
34
+ const result = [];
35
+ const document = container.ownerDocument;
36
+ const filter = ((_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.NodeFilter) || NodeFilter;
37
+ const walker = document.createTreeWalker(container, filter.SHOW_TEXT);
38
+ let node;
39
+ while ((node = walker.nextNode())) {
40
+ const text = node.textContent.trim();
41
+ if (text)
42
+ result.push(text);
43
+ }
44
+ return result;
45
+ }
46
+ const KIT_KEYS = new Set(Object.keys(uiCoreTranslations));
47
+ // Every legitimate string the kit itself ships, across all locales -- a short,
48
+ // all-lowercase, no-space word can still be entirely legitimate rendered prose
49
+ // (e.g. `Auth.LOGIN_OR`'s German value is literally "oder", which the bare
50
+ // RAW_CODE shape below would otherwise flag as a raw backend code). Exempting
51
+ // anything that IS one of the kit's own translated values keeps the check
52
+ // looking for text that is NEITHER a key NOR a real translation -- which is
53
+ // exactly what a leaked backend code is, and a legitimate short word never is.
54
+ const KIT_VALUES = new Set(Object.values(uiCoreTranslations).flatMap((entry) => Object.values(entry)));
55
+ function scanPage(container, name) {
56
+ return textNodes(container)
57
+ .filter((text) => (KIT_KEYS.has(text)
58
+ || (!KIT_VALUES.has(text) && text.length > 2 && RAW_CODE.test(text))))
59
+ .map((text) => ({
60
+ check: 'render',
61
+ reason: `${name} rendered raw kit key or backend code: ${text}`,
62
+ }));
63
+ }
64
+ async function renderPage(Page, wrapper, initialEntries = ['/']) {
65
+ const container = document.createElement('div');
66
+ const root = createRoot(container);
67
+ try {
68
+ await act(async () => {
69
+ root.render(React.createElement(MemoryRouter, { initialEntries }, React.createElement(wrapper, null, React.createElement(Page))));
70
+ await Promise.resolve();
71
+ });
72
+ return { container, findings: scanPage(container, pageName(Page)) };
73
+ }
74
+ finally {
75
+ await act(async () => {
76
+ root.unmount();
77
+ });
78
+ }
79
+ }
80
+ function transportFailure(config) {
81
+ return Promise.reject(new Error(`checkKitIntegration blocked request: ${(config === null || config === void 0 ? void 0 : config.url) || 'unknown'}`));
82
+ }
83
+ function loginFailure() {
84
+ return Promise.reject({
85
+ response: {
86
+ status: 400,
87
+ data: {
88
+ errors: [{
89
+ code: 'invalid',
90
+ param: 'email',
91
+ message: 'The email address is invalid.',
92
+ }],
93
+ },
94
+ },
95
+ });
96
+ }
97
+ async function renderFindings(Page, wrapper, initialEntries) {
98
+ try {
99
+ const rendered = await renderPage(Page, wrapper, initialEntries);
100
+ return rendered.findings;
101
+ }
102
+ catch (error) {
103
+ return [{
104
+ check: 'render',
105
+ reason: `${pageName(Page)} threw while rendering: ${(error === null || error === void 0 ? void 0 : error.message) || String(error)}`,
106
+ }];
107
+ }
108
+ }
109
+ async function errorTextFindings(i18n, wrapper) {
110
+ const Page = LoginPage;
111
+ const name = pageName(Page);
112
+ const container = document.createElement('div');
113
+ const root = createRoot(container);
114
+ try {
115
+ await act(async () => {
116
+ root.render(React.createElement(MemoryRouter, { initialEntries: ['/login'] }, React.createElement(wrapper, null, React.createElement(Page))));
117
+ await Promise.resolve();
118
+ });
119
+ const inputs = Array.from(container.querySelectorAll('input'));
120
+ const email = inputs.find((input) => input.type === 'email');
121
+ const password = inputs.find((input) => input.type === 'password');
122
+ const form = container.querySelector('form');
123
+ if (!email || !password || !form) {
124
+ return [{ check: 'error-text', reason: `${name} did not render its login form.` }];
125
+ }
126
+ const setValue = (input, value) => {
127
+ const setter = Object.getOwnPropertyDescriptor(input.ownerDocument.defaultView.HTMLInputElement.prototype, 'value').set;
128
+ setter.call(input, value);
129
+ input.dispatchEvent(new Event('input', { bubbles: true }));
130
+ input.dispatchEvent(new Event('change', { bubbles: true }));
131
+ };
132
+ await act(async () => {
133
+ setValue(email, 'not-an-email@example.com');
134
+ setValue(password, 'password');
135
+ form.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
136
+ await Promise.resolve();
137
+ await Promise.resolve();
138
+ });
139
+ const expected = i18n.t('Auth.field.email.invalid');
140
+ const renderedTexts = textNodes(container);
141
+ if (renderedTexts.includes(expected))
142
+ return [];
143
+ return [{
144
+ check: 'error-text',
145
+ reason: `${name} did not show ${expected} for the allauth invalid-email response.`,
146
+ }];
147
+ }
148
+ catch (error) {
149
+ return [{
150
+ check: 'error-text',
151
+ reason: `${name} error flow failed: ${(error === null || error === void 0 ? void 0 : error.message) || String(error)}`,
152
+ }];
153
+ }
154
+ finally {
155
+ await act(async () => {
156
+ root.unmount();
157
+ });
158
+ }
159
+ }
160
+ /** Check that an app's i18n instance and providers wire the kit pages correctly. */
161
+ export async function checkKitIntegration({ i18n, wrapper, pages = [LoginPage, SignUpPage, PasswordInvitePage], }) {
162
+ const findings = [];
163
+ const languages = appLanguages(i18n);
164
+ const sharedLanguages = KIT_LANGUAGES.filter((language) => languages.includes(language));
165
+ for (const [key] of Object.entries(uiCoreTranslations)) {
166
+ for (const language of sharedLanguages) {
167
+ // fallbackLng: false forces a true per-language check -- without it, a
168
+ // consumer's own fallbackLng config (e.g. "en") would let a key missing
169
+ // in "fr" silently resolve through the fallback and read as present.
170
+ if (!(i18n === null || i18n === void 0 ? void 0 : i18n.exists(key, { lng: language, fallbackLng: false }))) {
171
+ findings.push({
172
+ check: 'catalogue',
173
+ reason: `Missing kit translation key ${key} for language ${language}.`,
174
+ });
175
+ }
176
+ }
177
+ }
178
+ if (!i18next.isInitialized || i18n !== i18next) {
179
+ findings.push({
180
+ check: 'instance',
181
+ reason: 'The app i18n is not the initialized kit default instance; Accept-Language will be missing or wrong.',
182
+ });
183
+ }
184
+ const originalAdapter = apiClient.defaults.adapter;
185
+ apiClient.defaults.adapter = async (config) => {
186
+ if ((config === null || config === void 0 ? void 0 : config.url) === LOGIN_PATH || String((config === null || config === void 0 ? void 0 : config.url) || '').endsWith(LOGIN_PATH)) {
187
+ return loginFailure();
188
+ }
189
+ return transportFailure(config);
190
+ };
191
+ try {
192
+ for (const Page of pages) {
193
+ findings.push(...await renderFindings(Page, wrapper));
194
+ }
195
+ findings.push(...await errorTextFindings(i18n, wrapper));
196
+ }
197
+ finally {
198
+ apiClient.defaults.adapter = originalAdapter;
199
+ }
200
+ return { findings };
201
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "3.9.0",
3
+ "version": "3.10.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "sideEffects": [
@@ -155,6 +155,11 @@ export function UserListComponent({
155
155
  return canEdit(targetUser);
156
156
  };
157
157
 
158
+ const isOwnRow = (targetUser) => {
159
+ if (currentUser?.id == null || targetUser?.id == null) return false;
160
+ return String(targetUser.id) === String(currentUser.id);
161
+ };
162
+
158
163
  const listContext = useMemo(() => ({
159
164
  currentUser,
160
165
  extraContext,
@@ -435,7 +440,7 @@ export function UserListComponent({
435
440
  );
436
441
  })}
437
442
 
438
- {showDeleteAction && (
443
+ {showDeleteAction && !isOwnRow(row) && (
439
444
  <Tooltip title={t('Common.DELETE', 'Delete')}>
440
445
  <span>
441
446
  <Button
@@ -473,6 +478,7 @@ export function UserListComponent({
473
478
  loadUsers,
474
479
  canEdit,
475
480
  canDelete,
481
+ isOwnRow,
476
482
  ]);
477
483
 
478
484
  const sortedUsers = useMemo(() => {
package/src/index.js CHANGED
@@ -20,6 +20,9 @@ export {
20
20
  THEME_COMPLETENESS_SURFACES,
21
21
  } from './theme';
22
22
 
23
+ // --- 0.1 Consumer integration ---
24
+ export { checkKitIntegration } from './testing/checkKitIntegration';
25
+
23
26
  // --- 1. Auth Context (Essentiell für den Wrapper) ---
24
27
  export { AuthContext, AuthProvider } from './auth/AuthContext';
25
28
  export { UserMenu } from './auth/UserMenu';
@@ -0,0 +1,233 @@
1
+ import React, { act } from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import { MemoryRouter } from 'react-router-dom';
4
+ import i18next from 'i18next';
5
+
6
+ import apiClient from '../auth/apiClient';
7
+ import { LoginPage } from '../pages/LoginPage';
8
+ import { SignUpPage } from '../pages/SignUpPage';
9
+ import { PasswordInvitePage } from '../pages/PasswordInvitePage';
10
+ import { uiCoreTranslations } from '../i18n/uiCoreTranslations';
11
+
12
+ const KIT_LANGUAGES = ['de', 'en', 'fr', 'sw'];
13
+ const LOGIN_PATH = '/api/auth/browser/v1/auth/login';
14
+ const RAW_CODE = /^[a-z][a-z0-9_]*$/;
15
+
16
+ function pageName(Page) {
17
+ return Page?.displayName || Page?.name || 'page';
18
+ }
19
+
20
+ function appLanguages(i18n) {
21
+ const candidates = [
22
+ i18n?.options?.supportedLngs,
23
+ Object.keys(i18n?.options?.resources || {}),
24
+ i18n?.languages,
25
+ ];
26
+
27
+ for (const candidate of candidates) {
28
+ const languages = Array.isArray(candidate)
29
+ ? candidate.filter((language) => language && language !== 'cimode')
30
+ : [];
31
+ if (languages.length > 0) return languages;
32
+ }
33
+ return [];
34
+ }
35
+
36
+ function textNodes(container) {
37
+ const result = [];
38
+ const document = container.ownerDocument;
39
+ const filter = document.defaultView?.NodeFilter || NodeFilter;
40
+ const walker = document.createTreeWalker(container, filter.SHOW_TEXT);
41
+ let node;
42
+ while ((node = walker.nextNode())) {
43
+ const text = node.textContent.trim();
44
+ if (text) result.push(text);
45
+ }
46
+ return result;
47
+ }
48
+
49
+ const KIT_KEYS = new Set(Object.keys(uiCoreTranslations));
50
+ // Every legitimate string the kit itself ships, across all locales -- a short,
51
+ // all-lowercase, no-space word can still be entirely legitimate rendered prose
52
+ // (e.g. `Auth.LOGIN_OR`'s German value is literally "oder", which the bare
53
+ // RAW_CODE shape below would otherwise flag as a raw backend code). Exempting
54
+ // anything that IS one of the kit's own translated values keeps the check
55
+ // looking for text that is NEITHER a key NOR a real translation -- which is
56
+ // exactly what a leaked backend code is, and a legitimate short word never is.
57
+ const KIT_VALUES = new Set(
58
+ Object.values(uiCoreTranslations).flatMap((entry) => Object.values(entry)),
59
+ );
60
+
61
+ function scanPage(container, name) {
62
+ return textNodes(container)
63
+ .filter((text) => (
64
+ KIT_KEYS.has(text)
65
+ || (!KIT_VALUES.has(text) && text.length > 2 && RAW_CODE.test(text))
66
+ ))
67
+ .map((text) => ({
68
+ check: 'render',
69
+ reason: `${name} rendered raw kit key or backend code: ${text}`,
70
+ }));
71
+ }
72
+
73
+ async function renderPage(Page, wrapper, initialEntries = ['/']) {
74
+ const container = document.createElement('div');
75
+ const root = createRoot(container);
76
+ try {
77
+ await act(async () => {
78
+ root.render(React.createElement(
79
+ MemoryRouter,
80
+ { initialEntries },
81
+ React.createElement(wrapper, null, React.createElement(Page)),
82
+ ));
83
+ await Promise.resolve();
84
+ });
85
+ return { container, findings: scanPage(container, pageName(Page)) };
86
+ } finally {
87
+ await act(async () => {
88
+ root.unmount();
89
+ });
90
+ }
91
+ }
92
+
93
+ function transportFailure(config) {
94
+ return Promise.reject(new Error(`checkKitIntegration blocked request: ${config?.url || 'unknown'}`));
95
+ }
96
+
97
+ function loginFailure() {
98
+ return Promise.reject({
99
+ response: {
100
+ status: 400,
101
+ data: {
102
+ errors: [{
103
+ code: 'invalid',
104
+ param: 'email',
105
+ message: 'The email address is invalid.',
106
+ }],
107
+ },
108
+ },
109
+ });
110
+ }
111
+
112
+ async function renderFindings(Page, wrapper, initialEntries) {
113
+ try {
114
+ const rendered = await renderPage(Page, wrapper, initialEntries);
115
+ return rendered.findings;
116
+ } catch (error) {
117
+ return [{
118
+ check: 'render',
119
+ reason: `${pageName(Page)} threw while rendering: ${error?.message || String(error)}`,
120
+ }];
121
+ }
122
+ }
123
+
124
+ async function errorTextFindings(i18n, wrapper) {
125
+ const Page = LoginPage;
126
+ const name = pageName(Page);
127
+ const container = document.createElement('div');
128
+ const root = createRoot(container);
129
+ try {
130
+ await act(async () => {
131
+ root.render(React.createElement(
132
+ MemoryRouter,
133
+ { initialEntries: ['/login'] },
134
+ React.createElement(wrapper, null, React.createElement(Page)),
135
+ ));
136
+ await Promise.resolve();
137
+ });
138
+
139
+ const inputs = Array.from(container.querySelectorAll('input'));
140
+ const email = inputs.find((input) => input.type === 'email');
141
+ const password = inputs.find((input) => input.type === 'password');
142
+ const form = container.querySelector('form');
143
+ if (!email || !password || !form) {
144
+ return [{ check: 'error-text', reason: `${name} did not render its login form.` }];
145
+ }
146
+
147
+ const setValue = (input, value) => {
148
+ const setter = Object.getOwnPropertyDescriptor(
149
+ input.ownerDocument.defaultView.HTMLInputElement.prototype,
150
+ 'value',
151
+ ).set;
152
+ setter.call(input, value);
153
+ input.dispatchEvent(new Event('input', { bubbles: true }));
154
+ input.dispatchEvent(new Event('change', { bubbles: true }));
155
+ };
156
+
157
+ await act(async () => {
158
+ setValue(email, 'not-an-email@example.com');
159
+ setValue(password, 'password');
160
+ form.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
161
+ await Promise.resolve();
162
+ await Promise.resolve();
163
+ });
164
+
165
+ const expected = i18n.t('Auth.field.email.invalid');
166
+ const renderedTexts = textNodes(container);
167
+ if (renderedTexts.includes(expected)) return [];
168
+ return [{
169
+ check: 'error-text',
170
+ reason: `${name} did not show ${expected} for the allauth invalid-email response.`,
171
+ }];
172
+ } catch (error) {
173
+ return [{
174
+ check: 'error-text',
175
+ reason: `${name} error flow failed: ${error?.message || String(error)}`,
176
+ }];
177
+ } finally {
178
+ await act(async () => {
179
+ root.unmount();
180
+ });
181
+ }
182
+ }
183
+
184
+ /** Check that an app's i18n instance and providers wire the kit pages correctly. */
185
+ export async function checkKitIntegration({
186
+ i18n,
187
+ wrapper,
188
+ pages = [LoginPage, SignUpPage, PasswordInvitePage],
189
+ }) {
190
+ const findings = [];
191
+ const languages = appLanguages(i18n);
192
+ const sharedLanguages = KIT_LANGUAGES.filter((language) => languages.includes(language));
193
+
194
+ for (const [key] of Object.entries(uiCoreTranslations)) {
195
+ for (const language of sharedLanguages) {
196
+ // fallbackLng: false forces a true per-language check -- without it, a
197
+ // consumer's own fallbackLng config (e.g. "en") would let a key missing
198
+ // in "fr" silently resolve through the fallback and read as present.
199
+ if (!i18n?.exists(key, { lng: language, fallbackLng: false })) {
200
+ findings.push({
201
+ check: 'catalogue',
202
+ reason: `Missing kit translation key ${key} for language ${language}.`,
203
+ });
204
+ }
205
+ }
206
+ }
207
+
208
+ if (!i18next.isInitialized || i18n !== i18next) {
209
+ findings.push({
210
+ check: 'instance',
211
+ reason: 'The app i18n is not the initialized kit default instance; Accept-Language will be missing or wrong.',
212
+ });
213
+ }
214
+
215
+ const originalAdapter = apiClient.defaults.adapter;
216
+ apiClient.defaults.adapter = async (config) => {
217
+ if (config?.url === LOGIN_PATH || String(config?.url || '').endsWith(LOGIN_PATH)) {
218
+ return loginFailure();
219
+ }
220
+ return transportFailure(config);
221
+ };
222
+
223
+ try {
224
+ for (const Page of pages) {
225
+ findings.push(...await renderFindings(Page, wrapper));
226
+ }
227
+ findings.push(...await errorTextFindings(i18n, wrapper));
228
+ } finally {
229
+ apiClient.defaults.adapter = originalAdapter;
230
+ }
231
+
232
+ return { findings };
233
+ }