Skip to content

fix(i18n): code GitHub/GitLab operation failures for the renderer - #35689

Merged
OrcaWin merged 3 commits into
mainfrom
OrcaWin/i18n-main-codes-9
Oct 29, 2026
Merged

OrcaWin merged 3 commits into
mainfrom
OrcaWin/i18n-main-codes-9

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​58 $\color{#cf222e}{\Huge{\mathbf{−}}}$​16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42
Prod 63 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1108 $\color{#cf222e}{\Huge{\mathbf{−}}}$​215 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​893

Summary

GitHub/GitLab hosted-review and issue operation failures that main returns as { ok: false, error: '<English>' } now also carry a semantic errorCode (and verbatim gh/glab text in errorDetail), so the renderer shows them in the UI language. The English error is byte-identical to before.

What Changed

  • src/shared/code-host-failure-copy.ts: one English table (CODE_HOST_FAILURE_COPY) plus codeHostFailure(code, detail?) / classifiedFailure(classified) constructors. Main builds the wire English from this table; the renderer uses the same entries as translate fallbacks.
  • ClassifiedError (src/shared/classified-error.ts) gets optional code/detail. classifyGhError, classifyPullRequestUpdateError, classifyRerunChecksError, classifyGlabError and classifyJobLogError keep their type and English message and now set an operation-specific code. The PR-update action argument is now a code (github.autoMergeEnableFailed, github.mergeQueueAddFailed, …) instead of an English sentence fragment.
  • Fixed sentences coded across src/main/github (issue comment/create/update, rerun, review comments, merge, auto-merge, PR details/reviewers/ready/state, stack async merge) and src/main/gitlab (issues, issue update, MR review/state/update mutations, pipeline job log/retry).
  • Renderer: 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.
  • Added 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 to error. A coded failure whose {{detail}} is missing falls back the same way. Mobile is unchanged and keeps showing the English error.

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 in lib/.

Left in English, deliberately:

  • Partial rerun failures (… (N reruns already started)). Localizing this would mean composing two translated sentences.
  • Issue updates where several gh/glab steps fail at once. These still join English messages with ; . A single failure is coded.
  • List banners (classifyListIssuesError/classifyListPrsError/classifyListFetchError). The renderer detects the GitHub search-window phrase in these messages, so they are unchanged here.
  • The IPC handler argument-validation strings (Invalid PR number, …), and GitHub's own stack-merge messages, which come from GitHub itself.
  • PR/MR start points and stacked PR creation follow in a separate PR.

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 strict toEqual on the old { ok, error } now use toMatchObject; 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-catalog and verify: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.
  • Codex review: fixed its findings (comment composers, a cast, exhaustive switches). The remaining two (partial rerun, multi-step issue update) are listed above.

@OrcaWin
OrcaWin requested a review from brennanb2025 as a code owner October 29, 2026 04:59
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable new issue was found.

Summary

Adds shared error codes for GitHub/GitLab failures and translates them in renderer error messages.

  • GitHub operation failures now carry codes for translated messages.
  • GitLab operation failures now carry codes for translated messages.
  • GitHub and GitLab screens now show translated failure messages.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[GitHub or GitLab failure] --> B[Shared English copy and error code]
  B --> C[IPC or runtime RPC]
  C --> D{Renderer knows the code?}
  D -->|Yes, required detail present| E[Translated message]
  D -->|No, or detail missing| F[Original English error]
Loading

Reviews (2) · Last reviewed commit: "Merge origin/main" · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 66bbee3a-387c-4dbf-bf60-0b2321d9689e
Commits

Reviewing files that changed from the base of the PR and between ef81633 and a80f9f4.

Files selected for processing: 72
  • src/main/github/client-merge-queue-auto-merge.test.ts
  • src/main/github/client-pr-checks.test.ts
  • src/main/github/client/check/rerun-pr-checks.ts
  • src/main/github/client/create/add-pr-review-comment.ts
  • src/main/github/client/merge/merge-pr.ts
  • src/main/github/client/merge/pr-auto-merge.ts
  • src/main/github/client/update/pr-details.ts
  • src/main/github/client/update/pr-ready.ts
  • src/main/github/client/update/pr-reviewers.ts
  • src/main/github/client/update/pr-state.ts
  • src/main/github/gh-error-classification.ts
  • src/main/github/gh-utils.test.ts
  • src/main/github/github-pr-stack-async-merge.ts
  • src/main/github/github-pr-stack.test.ts
  • src/main/github/issue-comment.ts
  • src/main/github/issue-create.ts
  • src/main/github/issue-update.ts
  • src/main/github/issues.test.ts
  • src/main/gitlab/client-mr-job-ci.test.ts
  • src/main/gitlab/client-mr-review-actions.test.ts
  • src/main/gitlab/glab-error-classification.ts
  • src/main/gitlab/issue-update.ts
  • src/main/gitlab/issues.test.ts
  • src/main/gitlab/issues.ts
  • src/main/gitlab/merge-request-review-mutations.ts
  • src/main/gitlab/merge-request-state-mutations.ts
  • src/main/gitlab/merge-request-update.ts
  • src/main/gitlab/pipeline-job-mutations.ts
  • src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab.tsx
  • src/renderer/src/components/github-item-dialog/discuss-item/gh-comment-composer.tsx
  • src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab-actions.ts
  • src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-load.ts
  • src/renderer/src/components/github-item-dialog/land-pull-request/pr-actions-panel.tsx
  • src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-request-actions.ts
  • src/renderer/src/components/github/github-work-item-edit-mutations.ts
  • src/renderer/src/components/gitlab-item-dialog/use-gitlab-details-editing.ts
  • src/renderer/src/components/gitlab-item-dialog/use-gitlab-pipeline-actions.ts
  • src/renderer/src/components/gitlab-item-dialog/use-gitlab-primary-actions.ts
  • src/renderer/src/components/gitlab-item-dialog/use-gitlab-review-actions.ts
  • src/renderer/src/components/pull-request-page/actions/merge-actions.ts
  • src/renderer/src/components/pull-request-page/checks/rerun.ts
  • src/renderer/src/components/pull-request-page/comments/composer.tsx
  • src/renderer/src/components/pull-request-page/conversation/reply.ts
  • src/renderer/src/components/pull-request-page/files/line-comment.ts
  • src/renderer/src/components/pull-request-page/reviewers/request-actions.ts
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-ai-acknowledgement.tsx
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-comment-mutations.tsx
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-comment-resolution.tsx
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-entry-refresh-and-title-actions.tsx
  • src/renderer/src/components/right-sidebar/right-panel-comment-composer.tsx
  • src/renderer/src/components/right-sidebar/use-hosted-review-actions.ts
  • src/renderer/src/components/right-sidebar/use-ready-hosted-review-action.ts
  • src/renderer/src/components/task-page/github/AssigneesCell.tsx
  • src/renderer/src/components/task-page/github/use-task-page-github-issue-creation.ts
  • src/renderer/src/hooks/useTaskPageGitHubWorkItemMutation.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/code-host-error-copy.test.ts
  • src/renderer/src/lib/code-host-error-copy.ts
  • src/renderer/src/runtime/gitlab-job-trace-client.ts
  • src/shared/classified-error.ts
  • src/shared/code-host-failure-copy.ts
Walkthrough

GitHub and GitLab operations now return structured failure results with error codes and, where applicable, details. Shared classifiers and failure helpers define the codes and messages. The renderer maps recognized codes to localized copy and uses that text in code-host action and comment flows. Locale files add translations, and tests cover structured results, translation, detail interpolation, and fallback behavior.

Priority: Pending latest changes

Merge Risk: Low · previous review ef816

Some plugin translations can hide failure details. The change is otherwise mergeable with this limitation understood.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 14.81% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: internationalized GitHub and GitLab operation failures in the renderer. It is concise and relevant.
Description check Passed The description clearly covers the change, rationale, linked issue, visual proof, testing, compatibility behavior, and intentional scope exclusions. It does not reproduce every template heading or che…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly covers the change, rationale, linked issue, visual proof, testing, compatibility behavior, and intentional scope exclusions. It does not reproduce every template heading or checklist item, but the required information is mostly complete.

Full details: Docstring Coverage

Explanation

Docstring coverage is 14.81% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 54 functions across 50 files. (22 skipped: 12 unsupported, 10 over the file limit.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai 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.

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
Commits

Reviewing files that changed from the base of the PR and between a7ec7d1 and ef81633.

Files selected for processing: 72
  • src/main/github/client-merge-queue-auto-merge.test.ts
  • src/main/github/client-pr-checks.test.ts
  • src/main/github/client/check/rerun-pr-checks.ts
  • src/main/github/client/create/add-pr-review-comment.ts
  • src/main/github/client/merge/merge-pr.ts
  • src/main/github/client/merge/pr-auto-merge.ts
  • src/main/github/client/update/pr-details.ts
  • src/main/github/client/update/pr-ready.ts
  • src/main/github/client/update/pr-reviewers.ts
  • src/main/github/client/update/pr-state.ts
  • src/main/github/gh-error-classification.ts
  • src/main/github/gh-utils.test.ts
  • src/main/github/github-pr-stack-async-merge.ts
  • src/main/github/github-pr-stack.test.ts
  • src/main/github/issue-comment.ts
  • src/main/github/issue-create.ts
  • src/main/github/issue-update.ts
  • src/main/github/issues.test.ts
  • src/main/gitlab/client-mr-job-ci.test.ts
  • src/main/gitlab/client-mr-review-actions.test.ts
  • src/main/gitlab/glab-error-classification.ts
  • src/main/gitlab/issue-update.ts
  • src/main/gitlab/issues.test.ts
  • src/main/gitlab/issues.ts
  • src/main/gitlab/merge-request-review-mutations.ts
  • src/main/gitlab/merge-request-state-mutations.ts
  • src/main/gitlab/merge-request-update.ts
  • src/main/gitlab/pipeline-job-mutations.ts
  • src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab.tsx
  • src/renderer/src/components/github-item-dialog/discuss-item/gh-comment-composer.tsx
  • src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab-actions.ts
  • src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-load.ts
  • src/renderer/src/components/github-item-dialog/land-pull-request/pr-actions-panel.tsx
  • src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-request-actions.ts
  • src/renderer/src/components/github/github-work-item-edit-mutations.ts
  • src/renderer/src/components/gitlab-item-dialog/use-gitlab-details-editing.ts
  • src/renderer/src/components/gitlab-item-dialog/use-gitlab-pipeline-actions.ts
  • src/renderer/src/components/gitlab-item-dialog/use-gitlab-primary-actions.ts
  • src/renderer/src/components/gitlab-item-dialog/use-gitlab-review-actions.ts
  • src/renderer/src/components/pull-request-page/actions/merge-actions.ts
  • src/renderer/src/components/pull-request-page/checks/rerun.ts
  • src/renderer/src/components/pull-request-page/comments/composer.tsx
  • src/renderer/src/components/pull-request-page/conversation/reply.ts
  • src/renderer/src/components/pull-request-page/files/line-comment.ts
  • src/renderer/src/components/pull-request-page/reviewers/request-actions.ts
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-ai-acknowledgement.tsx
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-comment-mutations.tsx
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-comment-resolution.tsx
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-entry-refresh-and-title-actions.tsx
  • src/renderer/src/components/right-sidebar/right-panel-comment-composer.tsx
  • src/renderer/src/components/right-sidebar/use-hosted-review-actions.ts
  • src/renderer/src/components/right-sidebar/use-ready-hosted-review-action.ts
  • src/renderer/src/components/task-page/github/AssigneesCell.tsx
  • src/renderer/src/components/task-page/github/use-task-page-github-issue-creation.ts
  • src/renderer/src/hooks/useTaskPageGitHubWorkItemMutation.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/code-host-error-copy.test.ts
  • src/renderer/src/lib/code-host-error-copy.ts
  • src/renderer/src/runtime/gitlab-job-trace-client.ts
  • src/shared/classified-error.ts
  • src/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

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.

Minor · Functional Correctness · Quick win

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)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant