Skip to content

feat: localize axios service error messages - #17242

Open
mattmillerai wants to merge 4 commits into
matt/be-2254-extract-api-request-composablefrom
matt/be-11177-localize-service-errors
Open

mattmillerai wants to merge 4 commits into
matt/be-2254-extract-api-request-composablefrom
matt/be-11177-localize-service-errors

Conversation

@mattmillerai

@mattmillerai mattmillerai commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

STACKED — merging lands on matt/be-2254-extract-api-request-composable (owned by @mattmillerai, PR #13402), NOT main. Do not merge until #13402 lands; GitHub will retarget this PR to main automatically when it does.

ELI5

When something goes wrong talking to the node registry, the update checker, the credits history or the ComfyUI-Manager, the error message shown to the user is now translated into their language instead of always being in English. English users see exactly the same text as before.

Summary

Routes every user-facing string produced by the four axios services' error mappers — and every English literal fed into them from call sites — through vue-i18n under a new serviceErrors namespace, so non-English users see translated service errors.

Changes

  • What:
    • New serviceErrors namespace in src/locales/en/main.json (English only — CI generates the other locales per src/locales/CONTRIBUTING.md; no other locale file is touched): 4 shared templates, 6 status-switch arms + their 6 fallback params, 4 Manager fixed strings, 24 context.* keys, 17 route.* keys.
    • comfyRegistryService.ts, releaseService.ts, customerEventsService.ts, comfyManagerService.ts: every mapError return value, every errorContext literal, and every routeSpecificErrors value now resolves through t() from @/i18n. Nested fallbacks compose, e.g. t('serviceErrors.badRequest', { message: data?.message || t('serviceErrors.invalidInput') }).
    • GENERIC_SECURITY_ERR_MSG (module-level const) is deleted and replaced by t('serviceErrors.manager.securityError') at its two call sites (startQueue and queueTask) — a module-level t() would freeze the import-time locale. No routeSpecificErrors map was hoisted; all are already built inside their method, so they re-evaluate per request.
    • Tests assert resolved messages through the real i18n instance. customerEventsService.test.ts no longer stubs t (@/i18n is now mocked with { spy: true }, so t and d both run for real and d is only observed). New regression test in comfyManagerService.test.ts proves a mapper's output follows a locale switch.
  • Breaking: none. English output is byte-identical except for the empty-message fallback noted under Review Focus.

Review Focus

  • escapeParameter: true is bypassed for service errors. src/i18n.ts creates the i18n instance with escapeParameter: true, which would HTML-escape interpolated params (No module named 'cv2' → No module named 'cv2'). These messages are rendered as plain text, so a new tPlain helper in src/i18n.ts (t with { escapeParameter: false }) is used for every param-bearing service error. Backend text therefore renders exactly as before; a regression test in releaseService.test.ts covers it.
  • One assertion value changed (releaseService.test.ts): the degenerate "non-Error object" case used to produce the literal string Failed to get releases: undefined; it now falls back to Failed to get releases: Unknown error occurred (an axios error with no message uses serviceErrors.unknownError in releaseService and comfyRegistryService).
  • Queue-start flow follows the base branch. refactor: extract shared useApiRequest composable for axios services #13402 has since dropped its per-request queue-start wrapper and restored main's startQueue (403 → security error); this PR only localizes that shape and adds no queue-start logic of its own.
  • formatEventType test (now including agent_usage → Agent Usage) asserts resolved English labels instead of i18n keys — a direct consequence of un-stubbing t, and what the ticket asks for.
  • Queueing {kind} task: kind is an API enum value (install, update, …) and stays English inside the translated frame, as specified.
  • No capability is denied or removed by this diff — it only re-routes existing strings through i18n, adds no throw/deny path, and flips no test to assert a dead end.

Verification

  • pnpm typecheck — clean (exit 0, verified without a masking pipe).
  • pnpm test:unit on the 4 service suites + useApiRequest.test.ts — 111 passed.
  • pnpm test:unit on all 11 other suites that touch these services (UsageLogsTable, HelpCenterMenuContent, comfyRegistryStore, comfyManagerStore, useConflictDetection, releaseStore, ReleaseNotificationToast, WhatsNewPopup, CreditsTile, usePendingTopup, PackVersionSelectorPopover) — 206 passed.
  • pnpm lint — 0 errors (187 pre-existing warnings, none in changed files). pnpm format:check clean. pnpm knip clean.
  • Acceptance grep git grep -nE "failed with status|failed: \$|Unauthorized: Authentication|Could not connect to ComfyUI-Manager" -- src/ returns only src/locales/en/main.json, test files, and unrelated call sites (App.vue resource-load reporting, BackgroundImageUpload.vue, desktopLoginRedemption.ts console warning, axios' own Request failed with status code … in other suites).
  • Swept src/ and browser_tests/ for code that string-matches these messages (=== '…', .includes(…)) — none exists, so localizing them breaks no control flow or E2E assertion.

Residual

Not fixed / not exercised by this PR. Written to stand on its own:

  • Sequencing deviation (the main judgment call). The source ticket sets a hard constraint: do not start until refactor: extract shared useApiRequest composable for axios services (refactor: extract shared useApiRequest composable for axios services #13402) has merged. It has not merged — it is open (opened 2026-07-02); as of 2026-10-22 this PR has merged its latest head (including its axios-cancellation fix). Rather than gate indefinitely, this PR is stacked on refactor: extract shared useApiRequest composable for axios services #13402's branch (the standing "always stack on a buildable blocker branch, never wait" rule), so it builds on the real post-refactor shape the ticket describes. Consequence: if refactor: extract shared useApiRequest composable for axios services #13402 is reworked or abandoned, this PR must be re-based onto whatever mapper shape actually lands on main. The key set is unchanged either way.
  • The createDefaultErrorMapper factory ticket (the partial-overlap ticket named in the source) has also not merged, so the four mapError copies are still duplicated — this PR localizes each in place and deliberately performs no restructuring, to stay a pure-localization change and not collide with that work. comfyRegistryService.ts and releaseService.ts now hold two near-identical localized switches (registry has an extra 409 arm); comfyManagerService.ts and customerEventsService.ts hold two near-identical localized short mappers.
  • Corpus swept, portion not fixed. 24 errorContext literals and 15 routeSpecificErrors maps across the four services were localized — that is all of them. One user-facing English literal in the same domain is left alone: src/platform/updates/common/releaseStore.ts:293 ('Unknown error occurred'). It is a store-level try/catch fallback, not output of the axios error mapping, so it is outside the ticket's stated goal and outside its acceptance grep. It is a one-line follow-up if wanted.
  • serviceErrors.authHeaderMissing is an addition beyond the ticket's key list. customerEventsService.ts assigned the raw English 'Authentication header is missing' straight to error.value, one line from the localized paths and rendering on the same UsageLogsTable surface. Localizing it was a judgment call; it is not in the ticket's enumerated key set.
  • Not exercised: the two render surfaces, visually. src/components/dialog/content/setting/UsageLogsTable.vue and src/components/helpcenter/HelpCenterMenuContent.vue were verified by reading and by their existing unit suites (both pass, both untouched, their already-localized fallbacks left alone). No dev server, browser, or Playwright run was performed, so the unescaped rendering described above is confirmed by a unit test, not by looking at the rendered DOM.
  • Not exercised: the full unit suite and the E2E suite. 317 tests were run (the 5 target suites plus every suite that references these services); pnpm test:unit in full and pnpm test:browser were not run.
  • Non-English output is unverified end to end. The locale-switch regression test injects a synthetic ja message; the real translated ja/zh/etc. strings are produced by CI from src/locales/en/main.json after merge and could not be generated or reviewed here.
  • Source-ticket material not seen. The ticket's comment thread reported 11 comments, all filtered as loop-authored markers with none substantive, and the brief carried no attachments or related-issues blocks. If any human comment was filtered or truncated, its content did not reach this work.

Provenance

  • Authored by: agent-work loop
  • Verified:
    • Head merges the current refactor: extract shared useApiRequest composable for axios services #13402 head cleanly (no conflicts); the base's cancellation handling in useApiRequest and this PR's localization coexist
    • pnpm typecheck: clean; eslint/oxfmt on changed files: clean
    • Vitest over the four services, useApiRequest and i18n: 187 passed
    • New HTML-escape regression test fails without the tPlain change and passes with it (original authoring run)
  • Deviations:

@mattmillerai mattmillerai added agent-coded Opened by the agent-work code loop cursor-review Trigger multi-model Cursor agent review on this PR labels Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle Size

⏳ Size data collection in progress…

🔬 E2E Coverage

Line coverage: 64.2%

Coverage totals
Metric Covered Total Pct
Lines 58115 90507 64.2% 🟡
Functions 0 0 — —
Branches 0 0 — —
Top 10 files by uncovered lines
File Coverage Missed
src/LGraphCanvas.ts 66.9% 1175
src/LGraphNode.ts 71.3% 379
src/workbench/extensions/agent/crdt/docOpMinter.ts 0.6% 340
src/renderer/extensions/layerEditor/composables/useLayerEditorSession.ts 39.6% 332
src/platform/workspace/stores/billingOperationStore.ts 8.2% 313
src/core/billing/operationLifecycle.ts 1.3% 303
src/platform/workspace/components/TopUpCreditsDialogContentWorkspace.vue 1.1% 280
src/LGraph.ts 78.9% 274
src/platform/workspace/stores/teamWorkspaceStore.ts 46.8% 252
src/core/webSessionIdentity.ts 3.3% 231

🎭 Playwright: ✅ 3056 passed, 0 failed · 1 flaky

📊 Browser Reports
  • chromium: View Report (✅ 2313 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • chromium-2x: View Report (✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • chromium-0.5x: View Report (✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • cloud: View Report (✅ 712 / ❌ 0 / ⚠️ 1 / ⏭️ 0)
  • desktop: View Report (✅ 6 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • mobile-chrome: View Report (✅ 19 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • mobile-safari: View Report (✅ 3 / ❌ 0 / ⚠️ 0 / ⏭️ 0)

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 10/22/2026, 03:08:36 PM UTC

Links

🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measure

Executes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight ecosystem-matrix shard checks are a harness self-test; the pack verdict is matrix-verdict.

No verdict is available. Open the workflow run to confirm the check was intentionally skipped, or fix the collection failure and re-run it.

Findings and check details

The matrix runs on same-repository version-bump PRs with relevant changes, main-branch pushes, and manual dispatches. This candidate does not qualify, so every expensive stage was skipped.

Reproduce locally
# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
  npx vitest run --config vitest.matrix.config.mts

Full docs: scripts/registry-census/README.md

🌾 Fallow: ✅ Passed

Fallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened.

Findings and check details

No new findings in the changed files.

Reproduce locally
# the base the gate compared against
npx fallow audit --root . --quiet --format json \
  --changed-since 5cf569db6a4d8300d137c0b377e774a68715baba

Full docs: ADR-DEVEX-LINT-0015

🏛️ Architecture: ✅ Passed

Findings and check details

Warnings (146)

  • billing path matches no source files: src/components/dialog/content/credit/**. Remove or update it in docs/architecture/domains/records/billing.domain.json.
  • workspace path matches no source files: src/platform/workspace/fixtures/**. Remove or update it in docs/architecture/domains/records/workspace.domain.json.
  • src/components/graph/selectionToolbox/LinkSelectionActions.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/searchbox/v2/filterChip.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/ui/Popover.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/ui/card/Card.stories.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/ui/card/Card.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/ui/card/CardFooter.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/ui/card/CardHeader.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/ui/card/card.variants.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/widgetHistory/WidgetHistoryButtons.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/widgetHistory/WidgetHistoryButtons.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/billing/useSubscriptionPaywall.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/billing/useSubscriptionPaywall.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/graph/menuOption.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useApiRequest.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useApiRequest.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useWidgetValueHistory.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useWidgetValueHistory.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/widgetHistoryScope.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/widgetHistoryScope.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/core/graph/litegraphServiceAccess.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/core/graph/nodeDef/ComfyNodeDefImpl.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/core/graph/widgets/dynamicGroupDiagnostics.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/core/graph/widgets/dynamicGroupDiagnostics.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/core/selection/selectionIntent.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/agentPanel.historyIdentity.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/cameraInfo.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/cloudBadges.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/dynamicPrompts.serializeValue.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/electronAdapter.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/load3dHost.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/load3dHost.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/load3dInstances.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/reportLoadModelOutcome.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/reportLoadModelOutcome.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3dLazy.retry.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/touchPointerGuards.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/i18n.literalMessages.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/lib/litegraph/src/ContextMenu.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/lib/litegraph/src/LiteGraphGlobal.cloneObject.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/lib/litegraph/src/canvas/canvasClassAccess.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/lib/litegraph/src/canvas/linkHideTransition.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/lib/litegraph/src/canvas/linkHideTransition.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/lib/litegraph/src/canvas/linkSelection.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/lib/litegraph/src/canvas/linkSelection.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/lib/litegraph/src/canvas/linkSnapGeometry.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/lib/litegraph/src/canvas/linkSnapGeometry.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/platform/auth/authStoreAccess.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/platform/auth/currentUserAccess.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • …and 96 more
Reproduce locally
pnpm architecture:check

Full docs: Frontend domain catalog

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the risk:R2 PR risk grade (advisory shadow check; grader-owned) label Sep 9, 2026

@github-actions github-actions 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.

🔍 Cursor Review — Consolidated panel

Triggered by @mattmillerai.

Found 5 finding(s).

Severity Count
🟡 Medium 1
🟢 Low 3
⚪ Nit 1

Panel: 8/8 reviewers contributed findings.

Comment thread src/services/comfyRegistryService.ts Resolved
Comment thread src/locales/en/main.json Resolved
@codecov

codecov Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.23288% with 21 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/services/comfyRegistryService.ts 58.62% 12 Missing ⚠️
src/platform/updates/common/releaseService.ts 64.70% 6 Missing ⚠️
src/services/customerEventsService.ts 71.42% 2 Missing ⚠️
...extensions/manager/services/comfyManagerService.ts 94.44% 1 Missing ⚠️
@@                               Coverage Diff                               @@
##           matt/be-2254-extract-api-request-composable   #17242      +/-   ##
===============================================================================
- Coverage                                        87.67%   87.66%   -0.01%     
===============================================================================
  Files                                             2730     2730              
  Lines                                           151045   151065      +20     
  Branches                                         41684    41686       +2     
===============================================================================
+ Hits                                            132422   132433      +11     
- Misses                                           17989    17998       +9     
  Partials                                           634      634              
Flag Coverage Δ
e2e 64.20% <46.51%> (+0.03%) ⬆️
unit 86.06% <68.49%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/i18n.ts 97.58% <100.00%> (+0.03%) ⬆️
...extensions/manager/services/comfyManagerService.ts 99.15% <94.44%> (-0.85%) ⬇️
src/services/customerEventsService.ts 94.91% <71.42%> (-0.78%) ⬇️
src/platform/updates/common/releaseService.ts 81.25% <64.70%> (+3.20%) ⬆️
src/services/comfyRegistryService.ts 85.00% <58.62%> (-5.18%) ⬇️

... and 11 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Route every user-facing string produced by the four axios services'
error mappers, and every English literal fed into them from call sites,
through vue-i18n under a new `serviceErrors` namespace.

`GENERIC_SECURITY_ERR_MSG` was a module-level const; a module-level
`t()` would freeze the import-time locale, so it is inlined at its one
call site inside `queueTask`.
The global i18n instance sets escapeParameter, so backend messages
interpolated into service errors rendered entities like &apos;. Add a
tPlain helper that disables escaping and use it for every param-bearing
service error. Fall back to the unknown-error message when an axios
error carries no message, and drop the unreachable 201 queue-start entry.
@mattmillerai
mattmillerai force-pushed the matt/be-11177-localize-service-errors branch from 6328e17 to 870fea7 Compare October 8, 2026 06:43
@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated
billing-web Ignored Ignored Oct 8, 2026 6:43am UTC
billing-web-test Ignored Ignored Oct 8, 2026 6:43am UTC

Request Review

…-composable' into matt/be-11177-localize-service-errors

# Conflicts:
#	src/locales/en/main.json
#	src/platform/updates/common/releaseService.ts
#	src/services/comfyRegistryService.ts
#	src/services/customerEventsService.test.ts
#	src/services/customerEventsService.ts
#	src/workbench/extensions/manager/services/comfyManagerService.ts
@github-actions github-actions Bot added the risk:high PR risk grade (advisory shadow check; grader-owned) label Oct 19, 2026
…-composable' into matt/be-11177-localize-service-errors

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-coded Opened by the agent-work code loop cursor-review Trigger multi-model Cursor agent review on this PR risk:high PR risk grade (advisory shadow check; grader-owned) risk:R2 PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant