Repository navigation
fix(i18n): code GitHub/GitLab operation failures for the renderer - #35689
Conversation
[Medium impact] The PR appears safe to merge; no actionable new issue was found. SummaryAdds shared error codes for GitHub/GitLab failures and translates them in renderer error messages.
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e161331e-2a92-4d13-888d-1d73efd0423d
Files selected for processing: 72-
src/main/github/client-merge-queue-auto-merge.test.tssrc/main/github/client-pr-checks.test.tssrc/main/github/client/check/rerun-pr-checks.tssrc/main/github/client/create/add-pr-review-comment.tssrc/main/github/client/merge/merge-pr.tssrc/main/github/client/merge/pr-auto-merge.tssrc/main/github/client/update/pr-details.tssrc/main/github/client/update/pr-ready.tssrc/main/github/client/update/pr-reviewers.tssrc/main/github/client/update/pr-state.tssrc/main/github/gh-error-classification.tssrc/main/github/gh-utils.test.tssrc/main/github/github-pr-stack-async-merge.tssrc/main/github/github-pr-stack.test.tssrc/main/github/issue-comment.tssrc/main/github/issue-create.tssrc/main/github/issue-update.tssrc/main/github/issues.test.tssrc/main/gitlab/client-mr-job-ci.test.tssrc/main/gitlab/client-mr-review-actions.test.tssrc/main/gitlab/glab-error-classification.tssrc/main/gitlab/issue-update.tssrc/main/gitlab/issues.test.tssrc/main/gitlab/issues.tssrc/main/gitlab/merge-request-review-mutations.tssrc/main/gitlab/merge-request-state-mutations.tssrc/main/gitlab/merge-request-update.tssrc/main/gitlab/pipeline-job-mutations.tssrc/renderer/src/components/github-item-dialog/discuss-item/conversation-tab.tsxsrc/renderer/src/components/github-item-dialog/discuss-item/gh-comment-composer.tsxsrc/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab-actions.tssrc/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-load.tssrc/renderer/src/components/github-item-dialog/land-pull-request/pr-actions-panel.tsxsrc/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-request-actions.tssrc/renderer/src/components/github/github-work-item-edit-mutations.tssrc/renderer/src/components/gitlab-item-dialog/use-gitlab-details-editing.tssrc/renderer/src/components/gitlab-item-dialog/use-gitlab-pipeline-actions.tssrc/renderer/src/components/gitlab-item-dialog/use-gitlab-primary-actions.tssrc/renderer/src/components/gitlab-item-dialog/use-gitlab-review-actions.tssrc/renderer/src/components/pull-request-page/actions/merge-actions.tssrc/renderer/src/components/pull-request-page/checks/rerun.tssrc/renderer/src/components/pull-request-page/comments/composer.tsxsrc/renderer/src/components/pull-request-page/conversation/reply.tssrc/renderer/src/components/pull-request-page/files/line-comment.tssrc/renderer/src/components/pull-request-page/reviewers/request-actions.tssrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-ai-acknowledgement.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-comment-mutations.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-comment-resolution.tsxsrc/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-entry-refresh-and-title-actions.tsxsrc/renderer/src/components/right-sidebar/right-panel-comment-composer.tsxsrc/renderer/src/components/right-sidebar/use-hosted-review-actions.tssrc/renderer/src/components/right-sidebar/use-ready-hosted-review-action.tssrc/renderer/src/components/task-page/github/AssigneesCell.tsxsrc/renderer/src/components/task-page/github/use-task-page-github-issue-creation.tssrc/renderer/src/hooks/useTaskPageGitHubWorkItemMutation.tssrc/renderer/src/i18n/en-runtime-required.jsonsrc/renderer/src/i18n/locales/de.jsonsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/pt.jsonsrc/renderer/src/i18n/locales/ru.jsonsrc/renderer/src/i18n/locales/tr.jsonsrc/renderer/src/i18n/locales/zh-Hant.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/code-host-error-copy.test.tssrc/renderer/src/lib/code-host-error-copy.tssrc/renderer/src/runtime/gitlab-job-trace-client.tssrc/shared/classified-error.tssrc/shared/code-host-failure-copy.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
| return failure.error | ||
| } | ||
| const detail = typeof failure.errorDetail === 'string' ? failure.errorDetail : null | ||
| return COPY[failure.errorCode](detail) ?? failure.error |
There was a problem hiding this comment.
Preserve provider detail when a translation omits its placeholder.
If a plugin language pack supplies a detail-dependent translation without {{detail}}, COPY[failure.errorCode](detail) returns text that omits the provider's reason. The language-pack validator accepts that string. Fall back to failure.error when a detail-dependent translation does not include the supplied detail. (raw.githubusercontent.com)
Summary
GitHub/GitLab hosted-review and issue operation failures that main returns as
{ ok: false, error: '<English>' }now also carry a semanticerrorCode(and verbatim gh/glab text inerrorDetail), so the renderer shows them in the UI language. The Englisherroris byte-identical to before.What Changed
src/shared/code-host-failure-copy.ts: one English table (CODE_HOST_FAILURE_COPY) pluscodeHostFailure(code, detail?)/classifiedFailure(classified)constructors. Main builds the wire English from this table; the renderer uses the same entries astranslatefallbacks.ClassifiedError(src/shared/classified-error.ts) gets optionalcode/detail.classifyGhError,classifyPullRequestUpdateError,classifyRerunChecksError,classifyGlabErrorandclassifyJobLogErrorkeep theirtypeand Englishmessageand now set an operation-specific code. The PR-updateactionargument is now a code (github.autoMergeEnableFailed,github.mergeQueueAddFailed, …) instead of an English sentence fragment.src/main/github(issue comment/create/update, rerun, review comments, merge, auto-merge, PR details/reviewers/ready/state, stack async merge) andsrc/main/gitlab(issues, issue update, MR review/state/update mutations, pipeline job log/retry).src/renderer/src/lib/code-host-error-copy.ts(codeHostErrorText(result)), used by every call site that toasts or shows these results: PR page rerun/merge/reviewers/comments, GitHub item dialog checks/merge/reviewers/comments, right sidebar hosted-review actions and checks-panel comments/resolution/title, task-page GitHub mutations (one shared runner), issue creation, GitLab item dialog actions, the GitLab job-trace client, and the right-panel comment composer.codeHost.errors.*(40 keys) to all 11 locales.Why
These strings were toasted as-is in English (#32207). Codes follow the approved wire design: additive fields, a plain string at the wire (no zod enum, no
.strict()objects touched), and narrowing on the client. IPC handlers, runtime RPC methods and the web preload all pass these result objects through unchanged, so the new fields reach every client.Mixed versions: an older host sends no code, so the client shows its English
error. A newer host may send an unknown code, which also falls back toerror. A coded failure whose{{detail}}is missing falls back the same way. Mobile is unchanged and keeps showing the Englisherror.New module vs
task-provider-error-copy.ts: that module serves zero-parameter Linear/Jira codes and matches legacy English sentences. GitHub/GitLab failures need a verbatim{{detail}}slot and an English table shared with main. Merging the two would mix two wire models in one file, so this stays a separate module next to it inlib/.Left in English, deliberately:
… (N reruns already started)). Localizing this would mean composing two translated sentences.;. A single failure is coded.classifyListIssuesError/classifyListPrsError/classifyListFetchError). The renderer detects the GitHub search-window phrase in these messages, so they are unchanged here.Invalid PR number, …), and GitHub's own stack-merge messages, which come from GitHub itself.Linked Issue
Refs #32207
Visual Proof
N/A — copy/i18n only
Testing
pnpm tc: passed.pnpm test src/main/github src/main/gitlab: 1523 passed. Assertions that used stricttoEqualon the old{ ok, error }now usetoMatchObject; enable/disable auto-merge and job-log assertions also check the code and detail.pnpm test src/renderer/src/lib/code-host-error-copy.test.ts: known code → es text, detail with{{detail}}/$&kept verbatim, uncoded/unknown/missing-detail/toString→ English, producer English unchanged.pnpm sync:localization-runtime-catalogandverify:localization-{catalogs,catalog,extraction,coverage,runtime-catalog}: passed.pnpm check:changed --maxWorkers=2: every non-test check passed, including changed-code quality and localization. The unit-test step had not finished after 25+ minutes on the loaded machine, so CI is the gate for it.