Repository navigation
feat: localize axios service error messages - #17242
mattmillerai wants to merge 4 commits into
Conversation
📦 Bundle Size
🔬 E2E CoverageLine coverage: 64.2% Coverage totals
Top 10 files by uncovered lines
🎭 Playwright: ✅ 3056 passed, 0 failed · 1 flaky📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measureExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight
Findings and check detailsThe 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: ✅ PassedFallow 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 detailsNo 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: ✅ PassedFindings and check detailsWarnings (146)
Reproduce locallypnpm architecture:checkFull docs: Frontend domain catalog |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
There was a problem hiding this comment.
🔍 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.
Codecov Report❌ Patch coverage is @@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 11 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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 '. 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.
6328e17 to
870fea7
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
…-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
…-composable' into matt/be-11177-localize-service-errors
STACKED — merging lands on
matt/be-2254-extract-api-request-composable(owned by @mattmillerai, PR #13402), NOTmain. Do not merge until #13402 lands; GitHub will retarget this PR tomainautomatically 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
serviceErrorsnamespace, so non-English users see translated service errors.Changes
serviceErrorsnamespace insrc/locales/en/main.json(English only — CI generates the other locales persrc/locales/CONTRIBUTING.md; no other locale file is touched): 4 shared templates, 6 status-switch arms + their 6 fallback params, 4 Manager fixed strings, 24context.*keys, 17route.*keys.comfyRegistryService.ts,releaseService.ts,customerEventsService.ts,comfyManagerService.ts: everymapErrorreturn value, everyerrorContextliteral, and everyrouteSpecificErrorsvalue now resolves throught()from@/i18n. Nested fallbacks compose, e.g.t('serviceErrors.badRequest', { message: data?.message || t('serviceErrors.invalidInput') }).GENERIC_SECURITY_ERR_MSG(module-levelconst) is deleted and replaced byt('serviceErrors.manager.securityError')at its two call sites (startQueueandqueueTask) — a module-levelt()would freeze the import-time locale. NorouteSpecificErrorsmap was hoisted; all are already built inside their method, so they re-evaluate per request.customerEventsService.test.tsno longer stubst(@/i18nis now mocked with{ spy: true }, sotanddboth run for real anddis only observed). New regression test incomfyManagerService.test.tsproves a mapper's output follows a locale switch.Review Focus
escapeParameter: trueis bypassed for service errors.src/i18n.tscreates the i18n instance withescapeParameter: true, which would HTML-escape interpolated params (No module named 'cv2'→No module named 'cv2'). These messages are rendered as plain text, so a newtPlainhelper insrc/i18n.ts(twith{ escapeParameter: false }) is used for every param-bearing service error. Backend text therefore renders exactly as before; a regression test inreleaseService.test.tscovers it.releaseService.test.ts): the degenerate "non-Error object" case used to produce the literal stringFailed to get releases: undefined; it now falls back toFailed to get releases: Unknown error occurred(an axios error with nomessageusesserviceErrors.unknownErrorinreleaseServiceandcomfyRegistryService).main'sstartQueue(403 → security error); this PR only localizes that shape and adds no queue-start logic of its own.formatEventTypetest (now includingagent_usage→Agent Usage) asserts resolved English labels instead of i18n keys — a direct consequence of un-stubbingt, and what the ticket asks for.Queueing {kind} task:kindis an API enum value (install,update, …) and stays English inside the translated frame, as specified.Verification
pnpm typecheck— clean (exit 0, verified without a masking pipe).pnpm test:uniton the 4 service suites +useApiRequest.test.ts— 111 passed.pnpm test:uniton 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:checkclean.pnpm knipclean.git grep -nE "failed with status|failed: \$|Unauthorized: Authentication|Could not connect to ComfyUI-Manager" -- src/returns onlysrc/locales/en/main.json, test files, and unrelated call sites (App.vueresource-load reporting,BackgroundImageUpload.vue,desktopLoginRedemption.tsconsole warning, axios' ownRequest failed with status code …in other suites).src/andbrowser_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:
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 onmain. The key set is unchanged either way.createDefaultErrorMapperfactory ticket (the partial-overlap ticket named in the source) has also not merged, so the fourmapErrorcopies 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.tsandreleaseService.tsnow hold two near-identical localized switches (registry has an extra 409 arm);comfyManagerService.tsandcustomerEventsService.tshold two near-identical localized short mappers.errorContextliterals and 15routeSpecificErrorsmaps 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-leveltry/catchfallback, 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.authHeaderMissingis an addition beyond the ticket's key list.customerEventsService.tsassigned the raw English'Authentication header is missing'straight toerror.value, one line from the localized paths and rendering on the sameUsageLogsTablesurface. Localizing it was a judgment call; it is not in the ticket's enumerated key set.src/components/dialog/content/setting/UsageLogsTable.vueandsrc/components/helpcenter/HelpCenterMenuContent.vuewere 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.pnpm test:unitin full andpnpm test:browserwere not run.jamessage; the real translatedja/zh/etc. strings are produced by CI fromsrc/locales/en/main.jsonafter merge and could not be generated or reviewed here.Provenance
useApiRequestand this PR's localization coexistpnpm typecheck: clean; eslint/oxfmt on changed files: cleanuseApiRequestandi18n: 187 passedtPlainchange and passes with it (original authoring run)escapeParameterviatPlainreleaseServiceempty-message assertion now expects the unknown-error fallback;formatEventTypetest asserts resolved labels