Repository navigation
feat(labeler): operator console SPA scaffold (W9.3, client only) - #2006
Conversation
|
Scope checkThis PR changes 2,560 lines across 45 files. Large PRs are harder to review and more likely to be closed without review. If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs. See CONTRIBUTING.md for contribution guidelines. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-playground | 9a2bf83 | Jul 13 2026, 12:20 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-do | 9a2bf83 | Jul 13 2026, 12:20 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-cache | 9a2bf83 | Jul 13 2026, 12:20 PM |
There was a problem hiding this comment.
The approach is sound for the W9.3 client-only scaffold: a colocated Vite React SPA that mirrors the admin package's conventions (TanStack Router, Lingui, RTL-safe logical Tailwind, Kumo) without taking a dependency on @emdash-cms/admin. The public/private finding split in FindingCard correctly surfaces the operator-only boundary described in the moderation spec. I read every new console source file, the fixture layer, the test files, and the updated labeler package config; I also searched for physical Tailwind classes, dark: prefixes, and unlocalized strings and found none.
The PR is mostly clean, but there are a few real issues to tighten before the follow-up server work:
- The inert fetch client uses an unwrapped
{ data: T }envelope. Because the console already sends the EmDash CSRF header (X-EmDash-Request: 1) and is planned to live under/admin/api/*, it should almost certainly consume the sameApiResult<T>envelope as the rest of EmDash ({ success, data }). If the labeler's admin API will intentionally use a different shape, that needs to be documented; otherwise future routes will silently misparse. - Frontend-only dependencies are listed as runtime
dependenciesof the Worker package.react,@cloudflare/kumo, Tailwind-related packages, etc. are only needed to build the console. They should move todevDependenciesso the labeler Worker install/bundle isn't polluted with browser runtime code. - The labeler's default
typecheckandtestscripts don't cover the console.tsgo --noEmitandvitest runonly target the Worker source; the console has separateconsole:typecheck/console:testscripts. At minimum these should be chained into the package's default scripts so CI doesn't let the console bit-rot. - A generated
messages.pois included in a feature PR. AGENTS.md instructs not to include catalog updates in non-translation PRs because line-number references churn. The console catalog should be generated by the extract workflow/CI instead.
None of these are blockers for an inert, client-only scaffold, but #1 is a broken contract that will bite when /admin/api/* routes land.
| async function parseJson<T>(response: Response, fallback: string): Promise<T> { | ||
| if (!response.ok) { | ||
| const body: unknown = await response.json().catch(() => undefined); | ||
| const message = | ||
| isApiErrorBody(body) && typeof body.error?.message === "string" | ||
| ? body.error.message | ||
| : fallback; | ||
| throw new Error(message); | ||
| } | ||
| const body: { data: T } = await response.json(); |
There was a problem hiding this comment.
[needs fixing] parseJson assumes the future /admin/api/* responses are shaped as { data: T }, but EmDash's handler layer returns ApiResult<T> ({ success: true, data } / { success: false, error }). Since this client already sends EmDash's CSRF header (X-EmDash-Request: 1) and is planned for the same /admin origin, it will mis-parse successful responses and mis-surface errors once the server routes exist.
| async function parseJson<T>(response: Response, fallback: string): Promise<T> { | |
| if (!response.ok) { | |
| const body: unknown = await response.json().catch(() => undefined); | |
| const message = | |
| isApiErrorBody(body) && typeof body.error?.message === "string" | |
| ? body.error.message | |
| : fallback; | |
| throw new Error(message); | |
| } | |
| const body: { data: T } = await response.json(); | |
| async function parseJson<T>(response: Response, fallback: string): Promise<T> { | |
| if (!response.ok) { | |
| const body: unknown = await response.json().catch(() => undefined); | |
| const message = | |
| isApiErrorBody(body) && typeof body.error?.message === "string" | |
| ? body.error.message | |
| : fallback; | |
| throw new Error(message); | |
| } | |
| const body: { success: boolean; data: T; error?: { code: string; message: string } } = | |
| await response.json(); | |
| if (!body.success) { | |
| throw new Error(body.error?.message ?? fallback); | |
| } | |
| return body.data; | |
| } |
If the labeler's admin API is intentionally using an unwrapped envelope, document that divergence in a comment here instead.
There was a problem hiding this comment.
I don't think the mis-parse exists on this side: routes built on core's utilities never emit raw ApiResult — unwrapResult → apiSuccess wraps success as { data } (packages/core/src/api/error.ts:51) and apiError emits nested { error: { code, message } }, which is exactly what parseJson reads on both paths. This thread did surface a real mismatch on the other side though: the W9.2 mutation guard's toResponse() was emitting a flat { error: code, message } — it's being aligned to core's nested shape in that PR, so the two land consistent.
~ 🤖 Fable
| "@atcute/lexicons": "catalog:", | ||
| "@atcute/repo": "catalog:", | ||
| "@atcute/xrpc-server": "catalog:", | ||
| "@cloudflare/kumo": "catalog:", |
There was a problem hiding this comment.
[suggestion] Console-only packages (@cloudflare/kumo, react, @tanstack/react-*, clsx, tailwind-merge, etc.) were added as runtime dependencies of the labeler Worker. They are only needed to build/serve the browser console, so they belong in devDependencies to keep the Worker install/bundle free of frontend runtime code.
| "@cloudflare/kumo": "catalog:", | |
| "dependencies": { | |
| "@atcute/cbor": "catalog:", | |
| "@atcute/crypto": "catalog:", | |
| "@atcute/identity": "catalog:", | |
| "@atcute/identity-resolver": "catalog:", | |
| "@atcute/jetstream": "catalog:", | |
| "@atcute/lexicons": "catalog:", | |
| "@atcute/repo": "catalog:", | |
| "@atcute/xrpc-server": "catalog:", | |
| "@emdash-cms/registry-lexicons": "workspace:*", | |
| "@emdash-cms/registry-moderation": "workspace:*", | |
| "ulidx": "^2.4.1" | |
| }, | |
| "devDependencies": { | |
| "@atcute/cid": "catalog:", | |
| "@cloudflare/kumo": "catalog:", | |
| "@cloudflare/vite-plugin": "catalog:", | |
| "@cloudflare/vitest-pool-workers": "catalog:", | |
| "@emdash-cms/atproto-test-utils": "workspace:*", | |
| "@lingui/babel-plugin-lingui-macro": "catalog:", | |
| "@lingui/cli": "catalog:", | |
| "@lingui/conf": "catalog:", | |
| "@lingui/core": "catalog:", | |
| "@lingui/macro": "catalog:", | |
| "@lingui/react": "catalog:", | |
| "@phosphor-icons/react": "catalog:", | |
| "@tailwindcss/vite": "^4.3.2", | |
| "@tanstack/react-query": "catalog:", | |
| "@tanstack/react-router": "catalog:", | |
| "@testing-library/react": "^16.3.0", | |
| "@types/node": "catalog:", | |
| "@types/react": "catalog:", | |
| "@types/react-dom": "catalog:", | |
| "@vitejs/plugin-react": "^5.2.0", | |
| "clsx": "^2.1.1", | |
| "jsdom": "^26.1.0", | |
| "react": "catalog:", | |
| "react-dom": "catalog:", | |
| "tailwind-merge": "^3.3.0", | |
| "tailwindcss": "^4.3.2", | |
| "typescript": "catalog:", | |
| "vite": "catalog:", | |
| "vitest": "catalog:", | |
| "wrangler": "catalog:" | |
| } |
There was a problem hiding this comment.
Applied in ca0e84f — all console-only packages (kumo, react, tanstack, lingui runtime, phosphor, clsx, tailwind-merge) moved to devDependencies; the Worker's runtime deps are back to the pre-console set.
~ 🤖 Fable
| @@ -12,7 +12,13 @@ | |||
| "typecheck": "tsgo --noEmit", | |||
There was a problem hiding this comment.
[suggestion] The package's default typecheck and test scripts only exercise the Worker code. The console has its own console:typecheck and console:test scripts, but they won't run in CI unless a maintainer remembers to call them explicitly. Run them as part of the default package checks so the console doesn't bit-rot.
| "typecheck": "tsgo --noEmit", | |
| "typecheck": "tsgo --noEmit && tsgo --noEmit -p console/tsconfig.json", | |
| "test": "vitest run && vitest run --config console/vitest.config.ts", |
Alternatively, wire the console scripts into the root workspace typecheck/test scripts so the entire repo is checked by the top-level commands.
There was a problem hiding this comment.
Applied in ca0e84f — typecheck and test now chain the console project (tsgo --noEmit -p console/tsconfig.json, vitest run --config console/vitest.config.ts), verified green: 274 Worker + 6 console tests.
~ 🤖 Fable
| @@ -0,0 +1,281 @@ | |||
| msgid "" | |||
There was a problem hiding this comment.
[suggestion] AGENTS.md asks not to include messages.po changes in non-translation PRs because the line-number references churn quickly and create merge conflicts. Since this is a feature PR, consider removing the committed .po file and generating it on demand via pnpm --filter @emdash-cms/labeler console:locale:extract, or leaving it out and letting the merge-to-main workflow produce the initial catalog.
There was a problem hiding this comment.
Keeping this one as-is, deliberately: the merge-to-main extract workflow is scoped to @emdash-cms/admin and doesn't produce console catalogs, and console:build compiles from this file — dropping it would break the build until someone runs extract manually. The rule you're citing exists to avoid churn on the admin catalog in unrelated PRs; this is the initial commit of a brand-new, self-contained catalog (mirroring packages/admin/src/locales/en/messages.po, which is likewise committed). Compiled .mjs output is gitignored.
~ 🤖 Fable
There was a problem hiding this comment.
The approach remains sound for the W9.3 client-only scaffold: a colocated Vite React SPA that mirrors the admin package's conventions (TanStack Router, Lingui, RTL-safe logical Tailwind, Kumo) without taking a runtime dependency on @emdash-cms/admin. The public/private finding split in FindingCard correctly surfaces the operator-only boundary.
Of the four issues I raised in the previous review:
- ✅ Fixed: frontend-only dependencies were moved from
dependenciestodevDependencies. - ✅ Fixed: the labeler package's default
typecheckandtestscripts now chain the console's typecheck and test commands. - 🔄 Retracted: my concern about the fetch client's
{ data: T }envelope was based on a misreading of admin conventions. EmDash's handlers returnApiResult<T>internally, but admin API routes unwrap that to{ data: T }on the wire (e.g.packages/core/src/astro/routes/api/manifest.ts), so the console'sparseJsonis consistent with the client it intends to consume. - ❌ Still open: the generated
apps/labeler/console/src/locales/en/messages.pocatalog is still committed in this feature PR.
I re-checked the new console source for physical Tailwind classes, dark: prefixes, and unlocalized strings and did not find any. The remaining catalog issue is an AGENTS.md convention violation, not a runtime bug, but it should be cleaned up before the follow-up server work.
| msgid "" | ||
| msgstr "" | ||
| "POT-Creation-Date: 2026-07-13 09:27+0100\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=utf-8\n" | ||
| "Content-Transfer-Encoding: 8bit\n" | ||
| "X-Generator: @lingui/cli\n" | ||
| "Language: en\n" | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:80 | ||
| #: src/routes/AssessmentDetail.tsx:84 | ||
| msgid "—" | ||
| msgstr "—" | ||
|
|
||
| #: src/routes/AssessmentList.tsx:59 | ||
| msgid "All states" | ||
| msgstr "All states" | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:56 | ||
| msgid "Assessment" | ||
| msgstr "Assessment" | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:49 | ||
| msgid "Assessment not found." | ||
| msgstr "Assessment not found." | ||
|
|
||
| #: src/components/Sidebar.tsx:46 | ||
| #: src/routes/AssessmentList.tsx:53 | ||
| msgid "Assessments" | ||
| msgstr "Assessments" | ||
|
|
||
| #: src/components/Sidebar.tsx:47 | ||
| #: src/routes/AuditLog.tsx:17 | ||
| msgid "Audit log" | ||
| msgstr "Audit log" | ||
|
|
||
| #: src/routes/AuditLog.tsx:20 | ||
| msgid "Audit log not yet available" | ||
| msgstr "Audit log not yet available" | ||
|
|
||
| #: src/components/StateBadge.tsx:37 | ||
| #: src/routes/AssessmentList.tsx:38 | ||
| msgid "Blocked" | ||
| msgstr "Blocked" | ||
|
|
||
| #: src/components/StateBadge.tsx:40 | ||
| msgid "Cancelled" | ||
| msgstr "Cancelled" | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:68 | ||
| #: src/routes/SubjectHistory.tsx:58 | ||
| msgid "CID" | ||
| msgstr "CID" | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:83 | ||
| msgid "Completed" | ||
| msgstr "Completed" | ||
|
|
||
| #: src/routes/Dashboard.tsx:42 | ||
| msgid "Connected" | ||
| msgstr "Connected" | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:77 | ||
| #: src/routes/AssessmentList.tsx:82 | ||
| #: src/routes/SubjectHistory.tsx:61 | ||
| msgid "Created" | ||
| msgstr "Created" | ||
|
|
||
| #: src/components/SeverityBadge.tsx:23 | ||
| msgid "Critical" | ||
| msgstr "Critical" | ||
|
|
||
| #: src/routes/SubjectHistory.tsx:40 | ||
| msgid "Current CID" | ||
| msgstr "Current CID" | ||
|
|
||
| #: src/components/Sidebar.tsx:45 | ||
| #: src/routes/Dashboard.tsx:36 | ||
| msgid "Dashboard" | ||
| msgstr "Dashboard" | ||
|
|
||
| #: src/routes/SubjectHistory.tsx:44 | ||
| msgid "Deleted at" | ||
| msgstr "Deleted at" | ||
|
|
||
| #: src/routes/Dashboard.tsx:42 | ||
| msgid "Disconnected" | ||
| msgstr "Disconnected" | ||
|
|
||
| #: src/routes/Dashboard.tsx:47 | ||
| msgid "Discovery queue depth" | ||
| msgstr "Discovery queue depth" | ||
|
|
||
| #: src/components/StateBadge.tsx:38 | ||
| #: src/routes/AssessmentList.tsx:39 | ||
| msgid "Error" | ||
| msgstr "Error" | ||
|
|
||
| #: src/components/FindingCard.tsx:42 | ||
| msgid "Evidence" | ||
| msgstr "Evidence" | ||
|
|
||
| #: src/routes/AssessmentList.tsx:55 | ||
| msgid "Filter by state" | ||
| msgstr "Filter by state" | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:120 | ||
| msgid "Findings" | ||
| msgstr "Findings" | ||
|
|
||
| #: src/components/Header.tsx:15 | ||
| msgid "Fixture data" | ||
| msgstr "Fixture data" | ||
|
|
||
| #: src/components/SeverityBadge.tsx:24 | ||
| msgid "High" | ||
| msgstr "High" | ||
|
|
||
| #: src/components/SeverityBadge.tsx:27 | ||
| msgid "Info" | ||
| msgstr "Info" | ||
|
|
||
| #: src/routes/Dashboard.tsx:39 | ||
| msgid "Jetstream connection" | ||
| msgstr "Jetstream connection" | ||
|
|
||
| #: src/components/Sidebar.tsx:54 | ||
| msgid "Labeler console" | ||
| msgstr "Labeler console" | ||
|
|
||
| #: src/components/Sidebar.tsx:51 | ||
| msgid "Labeler console navigation" | ||
| msgstr "Labeler console navigation" | ||
|
|
||
| #: src/routes/Dashboard.tsx:58 | ||
| msgid "Labeler DID" | ||
| msgstr "Labeler DID" | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:103 | ||
| msgid "Labels" | ||
| msgstr "Labels" | ||
|
|
||
| #: src/routes/Dashboard.tsx:49 | ||
| msgid "Last reconciliation" | ||
| msgstr "Last reconciliation" | ||
|
|
||
| #: src/components/SeverityBadge.tsx:26 | ||
| msgid "Low" | ||
| msgstr "Low" | ||
|
|
||
| #: src/components/SeverityBadge.tsx:25 | ||
| msgid "Medium" | ||
| msgstr "Medium" | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:76 | ||
| msgid "Model" | ||
| msgstr "Model" | ||
|
|
||
| #: src/routes/AssessmentList.tsx:116 | ||
| msgid "More assessments available." | ||
| msgstr "More assessments available." | ||
|
|
||
| #: src/routes/Dashboard.tsx:53 | ||
| msgid "Never" | ||
| msgstr "Never" | ||
|
|
||
| #: src/routes/AssessmentList.tsx:74 | ||
| msgid "No assessments found." | ||
| msgstr "No assessments found." | ||
|
|
||
| #: src/routes/SubjectHistory.tsx:52 | ||
| msgid "No assessments recorded for this subject." | ||
| msgstr "No assessments recorded for this subject." | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:124 | ||
| msgid "No findings recorded for this run." | ||
| msgstr "No findings recorded for this run." | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:107 | ||
| msgid "No labels issued for this run." | ||
| msgstr "No labels issued for this run." | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:76 | ||
| msgid "None" | ||
| msgstr "None" | ||
|
|
||
| #: src/routes/NotFound.tsx:11 | ||
| msgid "Not found" | ||
| msgstr "Not found" | ||
|
|
||
| #: src/components/StateBadge.tsx:31 | ||
| msgid "Observed" | ||
| msgstr "Observed" | ||
|
|
||
| #: src/routes/AuditLog.tsx:21 | ||
| msgid "Operator action history ships once the audit table lands." | ||
| msgstr "Operator action history ships once the audit table lands." | ||
|
|
||
| #: src/components/StateBadge.tsx:35 | ||
| #: src/routes/AssessmentList.tsx:36 | ||
| msgid "Passed" | ||
| msgstr "Passed" | ||
|
|
||
| #: src/components/StateBadge.tsx:33 | ||
| #: src/routes/AssessmentList.tsx:35 | ||
| msgid "Pending" | ||
| msgstr "Pending" | ||
|
|
||
| #: src/routes/Dashboard.tsx:46 | ||
| msgid "Pending assessments" | ||
| msgstr "Pending assessments" | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:75 | ||
| msgid "Policy version" | ||
| msgstr "Policy version" | ||
|
|
||
| #: src/components/FindingCard.tsx:37 | ||
| msgid "Private detail — operators only" | ||
| msgstr "Private detail — operators only" | ||
|
|
||
| #: src/components/FindingCard.tsx:31 | ||
| msgid "Public summary" | ||
| msgstr "Public summary" | ||
|
|
||
| #: src/components/StateBadge.tsx:34 | ||
| msgid "Running" | ||
| msgstr "Running" | ||
|
|
||
| #: src/components/StateBadge.tsx:39 | ||
| msgid "Stale" | ||
| msgstr "Stale" | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:79 | ||
| msgid "Started" | ||
| msgstr "Started" | ||
|
|
||
| #: src/routes/AssessmentList.tsx:80 | ||
| #: src/routes/SubjectHistory.tsx:59 | ||
| msgid "State" | ||
| msgstr "State" | ||
|
|
||
| #: src/routes/AssessmentList.tsx:79 | ||
| msgid "Subject" | ||
| msgstr "Subject" | ||
|
|
||
| #: src/routes/SubjectHistory.tsx:37 | ||
| msgid "Subject history" | ||
| msgstr "Subject history" | ||
|
|
||
| #: src/routes/SubjectHistory.tsx:29 | ||
| msgid "Subject not found." | ||
| msgstr "Subject not found." | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:58 | ||
| #: src/routes/AssessmentList.tsx:40 | ||
| #: src/routes/AssessmentList.tsx:98 | ||
| msgid "Superseded" | ||
| msgstr "Superseded" | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:88 | ||
| msgid "Supersedes" | ||
| msgstr "Supersedes" | ||
|
|
||
| #: src/routes/NotFound.tsx:12 | ||
| msgid "This page doesn't exist." | ||
| msgstr "This page doesn't exist." | ||
|
|
||
| #: src/routes/AssessmentDetail.tsx:74 | ||
| #: src/routes/AssessmentList.tsx:81 | ||
| #: src/routes/SubjectHistory.tsx:60 | ||
| msgid "Trigger" | ||
| msgstr "Trigger" | ||
|
|
||
| #: src/components/StateBadge.tsx:32 | ||
| msgid "Verifying" | ||
| msgstr "Verifying" | ||
|
|
||
| #: src/components/StateBadge.tsx:36 | ||
| #: src/routes/AssessmentList.tsx:37 | ||
| msgid "Warned" | ||
| msgstr "Warned" |
There was a problem hiding this comment.
[needs fixing] This PR includes the freshly-extracted Lingui catalog as a new file. AGENTS.md says not to include messages.po changes in non-translation PRs because the line-number reference comments create merge churn; extraction should be left to the pnpm locale:extract workflow/CI. Remove this generated catalog from the PR. Dev builds already fall back to message ids (the English source strings), and production can compile the catalog from a CI-extracted messages.po when the console's i18n workflow is wired up.
There was a problem hiding this comment.
Applied in bd4704a, with a different mechanism than suggested: the auto-extract.yml workflow can't own this catalog — its guard explicitly rejects any staged path outside packages/admin/src/locales/*/messages.po. Instead, console:build now runs extract before compile, and the .po is gitignored alongside the compiled .mjs — nothing generated is committed, and there's no catalog to churn. Runtime fallback stays readable because the catalog uses natural-language ids and loadMessages returns {} when uncompiled. When real locales are added, translated catalogs get committed via translation PRs and the ignore narrows — that's also the point to extend the extract workflow to the console.
~ 🤖 Fable
There was a problem hiding this comment.
The approach remains sound: a client-only Vite React SPA that mirrors packages/admin conventions (TanStack Router, Lingui, RTL-safe logical Tailwind, Kumo) without taking a runtime dependency on @emdash-cms/admin. The public/private finding split in FindingCard correctly surfaces the operator-only boundary.
The previously flagged committed messages.po catalog is gone from the working tree and the diff, and the new .gitignore correctly ignores messages.po/messages.mjs so the merge-to-main extract workflow will not produce churn.
I re-checked the new console source for physical Tailwind classes, dark: prefixes, raw colors, and unlocalized JSX strings and did not find any. I also spot-checked the dependency split (console SPA deps live in apps/labeler/package.json devDependencies), the workerd pool exclusion for console/**, and the fixture client contract — all look correct.
There is one remaining RTL/i18n correctness issue: LocaleDirectionProvider is advertised as keeping <html> in sync with the active locale, but it hardcodes DEFAULT_LOCALE instead of reading the locale that ConsoleApp activates. That defeats the scaffold's RTL-ready claim if a future locale or test harness changes i18n.locale. The fix is a single-file change to consume Lingui's active locale from context.
| export function LocaleDirectionProvider({ children }: LocaleDirectionProviderProps) { | ||
| const dir = React.useMemo(() => getLocaleDir(DEFAULT_LOCALE), []); |
There was a problem hiding this comment.
[needs fixing] LocaleDirectionProvider reads direction from DEFAULT_LOCALE rather than the active Lingui locale. That means document.documentElement.lang/dir are always "en"/"ltr", regardless of the locale prop passed to ConsoleApp or any future locale change.
Because the component already sits inside I18nProvider, use useLingui to read the real active locale so the document attributes actually track the i18n state.
| export function LocaleDirectionProvider({ children }: LocaleDirectionProviderProps) { | |
| const dir = React.useMemo(() => getLocaleDir(DEFAULT_LOCALE), []); | |
| import { useLingui } from "@lingui/react"; | |
| import { DirectionProvider } from "@cloudflare/kumo/primitives"; | |
| import * as React from "react"; | |
| import { getLocaleDir } from "./config.js"; | |
| interface LocaleDirectionProviderProps { | |
| children: React.ReactNode; | |
| } | |
| /** | |
| * Wraps the app with DirectionProvider and keeps `<html>` in sync with the | |
| * active locale. Only "en" ships today, but reads direction from the same | |
| * `getLocaleDir` lookup packages/admin uses so adding an RTL locale later | |
| * doesn't require touching this component. | |
| */ | |
| export function LocaleDirectionProvider({ children }: LocaleDirectionProviderProps) { | |
| const { i18n } = useLingui(); | |
| const dir = React.useMemo(() => getLocaleDir(i18n.locale), [i18n.locale]); | |
| React.useEffect(() => { | |
| document.documentElement.setAttribute("lang", i18n.locale); | |
| document.documentElement.setAttribute("dir", dir); | |
| }, [i18n.locale, dir]); | |
| return <DirectionProvider direction={dir}>{children}</DirectionProvider>; | |
| } |
There was a problem hiding this comment.
Applied in 796c89c — the provider now reads i18n.locale via useLingui (it already sits inside I18nProvider), so lang/dir and Kumo's DirectionProvider track the active locale, falling back to DEFAULT_LOCALE when unset. Same shape as packages/admin's provider, minus its useLocale store the console doesn't have yet.
~ 🤖 Fable
A failed fetch previously spun forever or looked like not-found. All five routes now render a shared QueryError banner, with detail-page section errors scoped so one failed query doesn't blank the rest. Audit log now queries the client like the other routes. Also drops a stale tsconfig include entry. Claude-Session: https://claude.ai/code/session_014rikrGMh25h1rJczUQyTMM
There was a problem hiding this comment.
This is the right change for W9.3: a client-only Vite React SPA scaffold for the labeler operator console, colocated with the Worker app without coupling to the published packages/admin. It mirrors the admin's routing/data-fetching patterns (TanStack Router + Query, Kumo, logical Tailwind), keeps the public/private evidence boundary explicit in FindingCard, and correctly avoids touching Worker source, auth, or API routes per the plan.
This is a re-review, and the prior findings are resolved:
- The Lingui cleanup is complete:
apps/labeler/console/tsconfig.jsonhas no Lingui types, nomessages.po/Lingui config remains, andDirectionProvideris fixed toltr. - Query error handling now surfaces failures via
QueryErroracrossAssessmentDetail,AssessmentList,SubjectHistory,Dashboard, andAuditLog, rather than collapsing into spinners or not-found states.
What I checked:
- Diff against
feat/plugin-registry-labelling-service— only the new console tree plusapps/labeler/package.json/vitest.config.tsbuild wiring. - Type-shape compatibility between
console/src/api/types.tsand the worker'sassessment-store.ts,findings.ts, andpublic-assessment.ts. - Tailwind class usage: no physical
ml-/mr-classes, nodark:prefixes, no raw Tailwind colors; logical spacing is used consistently. - Tests and tooling: dedicated jsdom vitest config, Worker-side config excludes the console, and fixture/query tests cover the scaffolded surface.
Headline conclusion: the code is clean overall. I have only minor suggestions — no blockers.
| // The console (console/vitest.config.ts) runs its own jsdom-based suite | ||
| // separately -- it doesn't run in the workerd pool this config sets up. | ||
| test: { | ||
| exclude: ["**/node_modules/**", "console/**"], |
There was a problem hiding this comment.
[suggestion] Setting exclude here replaces Vitest's default exclude list, which means built-in exclusions like dist/**, .git/**, .cache/**, etc. are silently dropped. That can become brittle if any built artifacts ever contain .test. files.
Either keep the existing defaults or, more cleanly, extend defaultExclude:
| exclude: ["**/node_modules/**", "console/**"], | |
| import { defaultExclude } from "vitest/config"; | |
| // ... | |
| test: { | |
| exclude: [...defaultExclude, "console/**"], | |
| }, |
There was a problem hiding this comment.
Applied in b4e836c — exclude now spreads configDefaults.exclude so the built-in exclusions are kept.
~ 🤖 Fable
| export function Header() { | ||
| return ( | ||
| <header className="sticky top-0 z-10 flex h-[58px] items-center justify-between border-b bg-kumo-elevated px-4"> | ||
| <Sidebar.Trigger className="cursor-pointer rtl:rotate-180" /> |
There was a problem hiding this comment.
[suggestion] This rtl:rotate-180 class is effectively dead because App.tsx hard-codes DirectionProvider direction="ltr" for the console. It also wouldn't be the correct transform for a bidi-aware chevron if RTL were ever enabled (AGENTS.md recommends rtl:-scale-x-100 for directional icons).
| <Sidebar.Trigger className="cursor-pointer rtl:rotate-180" /> | |
| <Sidebar.Trigger className="cursor-pointer" /> |
There was a problem hiding this comment.
Applied in b4e836c — dead class removed (the console is fixed to ltr).
~ 🤖 Fable
|
|
||
| {!isError && data?.nextCursor && ( | ||
| <div className="flex justify-center"> | ||
| <span className="text-sm text-kumo-subtle">More assessments available.</span> | ||
| </div> | ||
| )} |
There was a problem hiding this comment.
[suggestion] The page reads data.nextCursor and shows "More assessments available," but there's no button or link to actually fetch the next page, so the hint leads nowhere for long lists. For a W9.3 scaffold that's fine to defer, but consider either wiring a "Load more" button that passes the cursor back to listAssessments, or removing this block until pagination UI is implemented.
There was a problem hiding this comment.
Applied in b4e836c — removed the dead-end hint. Pagination UI lands with the fetch-backed console (the client and types already carry nextCursor, so nothing is lost by deferring).
~ 🤖 Fable
There was a problem hiding this comment.
This is the right change for W9.3: a client-only Vite React SPA scaffold for the labeler operator console, colocated with the Worker app without coupling to the published packages/admin. It mirrors admin's routing/data-fetching patterns (TanStack Router + Query, Kumo, logical Tailwind), keeps the public/private evidence boundary explicit in FindingCard, and correctly leaves Worker source, auth, and API routes untouched per the plan.
This is a re-review and the prior findings are resolved:
- Lingui wiring is fully removed: no Lingui config, types, or catalog files remain, and
DirectionProvideris fixed toltr. - Query failures now surface via
QueryErrorrather than collapsing into spinners or not-found states.
What I checked:
- Diff against
feat/plugin-registry-labelling-service— only the newapps/labeler/consoletree plusapps/labeler/package.jsonandvitest.config.tsbuild wiring. - Type-shape alignment: the console's
AssessmentRun/OperatorFindingtypes are a reasonable operator API view aligned with workerassessment-store.ts,findings.ts, andpublic-assessment.ts, with computed fields (isSuperseded,publicState) documented as server-derived. - Tailwind/Kumo class usage: no physical
ml-/mr-classes, no raw Tailwind colors, nodark:prefixes, and the@sourceglob correctly accounts for the nested app location (../../node_modules/...). - Tests and tooling: dedicated jsdom vitest config, Worker-side config excludes
console/**, and fixture/query tests cover the scaffolded surface.
Headline conclusion: the code is clean overall. I have only two minor cleanup suggestions — an unused utility plus unused dependencies — and no blockers.
| @@ -0,0 +1,7 @@ | |||
| import { type ClassValue, clsx } from "clsx"; | |||
There was a problem hiding this comment.
[suggestion] cn is never imported or used anywhere in the console, and neither are its clsx and tailwind-merge dependencies. Since this scaffold doesn't need conditional class merging, the file is dead weight that bloats the dependency tree. Remove this file from apps/labeler/console/src/lib/utils.ts.
There was a problem hiding this comment.
Applied in 9a2bf83 — file and its two deps removed.
~ 🤖 Fable
| "clsx": "^2.1.1", | ||
| "jsdom": "^26.1.0", | ||
| "react": "catalog:", | ||
| "react-dom": "catalog:", | ||
| "tailwind-merge": "^3.3.0", |
There was a problem hiding this comment.
[suggestion] These dependencies are only referenced by the unused console/src/lib/utils.ts. Once that file is removed, clsx and tailwind-merge can be dropped from the package's dev dependencies as well.
| "clsx": "^2.1.1", | |
| "jsdom": "^26.1.0", | |
| "react": "catalog:", | |
| "react-dom": "catalog:", | |
| "tailwind-merge": "^3.3.0", | |
| "@types/node": "catalog:", | |
| "@types/react": "catalog:", | |
| "@types/react-dom": "catalog:", | |
| "@vitejs/plugin-react": "^5.2.0", | |
| "jsdom": "^26.1.0", | |
| "react": "catalog:", | |
| "react-dom": "catalog:", | |
| "tailwindcss": "^4.3.2", |
There was a problem hiding this comment.
This is the right scoped change for W9.3: a read-only, fixture-driven Vite React SPA colocated in apps/labeler/console, mirroring the admin's routing/data-fetching stack (TanStack Router + Query, Kumo, logical Tailwind) without coupling to the published packages/admin. It keeps worker source, auth, and API routes untouched as the plan requires, and it makes the public/private evidence boundary explicit in FindingCard from day one.
This re-review confirms the two prior blockers are resolved:
- No Lingui configuration, catalogs, or runtime wiring remains;
DirectionProvideris fixed toltr. - Query failures now render
QueryErrorinstead of collapsing into spinners or not-found states.
What I checked:
- The full new
apps/labeler/consoletree: routes, components, fixtures, client types,apiClient, tests, and build wiring. - Tailwind/Kumo class usage: only logical spacing, semantic Kumo tokens, no raw colors or
dark:prefixes; the@sourceglob accounts for the nested app location. - Type-shape alignment with the labeler store types (deliberately mirrored rather than imported, which is correct for a browser bundle).
- Test/build isolation: a dedicated jsdom vitest config, console scripts, a separate tsconfig, and the Worker-side vitest config excludes
console/**.
I found no logic bugs, security issues, regressions, or AGENTS.md violations in the new code. The pnpm-lock changes are normal dependency additions for the console, and apps/labeler remains a private unpublished package, so no changeset is needed. No blockers.
19c70ae
into
feat/plugin-registry-labelling-service
What does this PR do?
Scaffolds the labeler operator console SPA — the client-side portion of plan item W9.3, per the ratified stack decision (2026-07-13): a Vite React SPA colocated at
apps/labeler/console, later served as Workers static assets under/admin, mirroringpackages/admin's conventions (Kumo, RTL-safe logical Tailwind, TanStack Router) without depending on that package.No i18n, by decision (2026-07-13, recorded in the plan and spec §13.3): the console is internal infrastructure with a handful of operators — Lingui is a requirement only for user-facing parts of the main emdash admin. Strings are plain English; Kumo's
DirectionProvideris fixed toltr. Logical Tailwind classes are kept (free, repo convention). Earlier revisions of this branch carried full Lingui wiring; it was removed once the decision landed, which also moots the earlier catalog-file review thread.Client only, deliberately. No Worker source, wrangler config, or auth/API wiring is touched — static-asset serving and the Access-guarded
/admin/api/*routes land in a follow-up alongside the W9.2 mutation guard. Until then every view renders typed fixtures.What's here:
basepath: "/admin"): Dashboard (system-status cards), Assessments list (state-filterable table), Assessment detail, Subject history, Audit log (empty state —operator_actionsarrives with W9.2), NotFound. Assessment detail visually separates each finding'spublicSummaryfrom a clearly-marked operators-only box forprivateDetail/evidenceRefs, so the public/private evidence boundary (spec §9/§13) is explicit in the UI from day one.api/types.tsmirrors the store shapes (assessments, findings, labels, policy outcomes);api/client.tsdefines aLabelerConsoleClientinterface with a fixture implementation (active) and a fetch implementation targeting same-origin/admin/api/*withX-EmDash-Request: 1andcredentials: "same-origin"(inert until the routes exist). Swapping the exportedapiClientis the only change needed when W9.4+ lands.Build/test isolation: the console has its own vitest config (jsdom); the Worker's vitest config now excludes
console/**so the workerd pool doesn't sweep up browser tests. New scripts:console:dev|build|typecheck|test; the package's defaulttypecheck/testchain them so CI covers the console. Existing Worker scripts untouched.Notes for reviewers:
packages/admin's Tailwind@sourceglob for Kumo assumes deps one level up; for a subdirectory app under an existing package the depth differs (../../node_modules/...). Getting this wrong fails silently (fully unstyled app).Implemented by a Sonnet subagent, coordinated and verified by Fable; browser-tested end to end (all routes, public/private finding split, RTL mirroring).
Targets
feat/plugin-registry-labelling-service. Related to #1909 and RFC #694.Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.i18n n/a — this touches no admin UI, and the labeler console is deliberately not localized (decision 2026-07-13, recorded in the plan/spec; i18n is a requirement only for user-facing parts of the main emdash admin). Changeset n/a —
apps/labeleris a private, unpublished Worker app.AI-generated code disclosure
Screenshots / test output
pnpm --filter @emdash-cms/labeler test(chains Worker + console): 351 + 6 pass;typecheck(both projects) clean;console:buildsucceedspnpm lint:json: 0 diagnostics inapps/labeler/console/**(repo baseline of pre-existingno-redundant-type-constituentsfalse positives elsewhere, untouched)https://claude.ai/code/session_014rikrGMh25h1rJczUQyTMM
Try this PR
Open a fresh playground →
A full working EmDash site, deployed from this branch. Each visit gets its own session-scoped sandbox: no login needed and no shared state. Try the admin, edit content, hit the public site.
Tracks
feat/labeler-console. Updated automatically when the playground redeploys.