Skip to content

feat(labeler): operator console SPA scaffold (W9.3, client only) - #2006

Merged
ascorbic merged 8 commits into
feat/plugin-registry-labelling-servicefrom
feat/labeler-console
Jul 13, 2026
Merged

ascorbic merged 8 commits into
feat/plugin-registry-labelling-servicefrom
feat/labeler-console

Conversation

@ascorbic

@ascorbic ascorbic commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

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, mirroring packages/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 DirectionProvider is fixed to ltr. 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:

  • Routes (TanStack Router, basepath: "/admin"): Dashboard (system-status cards), Assessments list (state-filterable table), Assessment detail, Subject history, Audit log (empty state — operator_actions arrives with W9.2), NotFound. Assessment detail visually separates each finding's publicSummary from a clearly-marked operators-only box for privateDetail/evidenceRefs, so the public/private evidence boundary (spec §9/§13) is explicit in the UI from day one.
  • Typed data layer: api/types.ts mirrors the store shapes (assessments, findings, labels, policy outcomes); api/client.ts defines a LabelerConsoleClient interface with a fixture implementation (active) and a fetch implementation targeting same-origin /admin/api/* with X-EmDash-Request: 1 and credentials: "same-origin" (inert until the routes exist). Swapping the exported apiClient is the only change needed when W9.4+ lands.
  • Fixtures cover pending/passed/warned/blocked/error/superseded assessments with findings drawn from the real moderation-policy vocabulary.

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 default typecheck/test chain them so CI covers the console. Existing Worker scripts untouched.

Notes for reviewers:

  • One repo gotcha worth knowing: packages/admin's Tailwind @source glob 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

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: RFC RFC: Decentralized Plugin Registry #694

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/labeler is a private, unpublished Worker app.

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Claude Code with Claude Fable 5 (coordination, verification) and a Sonnet subagent (implementation)

Screenshots / test output

  • pnpm --filter @emdash-cms/labeler test (chains Worker + console): 351 + 6 pass; typecheck (both projects) clean; console:build succeeds
  • pnpm lint:json: 0 diagnostics in apps/labeler/console/** (repo baseline of pre-existing no-redundant-type-constituents false positives elsewhere, untouched)
  • Browser-verified: dashboard, list, blocked-assessment detail (public/private split), subject history, audit empty state — re-checked after the Lingui removal (renders pixel-identical)

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.

@changeset-bot

changeset-bot Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9a2bf83

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Scope check

This 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.

@github-actions github-actions Bot added review/needs-review No maintainer or bot review yet cla: signed labels Jul 13, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-playground 9a2bf83 Jul 13 2026, 12:20 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-do 9a2bf83 Jul 13 2026, 12:20 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-cache 9a2bf83 Jul 13 2026, 12:20 PM

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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 same ApiResult<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.
  2. Frontend-only dependencies are listed as runtime dependencies of the Worker package. react, @cloudflare/kumo, Tailwind-related packages, etc. are only needed to build the console. They should move to devDependencies so the labeler Worker install/bundle isn't polluted with browser runtime code.
  3. The labeler's default typecheck and test scripts don't cover the console. tsgo --noEmit and vitest run only target the Worker source; the console has separate console:typecheck/console:test scripts. At minimum these should be chained into the package's default scripts so CI doesn't let the console bit-rot.
  4. A generated messages.po is 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.

Comment on lines +54 to +63
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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread apps/labeler/package.json Outdated
"@atcute/lexicons": "catalog:",
"@atcute/repo": "catalog:",
"@atcute/xrpc-server": "catalog:",
"@cloudflare/kumo": "catalog:",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
"@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:"
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread apps/labeler/package.json Outdated
@@ -12,7 +12,13 @@
"typecheck": "tsgo --noEmit",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
"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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Jul 13, 2026
@github-actions github-actions Bot added review/needs-rereview New commits since the last review and removed review/needs-review No maintainer or bot review yet labels Jul 13, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 dependencies to devDependencies.
  • ✅ Fixed: the labeler package's default typecheck and test scripts 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 return ApiResult<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's parseJson is consistent with the client it intends to consume.
  • ❌ Still open: the generated apps/labeler/console/src/locales/en/messages.po catalog 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.

Comment on lines +1 to +281
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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond review/needs-rereview New commits since the last review and removed review/needs-rereview New commits since the last review review/awaiting-author Reviewed; waiting on the author to respond labels Jul 13, 2026
@ascorbic ascorbic added bot:review Trigger an emdashbot code review on this PR and removed bot:review Trigger an emdashbot code review on this PR labels Jul 13, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +16 to +17
export function LocaleDirectionProvider({ children }: LocaleDirectionProviderProps) {
const dir = React.useMemo(() => getLocaleDir(DEFAULT_LOCALE), []);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
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>;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-rereview New commits since the last review labels Jul 13, 2026
@ascorbic ascorbic removed the bot:review Trigger an emdashbot code review on this PR label Jul 13, 2026
@github-actions github-actions Bot added review/needs-rereview New commits since the last review and removed review/awaiting-author Reviewed; waiting on the author to respond labels Jul 13, 2026
@ascorbic ascorbic added bot:review Trigger an emdashbot code review on this PR and removed bot:review Trigger an emdashbot code review on this PR labels Jul 13, 2026
@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-rereview New commits since the last review labels Jul 13, 2026
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
@github-actions github-actions Bot added review/needs-rereview New commits since the last review and removed review/awaiting-author Reviewed; waiting on the author to respond labels Jul 13, 2026
@ascorbic ascorbic added bot:review Trigger an emdashbot code review on this PR and removed bot:review Trigger an emdashbot code review on this PR labels Jul 13, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.json has no Lingui types, no messages.po/Lingui config remains, and DirectionProvider is fixed to ltr.
  • Query error handling now surfaces failures via QueryError across AssessmentDetail, AssessmentList, SubjectHistory, Dashboard, and AuditLog, rather than collapsing into spinners or not-found states.

What I checked:

  • Diff against feat/plugin-registry-labelling-service — only the new console tree plus apps/labeler/package.json/vitest.config.ts build wiring.
  • Type-shape compatibility between console/src/api/types.ts and the worker's assessment-store.ts, findings.ts, and public-assessment.ts.
  • Tailwind class usage: no physical ml-/mr- classes, no dark: 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.

Comment thread apps/labeler/vitest.config.ts Outdated
// 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/**"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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:

Suggested change
exclude: ["**/node_modules/**", "console/**"],
import { defaultExclude } from "vitest/config";
// ...
test: {
exclude: [...defaultExclude, "console/**"],
},

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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).

Suggested change
<Sidebar.Trigger className="cursor-pointer rtl:rotate-180" />
<Sidebar.Trigger className="cursor-pointer" />

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in b4e836c — dead class removed (the console is fixed to ltr).

~ 🤖 Fable

Comment on lines +120 to +125

{!isError && data?.nextCursor && (
<div className="flex justify-center">
<span className="text-sm text-kumo-subtle">More assessments available.</span>
</div>
)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-rereview New commits since the last review labels Jul 13, 2026
@github-actions github-actions Bot added review/needs-rereview New commits since the last review and removed review/awaiting-author Reviewed; waiting on the author to respond labels Jul 13, 2026
@ascorbic ascorbic added bot:review Trigger an emdashbot code review on this PR and removed bot:review Trigger an emdashbot code review on this PR labels Jul 13, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DirectionProvider is fixed to ltr.
  • Query failures now surface via QueryError rather than collapsing into spinners or not-found states.

What I checked:

  • Diff against feat/plugin-registry-labelling-service — only the new apps/labeler/console tree plus apps/labeler/package.json and vitest.config.ts build wiring.
  • Type-shape alignment: the console's AssessmentRun/OperatorFinding types are a reasonable operator API view aligned with worker assessment-store.ts, findings.ts, and public-assessment.ts, with computed fields (isSuperseded, publicState) documented as server-derived.
  • Tailwind/Kumo class usage: no physical ml-/mr- classes, no raw Tailwind colors, no dark: prefixes, and the @source glob 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.

Comment thread apps/labeler/console/src/lib/utils.ts Outdated
@@ -0,0 +1,7 @@
import { type ClassValue, clsx } from "clsx";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 9a2bf83 — file and its two deps removed.

~ 🤖 Fable

Comment thread apps/labeler/package.json Outdated
Comment on lines +50 to +54
"clsx": "^2.1.1",
"jsdom": "^26.1.0",
"react": "catalog:",
"react-dom": "catalog:",
"tailwind-merge": "^3.3.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
"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",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 9a2bf83.

~ 🤖 Fable

@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-rereview New commits since the last review labels Jul 13, 2026
@github-actions github-actions Bot added review/needs-rereview New commits since the last review and removed review/awaiting-author Reviewed; waiting on the author to respond labels Jul 13, 2026
@ascorbic ascorbic added bot:review Trigger an emdashbot code review on this PR and removed bot:review Trigger an emdashbot code review on this PR labels Jul 13, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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; DirectionProvider is fixed to ltr.
  • Query failures now render QueryError instead of collapsing into spinners or not-found states.

What I checked:

  • The full new apps/labeler/console tree: 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 @source glob 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.

@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-rereview New commits since the last review labels Jul 13, 2026
@ascorbic
ascorbic merged commit 19c70ae into feat/plugin-registry-labelling-service Jul 13, 2026
18 checks passed
@ascorbic
ascorbic deleted the feat/labeler-console branch July 13, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:review Trigger an emdashbot code review on this PR cla: signed review/approved Approved; no new commits since size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant