From 6cf77d51fde56bd106f3296524862a8c278b2e75 Mon Sep 17 00:00:00 2001 From: Dara Adedeji Date: Mon, 23 Nov 2026 17:36:45 -0500 Subject: [PATCH 1/2] fix(web): the PR checks count says how many are running instead of done/total --- .../pullRequest/PullRequestChecksPopover.tsx | 32 +++---------------- .../pullRequest/pullRequestPresentation.tsx | 30 +++++++++++++++++ apps/web/src/i18n/translations/de.json | 22 +------------ apps/web/src/i18n/translations/en.json | 22 +------------ apps/web/src/i18n/translations/es.json | 22 +------------ apps/web/src/i18n/translations/fr.json | 22 +------------ apps/web/src/i18n/translations/ja.json | 22 +------------ apps/web/src/i18n/translations/ko.json | 22 +------------ apps/web/src/i18n/translations/pt-BR.json | 22 +------------ apps/web/src/i18n/translations/ru.json | 22 +------------ apps/web/src/i18n/translations/sv.json | 22 +------------ apps/web/src/i18n/translations/zh.json | 22 +------------ 12 files changed, 45 insertions(+), 237 deletions(-) diff --git a/apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx b/apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx index b232c21954110..213848cc0ebfe 100644 --- a/apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx +++ b/apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx @@ -6,7 +6,7 @@ import type { PullRequestRef, ScopedThreadRef, } from "@t3tools/contracts"; -import { msg, T, useGT, useMessages, Var } from "gt-react"; +import { msg, T, useGT, useMessages } from "gt-react"; import { useState } from "react"; import { useOpenLink } from "~/browser/useOpenLink"; @@ -23,6 +23,7 @@ import { toastManager } from "../ui/toast"; import { groupPullRequestChecks } from "./pullRequestDetail.logic"; import { PullRequestCheckStatusIcon, + pullRequestChecksCountLabel, pullRequestCheckStatusLabel, pullRequestChecksStatePresentation, summarizePullRequestChecks, @@ -164,12 +165,7 @@ export function PullRequestChecksPopover({ const gt = useGT(); const resolve = useMessages(); const presentation = pullRequestChecksStatePresentation(checksState, resolve); - const incompleteCount = - checks?.filter((check) => check.status === "pending" || check.status === "action-required") - .length ?? 0; - const failedCount = - checks?.filter((check) => check.status === "failure" || check.status === "cancelled").length ?? - 0; + const countLabel = checks === undefined ? null : pullRequestChecksCountLabel(checks, resolve); const summary = checks === undefined || stale ? null : summarizePullRequestChecks(checks, resolve); return ( @@ -195,26 +191,8 @@ export function PullRequestChecksPopover({ onClick={(event) => event.stopPropagation()} > - {variant === "count" ? ( - <> - {checks !== undefined && incompleteCount > 0 ? ( - // Clip the second line so "checks" disappears whole when the count must shrink. - - - - {checks.length - incompleteCount}/{checks.length} - {" "} - checks - - - ) : failedCount > 0 ? ( - - {gt("{count, plural, one {{count} failed} other {{count} failed}}", { - count: failedCount, - })} - - ) : null} - + {variant === "count" && countLabel !== null ? ( + {countLabel} ) : null} diff --git a/apps/web/src/components/pullRequest/pullRequestPresentation.tsx b/apps/web/src/components/pullRequest/pullRequestPresentation.tsx index 9a3316c184abf..32f40d02d5797 100644 --- a/apps/web/src/components/pullRequest/pullRequestPresentation.tsx +++ b/apps/web/src/components/pullRequest/pullRequestPresentation.tsx @@ -603,6 +603,36 @@ export function PullRequestMetaLine({ ); } +/** The short label beside the checks icon; null when every check passed. */ +export function pullRequestChecksCountLabel( + checks: ReadonlyArray, + resolve: MessageResolver = m, +): string | null { + const count = (statuses: ReadonlyArray) => + checks.filter((check) => statuses.includes(check.status)).length; + const failed = count(["failure", "cancelled"]); + if (failed > 0) { + return resolve( + msg("{count, plural, one {{count} failed} other {{count} failed}}", { count: failed }), + ); + } + const awaitingAction = count(["action-required"]); + if (awaitingAction > 0) { + return resolve( + msg("{count, plural, one {{count} awaiting action} other {{count} awaiting action}}", { + count: awaitingAction, + }), + ); + } + const running = count(["pending"]); + if (running > 0) { + return resolve( + msg("{count, plural, one {{count} running} other {{count} running}}", { count: running }), + ); + } + return null; +} + export function summarizePullRequestChecks( checks: ReadonlyArray, resolve: MessageResolver = m, diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 3fe4a8bfabb00..25baafe92677c 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -6629,28 +6629,8 @@ "a6d75a4380173c60": "Checks öffnen: {summary}", "be3d1766bad18693": "Checks: {summary}", "425e4a3d6c5c2867": "{count, plural, one {{count} fehlgeschlagen} other {{count} fehlgeschlagen}}", + "fd63b391898889f9": "{count, plural, one {{count} wartet auf Aktion} other {{count} warten auf Aktion}}", "cb116c139cdace98": "Keine Checks gemeldet", - "d84d09b4818c50b7": [ - { - "t": "span", - "i": 1, - "c": [ - { - "i": 2, - "k": "_gt_value_2", - "v": "v" - }, - "/", - { - "i": 3, - "k": "_gt_value_3", - "v": "v" - } - ] - }, - " ", - "Checks" - ], "60b56e201607c7ec": "Die Check-Details sind veraltet. Aktualisiere den Pull Request, um sie zu aktualisieren.", "e74cd4e960cbb5e5": "Unveränderte Zeilen sind in einer Datei mit gekürzten Zeilen nicht verfügbar.", "38d6169e04a9a4ce": "Weitere Kommentare konnten nicht geladen werden", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index f03dc33bf1fb8..28c3703c58651 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -6636,28 +6636,8 @@ "a6d75a4380173c60": "Open checks: {summary}", "be3d1766bad18693": "Checks: {summary}", "425e4a3d6c5c2867": "{count, plural, one {{count} failed} other {{count} failed}}", + "fd63b391898889f9": "{count, plural, one {{count} awaiting action} other {{count} awaiting action}}", "cb116c139cdace98": "No checks reported", - "d84d09b4818c50b7": [ - { - "t": "span", - "i": 1, - "c": [ - { - "i": 2, - "k": "_gt_value_2", - "v": "v" - }, - "/", - { - "i": 3, - "k": "_gt_value_3", - "v": "v" - } - ] - }, - " ", - "checks" - ], "60b56e201607c7ec": "Check details are out of date. Refresh the pull request to update them.", "e74cd4e960cbb5e5": "Unchanged lines are unavailable in a file with cut lines.", "38d6169e04a9a4ce": "More comments could not be loaded", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index a701345663865..00f78be22d9b9 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -6629,28 +6629,8 @@ "a6d75a4380173c60": "Abrir comprobaciones: {summary}", "be3d1766bad18693": "Comprobaciones: {summary}", "425e4a3d6c5c2867": "{count, plural, one {{count} con errores} other {{count} con errores}}", + "fd63b391898889f9": "{count, plural, one {{count} pendiente de acción} other {{count} pendientes de acción}}", "cb116c139cdace98": "No se informó de ninguna comprobación", - "d84d09b4818c50b7": [ - { - "t": "span", - "i": 1, - "c": [ - { - "i": 2, - "k": "_gt_value_2", - "v": "v" - }, - "/", - { - "i": 3, - "k": "_gt_value_3", - "v": "v" - } - ] - }, - " ", - "comprobaciones" - ], "60b56e201607c7ec": "Los detalles de las comprobaciones están desactualizados. Actualiza la pull request para ponerlos al día.", "e74cd4e960cbb5e5": "Las líneas sin cambios no están disponibles en un archivo con líneas cortadas.", "38d6169e04a9a4ce": "No se pudieron cargar más comentarios", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index df68cc6cb7438..dd196ff404e85 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -6630,28 +6630,8 @@ "a6d75a4380173c60": "Ouvrir les checks : {summary}", "be3d1766bad18693": "Checks : {summary}", "425e4a3d6c5c2867": "{count, plural, one {{count} en échec} other {{count} en échec}}", + "fd63b391898889f9": "{count, plural, one {{count} en attente d’action} other {{count} en attente d’action}}", "cb116c139cdace98": "Aucun check signalé", - "d84d09b4818c50b7": [ - { - "t": "span", - "i": 1, - "c": [ - { - "i": 2, - "k": "_gt_value_2", - "v": "v" - }, - "/", - { - "i": 3, - "k": "_gt_value_3", - "v": "v" - } - ] - }, - " ", - "checks" - ], "60b56e201607c7ec": "Les détails des checks ne sont plus à jour. Actualisez la pull request pour les mettre à jour.", "e74cd4e960cbb5e5": "Les lignes inchangées ne sont pas disponibles dans un fichier aux lignes tronquées.", "38d6169e04a9a4ce": "Impossible de charger plus de commentaires", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index 3752913600c78..c7ea00c8becf4 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -6599,28 +6599,8 @@ "a6d75a4380173c60": "チェックを開く: {summary}", "be3d1766bad18693": "チェック: {summary}", "425e4a3d6c5c2867": "{count, plural, other {{count} 件失敗}}", + "fd63b391898889f9": "{count, plural, other {{count} 件が操作待ち}}", "cb116c139cdace98": "報告されたチェックはありません", - "d84d09b4818c50b7": [ - { - "t": "span", - "i": 1, - "c": [ - { - "i": 2, - "k": "_gt_value_2", - "v": "v" - }, - "/", - { - "i": 3, - "k": "_gt_value_3", - "v": "v" - } - ] - }, - " ", - "件のチェック" - ], "60b56e201607c7ec": "チェックの詳細が古くなっています。更新するにはプルリクエストを更新してください。", "e74cd4e960cbb5e5": "行が省略されたファイルでは、変更されていない行を表示できません。", "38d6169e04a9a4ce": "これ以上コメントを読み込めませんでした", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index c327226d81e4c..9056279ff8362 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -6601,28 +6601,8 @@ "a6d75a4380173c60": "검사 열기: {summary}", "be3d1766bad18693": "검사: {summary}", "425e4a3d6c5c2867": "{count, plural, other {{count}개 실패}}", + "fd63b391898889f9": "{count, plural, other {{count}개 조치 대기 중}}", "cb116c139cdace98": "보고된 검사 없음", - "d84d09b4818c50b7": [ - { - "t": "span", - "i": 1, - "c": [ - { - "i": 2, - "k": "_gt_value_2", - "v": "v" - }, - "/", - { - "i": 3, - "k": "_gt_value_3", - "v": "v" - } - ] - }, - " ", - "검사" - ], "60b56e201607c7ec": "검사 세부 정보가 오래되었습니다. 업데이트하려면 풀 리퀘스트를 새로 고치세요.", "e74cd4e960cbb5e5": "잘린 줄이 있는 파일에서는 변경되지 않은 줄을 사용할 수 없습니다.", "38d6169e04a9a4ce": "댓글을 더 불러올 수 없습니다", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index 36d5130814b0a..571b092c5c7a7 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -6629,28 +6629,8 @@ "a6d75a4380173c60": "Abrir verificações: {summary}", "be3d1766bad18693": "Verificações: {summary}", "425e4a3d6c5c2867": "{count, plural, one {{count} com falha} other {{count} com falha}}", + "fd63b391898889f9": "{count, plural, one {{count} aguardando ação} other {{count} aguardando ação}}", "cb116c139cdace98": "Nenhuma verificação informada", - "d84d09b4818c50b7": [ - { - "t": "span", - "i": 1, - "c": [ - { - "i": 2, - "k": "_gt_value_2", - "v": "v" - }, - "/", - { - "i": 3, - "k": "_gt_value_3", - "v": "v" - } - ] - }, - " ", - "verificações" - ], "60b56e201607c7ec": "Os detalhes das verificações estão desatualizados. Atualize o pull request para atualizá-los.", "e74cd4e960cbb5e5": "As linhas não alteradas não estão disponíveis em um arquivo com linhas cortadas.", "38d6169e04a9a4ce": "Não foi possível carregar mais comentários", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 34d4295aa74d4..64758b43c4bae 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -6629,28 +6629,8 @@ "a6d75a4380173c60": "Открыть проверки: {summary}", "be3d1766bad18693": "Проверки: {summary}", "425e4a3d6c5c2867": "{count, plural, one {Ошибок: {count}} few {Ошибок: {count}} many {Ошибок: {count}} other {Ошибок: {count}}}", + "fd63b391898889f9": "{count, plural, one {{count} ожидает действия} few {{count} ожидают действия} many {{count} ожидают действия} other {{count} ожидают действия}}", "cb116c139cdace98": "Нет проверок", - "d84d09b4818c50b7": [ - { - "t": "span", - "i": 1, - "c": [ - { - "i": 2, - "k": "_gt_value_2", - "v": "v" - }, - "/", - { - "i": 3, - "k": "_gt_value_3", - "v": "v" - } - ] - }, - " ", - "проверок" - ], "60b56e201607c7ec": "Подробности проверок устарели. Обновите пул-реквест, чтобы обновить их.", "e74cd4e960cbb5e5": "Неизменённые строки недоступны в файле с обрезанными строками.", "38d6169e04a9a4ce": "Не удалось загрузить остальные комментарии", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index 8b26904ba4a54..14ca5be715399 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -6635,28 +6635,8 @@ "a6d75a4380173c60": "Öppna kontroller: {summary}", "be3d1766bad18693": "Kontroller: {summary}", "425e4a3d6c5c2867": "{count, plural, one {{count} misslyckades} other {{count} misslyckades}}", + "fd63b391898889f9": "{count, plural, one {{count} väntar på åtgärd} other {{count} väntar på åtgärd}}", "cb116c139cdace98": "Inga kontroller rapporterade", - "d84d09b4818c50b7": [ - { - "t": "span", - "i": 1, - "c": [ - { - "i": 2, - "k": "_gt_value_2", - "v": "v" - }, - "/", - { - "i": 3, - "k": "_gt_value_3", - "v": "v" - } - ] - }, - " ", - "kontroller" - ], "60b56e201607c7ec": "Kontrolldetaljerna är inaktuella. Uppdatera pull requesten för att uppdatera dem.", "e74cd4e960cbb5e5": "Oförändrade rader är inte tillgängliga i en fil med bortklippta rader.", "38d6169e04a9a4ce": "Fler kommentarer kunde inte läsas in", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index cc9e902308327..691a02e6b1215 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -6641,28 +6641,8 @@ "a6d75a4380173c60": "打开检查:{summary}", "be3d1766bad18693": "检查:{summary}", "425e4a3d6c5c2867": "{count, plural, other {{count} 个失败}}", + "fd63b391898889f9": "{count, plural, other {{count} 个等待操作}}", "cb116c139cdace98": "未报告任何检查", - "d84d09b4818c50b7": [ - { - "t": "span", - "i": 1, - "c": [ - { - "i": 2, - "k": "_gt_value_2", - "v": "v" - }, - "/", - { - "i": 3, - "k": "_gt_value_3", - "v": "v" - } - ] - }, - " ", - "项检查" - ], "60b56e201607c7ec": "检查详情已过期。刷新 pull request 以更新。", "e74cd4e960cbb5e5": "包含截断行的文件中无法查看未更改的行。", "38d6169e04a9a4ce": "无法加载更多评论", From 5557707affa0b736529e582793ad3ff8800930ca Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 24 Nov 2026 05:13:21 +0000 Subject: [PATCH 2/2] test(web): cover the checks count label's priority order Co-Authored-By: Claude Opus 5.5 --- .../pullRequestPresentation.test.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 apps/web/src/components/pullRequest/pullRequestPresentation.test.ts diff --git a/apps/web/src/components/pullRequest/pullRequestPresentation.test.ts b/apps/web/src/components/pullRequest/pullRequestPresentation.test.ts new file mode 100644 index 0000000000000..9541f1f91fb6f --- /dev/null +++ b/apps/web/src/components/pullRequest/pullRequestPresentation.test.ts @@ -0,0 +1,28 @@ +import type { PullRequestCheck } from "@t3tools/contracts"; +import { describe, expect, it } from "vite-plus/test"; + +import { pullRequestChecksCountLabel } from "./pullRequestPresentation"; + +const checks = (...statuses: ReadonlyArray): PullRequestCheck[] => + statuses.map((status) => ({ name: "ci", status, description: null, url: null })); + +describe("pullRequestChecksCountLabel", () => { + it("names the most urgent group: failed, then awaiting action, then running", () => { + expect( + pullRequestChecksCountLabel( + checks("failure", "cancelled", "action-required", "pending", "success"), + ), + ).toBe("2 failed"); + expect(pullRequestChecksCountLabel(checks("action-required", "pending", "pending"))).toBe( + "1 awaiting action", + ); + expect(pullRequestChecksCountLabel(checks("pending", "pending", "success", "skipped"))).toBe( + "2 running", + ); + }); + + it("shows nothing once no check is failed, waiting or running", () => { + expect(pullRequestChecksCountLabel(checks("success", "skipped", "neutral"))).toBeNull(); + expect(pullRequestChecksCountLabel([])).toBeNull(); + }); +});