Operational Copy Codes
This repo uses code-driven operational copy at service boundaries. Backend and web BFF layers return stable status, detail, and error codes, and the web app renders English through its translation seam.
Purpose
Section titled “Purpose”- Keep user-facing operational copy out of backend route handlers and service payloads.
- Make future translation work additive instead of requiring contract redesign.
- Prevent raw internal/provider/backend exception text from leaking into product UI.
- Keep closed-set status and error behavior explicit, testable, and searchable.
Contract Shape
Section titled “Contract Shape”Errors cross boundaries as structured codes:
{ error: { code: string params?: Record<string, string | number | boolean> }}Normal successful payloads can also carry machine-readable status or detail fields when the UI needs to choose copy for success, progress, or recovery states.
Current operational-copy rendering seam:
- Web translation:
apps/web/app/utils/operationalCopy.ts - Web error readers:
apps/web/app/utils/httpErrors.ts - Shared auth-layer translation:
packages/nuxt-auth-layer/app/utils/authHttpErrors.ts - Shared Nuxt auth-layer BFF proxy normalization:
packages/nuxt-auth-layer/server/utils/proxyErrorResponse.ts
Domain Catalog
Section titled “Domain Catalog”The current code set is large enough that a flat manual list becomes noisy. Treat the catalog as grouped by domain:
auth: access request, completion, sign-in policy, and sign-in gating flowsconnectors: connection, sync, disconnect, recovery, auth-health, and service-trigger failureschat: chats, chat spaces, response templates, skills, sharing, HITL, focus, and message operationslibrary: library CRUD, item operations, and validation failuresuploads: upload sessions, file upload/download, and connector-file access failurescommon: cross-domain codes such asunauthorized,forbidden, and generic request failures
Use the source catalogs as the canonical list. Avoid hand-maintaining a second exhaustive table unless it is generated from those catalogs.
How To Add Or Change Codes
Section titled “How To Add Or Change Codes”- Add or reuse a stable machine-readable code in the shared contract or API/web-facing handler.
- Return that code from API or web BFF boundaries instead of backend-authored English.
- Add or update the English rendering in
apps/web/app/utils/operationalCopy.ts, or inpackages/nuxt-auth-layer/app/utils/authHttpErrors.tsfor shared auth-layer UI. - Update tests so they assert codes at the boundary and translated copy in UI-facing assertions.
- Keep true content data and proper names out of this system unless the app owns the wording.
Quick Lookup
Section titled “Quick Lookup”- Search the current web translation catalog:
rg "^ '" apps/web/app/utils/operationalCopy.ts - Search shared operational error schema usage:
rg "operationalErrorResponseSchema|error: \\{ code" packages apps - Search for legacy raw error strings that still need cleanup:
rg "statusMessage: '|body: \\{ error: '|sendProxyErrorResponse\\(.*'[A-Z]" apps/web apps/api apps/auth
Which Files Matter
Section titled “Which Files Matter”| File | What it helps you answer |
|---|---|
apps/web/app/utils/operationalCopy.ts |
Current English operational-copy catalog grouped by domain |
apps/web/app/utils/httpErrors.ts |
How web readers resolve display-safe messages from code-bearing errors |
packages/nuxt-auth-layer/app/utils/authHttpErrors.ts |
How shared auth UI resolves display-safe auth messages from code-bearing errors |
packages/nuxt-auth-layer/server/utils/proxyErrorResponse.ts |
How shared Nuxt auth-layer and web proxy routes normalize upstream failures into structured error codes |
packages/contracts/src/common/errors.ts |
Shared operational error envelope contract |
packages/contracts/src/auth/accessRequests.ts |
Access-request detail codes and auth contract shape |
packages/contracts/src/connectors/contracts.ts |
Connector status, recovery, progress, and machine-readable contract fields |
apps/auth/src/index.ts |
Auth-side request-access, completion, and sign-in-policy code emission |
apps/api/src/chats/chatRouteHandlers.ts |
Chat/skills/response-template/chat-space operational error code mapping |
apps/api/src/connectors/connectorRouteHandlers.ts |
Connector runtime and internal-service operational error responses |