Skip to content

[P2] fix(checks): give the PR page and work-item dialog the shared check-count labels - #11813

Merged
nwparker merged 1 commit into
mainfrom
nwparker/fix-pr-check-label-drift
Jul 31, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/fix-pr-check-label-drift

Conversation

@nwparker

@nwparker nwparker commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-on to #11700, found by the v1.4.163-rc.1..v1.4.163-rc.3 production release scan. #11700 gave every check surface one shared classifier for the passed bucket, but the PR page and the work-item dialog kept re-deriving the other four buckets locally, and then labelled one of them with a word that is now provably wrong.

The mislabel

On origin/main, PullRequestPage.tsx:5299 and GitHubItemDialog.tsx render the neutral bucket as:

label: translate('auto.components.PullRequestPage.e6ad0a8d06', '{{value0}} skipped', {
  value0: counts.neutral
})

But getCheckCounts already routes skipped into passing, because the shared classifier buckets it there:

// src/shared/provider-check-summary.ts
// Why: a skipped job is a deliberate "not applicable", not an unresolved signal — every surface
const PASSED_CONCLUSIONS = new Set(['success', 'skipped'])

So no skipped check is ever in the bucket labelled "skipped". What is actually in it is neutral conclusions and GitLab manual gates. Meanwhile the checks pill on the sidebar, via the shared getProviderChecksLabel, calls that same set "Unresolved checks". Same PR, same data, two panes, two different words — one of which is factually incorrect.

This is exactly the drift class #11700 set out to remove.

The second classifier

Beyond the label, getCheckCounts still hand-rolled the failing / pending / neutral split:

} else if (['failure', 'cancelled', 'timed_out'].includes(conclusion)) {
  counts.failing += 1
} else if (conclusion === 'neutral') {
  counts.neutral += 1
} else {
  counts.pending += 1
}

That is a third rulebook living next to the shared one, and it is what let the label drift in the first place. It also disagrees with the shared summarizer on inputs the shared one has explicit handling for — an unrecognized conclusion falls into pending here but is classified deliberately there.

Fix

  • pr-check-counts.ts:24 — getCheckCounts now reads every bucket off summarizeProviderChecks. Only action_required is split back out of failed, because it blocks merge like a failure but is rendered amber rather than red.
  • pr-check-counts.ts:41 — new getCheckCountChips(counts) returning { tone, label }[]. Both panes had a ~45-line copy of the identical chip-building block; both now call this. tone keys the caller's own CHECK_COLOR / CHECK_ICON maps, so styling stays with each surface.
  • The neutral chip now reads {n} unresolved, matching getProviderChecksLabel.
  • provider-check-classification-parity.test.ts — both surfaces added to the existing parity assertion list, so a future divergence fails the build.
  • i18n: five new auto.components.pr-check-counts.* keys across en/es/ja/ko/zh; the ten now-orphaned per-surface keys deleted.

ELI5

A pull request has a list of automated checks. Some pass, some fail, some are still running, some are "skipped — not needed for this change", and a few end in a state that is neither pass nor fail.

Orca counts "skipped" as passed, on purpose: skipping a check is a deliberate "not applicable", not a problem. That decision was made once and put in a shared rulebook.

But the PR page had a leftover summary line that said "3 skipped" — pointing at a group that, because of that very rule, can never contain a skipped check. It was really showing the leftover checks that ended in nothing conclusive. And the sidebar, three inches away, called the exact same group "Unresolved checks".

So: one PR, two panes, two different words, and the more prominent one was describing something that wasn't there. This PR makes both panes say "unresolved", and makes them get their numbers from the same rulebook as everything else instead of a private copy.

Screenshots

The only rendered difference on the PR page and the work-item dialog is the chip's wording: 3 skipped → 3 unresolved.

The colour is unchanged and this is verifiable from the diff rather than by eye: the old code hardcoded className: 'text-muted-foreground' for that chip, and the new code resolves CHECK_COLOR[chip.tone] where CHECK_COLOR.neutral === 'text-muted-foreground' (right-sidebar/checks-panel-content.tsx:132). Identical string. The other four chips already used CHECK_COLOR.* and pass through unchanged.

Here is the surface, rendered from this branch against a real PR (#11809) in the Electron dev build:

PR checks tab

Read this shot honestly: it shows the chip row now produced by the shared getCheckCountChips — 1 passing · 4 action required — and confirms the other four chips render unchanged. It does not show the fix, because this PR has no neutral checks, so the renamed bucket is absent and the before/after would be identical. Reproducing the renamed chip needs a PR with a neutral conclusion or a blocked GitLab manual gate, which is not something I can conjure on demand against a live repo. Rather than mock one up and present it as a real capture, the wording change is pinned by the 14-row parity table below, which asserts the literal strings both panes emit.

Proof of fix

1. The mislabel, straight from origin/main:

$ git show origin/main:src/renderer/src/components/PullRequestPage.tsx | grep -n 'skipped'
5299:  label: translate('auto.components.PullRequestPage.e6ad0a8d06', '{{value0}} skipped', {

$ git show origin/main:src/shared/provider-check-summary.ts | grep -n 'PASSED_CONCLUSIONS'
9:const PASSED_CONCLUSIONS = new Set(['success', 'skipped'])

skipped is in the passed set, so the chip labelled "skipped" cannot contain one. And the shared label function for the same bucket:

return summary.state === 'neutral' ? 'Unresolved checks' : `${summary.passed}/${summary.total} passed`

2. The parity test fails without the fix. With pr-check-counts.ts reverted to origin/main and the tests kept:

 × 'all success' resolves identically on every desktop surface
 × 'success plus skipped' resolves identically on every desktop surface
 × 'all skipped' resolves identically on every desktop surface
 × 'success plus neutral' resolves identically on every desktop surface
 × 'all neutral' resolves identically on every desktop surface
 × 'success plus failure' resolves identically on every desktop surface
 × 'success plus running' resolves identically on every desktop surface
 × 'GitLab manual gate only' resolves identically on every desktop surface
 × 'GitLab manual gate alongside a green pipeline' resolves identically on every desktop surface
 × 'GitLab skipped-only pipeline' resolves identically on every desktop surface
 × 'GitLab success alongside an unrecognised conclusion' resolves identically on every desktop surface
 × 'GitLab canceled job' resolves identically on every desktop surface
 × 'GitLab manual gate alongside a running job' resolves identically on every desktop surface
 × 'genuine action_required' resolves identically on every desktop surface

 Test Files  1 failed | 1 passed (2)
      Tests  14 failed | 6 passed (20)

All 14 parity rows now cover these two panes; previously none did. The failure is getCheckCountChips is not a function, i.e. the surfaces were literally not in the parity net before.

With the fix restored: 2 files / 20 tests passed.

Proof of no regression

  • src/renderer/src/components/pr-check-counts.test.ts is the pre-existing suite for getCheckCounts and is unmodified by this PR. It still passes against the rewritten implementation — the bucket numbers are unchanged for every case it covers; only the source of truth and the neutral chip's wording changed.
  • Targeted suite at branch tip: 2 files / 20 tests passed.
  • Full desktop suite on the merged tree containing all eight scan fixes: 359 files / 3830 tests passed.
  • npx oxfmt --check and npx oxlint clean.
  • All five locale files re-validated as parseable JSON after the edit.
  • Net −34 lines across the two panes: two ~45-line duplicated chip blocks collapse into one builder.

Behaviour change disclosed

getCheckCounts now derives failing and pending from summarizeProviderChecks rather than its own ['failure','cancelled','timed_out'] list. For every conclusion the old list named, the result is identical. For conclusions it did not name — unrecognized/unknown values, which the old code silently swept into pending — the shared classifier's deliberate handling now applies instead. That is the intended consequence of removing the third rulebook, and the parity table pins it ('GitLab success alongside an unrecognised conclusion', 'GitLab canceled job').

Testing

  • pnpm lint — clean (oxlint, type-aware audit, reliability gates, max-lines ratchet, localization catalog/extraction/coverage); oxfmt --check clean via lint-staged
  • pnpm typecheck — clean (tsc: node + cli + web)
  • pnpm test (targeted at tip + full desktop suite on the combined tree)
  • pnpm build — not run; no build-graph, packaging, or dependency change
  • Added or updated high-quality tests that would catch regressions

AI Review Report

Reviewed by Claude Opus 5 as part of a 45-agent release scan with adversarial refutation. Risks checked:

  • Provider neutrality: this is a GitHub and GitLab surface. Six of the fourteen parity rows are GitLab cases (manual gate alone, manual gate + green pipeline, manual gate + running job, skipped-only pipeline, canceled job, unrecognized conclusion). GitLab manual maps to neutral and therefore lands in the newly-renamed chip — the wording fix matters more for GitLab than GitHub, since a blocked GitLab pipeline is the most common way to populate that bucket.
  • Cross-platform: no platform-dependent code. Pure classification and label logic, no paths, shells, or shortcuts.
  • i18n: confirmed the five new keys exist in all five locale files and that the ten deleted keys have no remaining referents (grep for each hash across src/). Non-English locales carry the new keys with translated wording, not English fallbacks.
  • Rendering: the React.Fragment key changed from chip.label to chip.tone. tone is unique per chip by construction (each bucket pushes at most one chip), and it is more stable than the label, which changes with locale and count.
  • SSH / folder workspaces: not applicable; no execution-host or git code touched.

Security Audit

  • No new dependencies, no lockfile change, no install hooks.
  • No shell execution, no eval, no path handling, no IPC, no auth, no secrets.
  • Untrusted input: check conclusions arrive from the GitHub/GitLab API. They are only ever compared against closed sets and used to select a translation key — never interpolated into a command, path, or URL. Counts are integers derived from Array.length / filter, and reach the DOM as React text children, so there is no injection surface.
  • The i18n deletions were checked for dangling references before removal.

Notes

  • This PR fixes the wording and the classifier source for the two panes. It intentionally does not touch src/shared/pr-check-severity-order.ts; ordering is a separate concern from classification, and [P1] fix(checks): stop skipped and manual checks reporting as failures #11700 already settled it.
  • Scope grew slightly beyond the original finding: the scan flagged the label divergence, but fixing it properly meant removing the local classifier that caused it, which also brought GitHubItemDialog.tsx (same duplicated block) into the change.

Made with Orca 🐋

@nwparker
nwparker requested a review from brennanb2025 as a code owner July 31, 2026 21:00
@nwparker
nwparker merged commit 81fee4d into main Jul 31, 2026
41 of 42 checks passed
@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown

Greptile Summary

This PR consolidates check-count derivation for the PR page (PullRequestPage.tsx) and work-item dialog (GitHubItemDialog.tsx) onto the shared summarizeProviderChecks rollup, fixing a label divergence where the neutral bucket was rendered as "skipped" while the sidebar called the same checks "unresolved." A new getCheckCountChips helper in pr-check-counts.ts eliminates the ~45-line duplicated chip-building block in each pane, and the parity test is extended to pin both surfaces so future divergence fails CI.

  • getCheckCounts now reads passed/failed/pending/neutral off summarizeProviderChecks and splits action_required back out via a targeted filter, removing the private classifier that let the label drift.
  • getCheckCountChips exposes a typed tone field (keyed to the caller's CHECK_COLOR/CHECK_ICON maps) instead of a per-locale className, and emits "N unresolved" for the neutral bucket, matching the sidebar label.
  • Five locale files gain the five consolidated i18n keys; the ten now-orphaned per-surface keys are deleted.

Confidence Score: 5/5

Safe to merge — the change is purely label/classification consolidation with no new dependencies, no side-effects beyond UI text, and a parity test suite that would catch any future drift.

The rewrite of getCheckCounts is mathematically sound: failing = summary.failed − needsAction cannot underflow because action_required is always routed to failed by the shared classifier before the subtraction. All five existing getCheckCounts tests pass unmodified against the new implementation (traced manually), the 14-row parity table now covers both surfaces, and the neutral chip wording is pinned by a literal-string assertion. The i18n consolidation removes exactly the ten per-surface keys that had no remaining referents and adds five correctly-placed replacements in all five locale files.

Files Needing Attention: No files require special attention.

Important Files Changed

Filename Overview
src/renderer/src/components/pr-check-counts.ts Replaces the local reduce-based classifier with a delegation to summarizeProviderChecks; adds getCheckCountChips for shared chip rendering. Logic is correct: failing = summary.failed − needsAction cannot go negative because action_required is always in FAILED_CONCLUSIONS.
src/renderer/src/components/provider-check-classification-parity.test.ts Adds getCheckCounts / getCheckCountChips assertions for 14 parity cases, pinning bucket numbers and the literal neutral-chip label string.
src/renderer/src/components/PullRequestPage.tsx Removes the ~45-line inline chip builder and delegates to getCheckCountChips; switches React.Fragment key from chip.label to the stable chip.tone.
src/renderer/src/components/GitHubItemDialog.tsx Identical structural change to PullRequestPage.tsx — inline chip block removed, getCheckCountChips called, React.Fragment key updated.
src/renderer/src/i18n/locales/en.json Removes 10 orphaned per-surface keys and adds 5 consolidated keys under auto.components.pr-check-counts. Consolidation is correct and complete.

Reviews (1): Last reviewed commit: "[P2] fix(checks): give the PR page and w..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change centralizes pull-request check count calculation and chip generation. Both check views now render chips from the shared helper and map colors from chip tones. Provider parity tests cover failed, action-required, and unresolved counts. Locale files add shared translations for all check-count categories and remove duplicated status entries.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: shared check-count labels for the PR page and work-item dialog.
Description check ✅ Passed The description covers the user-visible change, screenshots, testing, AI review, security audit, and platform notes in sufficient detail.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@nwparker
nwparker deleted the nwparker/fix-pr-check-label-drift branch July 31, 2026 21:05

@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

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f5fdf0e1-089c-40e6-a7e7-c8f261104032

📥 Commits

Reviewing files that changed from the base of the PR and between e698241 and da05e1b.

📒 Files selected for processing (9)
  • src/renderer/src/components/GitHubItemDialog.tsx
  • src/renderer/src/components/PullRequestPage.tsx
  • src/renderer/src/components/pr-check-counts.ts
  • src/renderer/src/components/provider-check-classification-parity.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json

Comment on lines +14283 to +14288
"pr-check-counts": {
"passingChip": "{{value0}} pasando",
"failingChip": "{{value0}} fallando",
"pendingChip": "{{value0}} pendiente",
"needsActionChip": "{{value0}} requiere acción",
"unresolvedChip": "{{value0}} sin resolver"

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Make the Spanish chip labels count-safe.

{{value0}} pendiente and {{value0}} requiere acción use singular forms when the count is greater than one. {{value0}} pasando and {{value0}} fallando are also not idiomatic status labels in this context. Use the repository’s pluralization convention or count-neutral category labels.

This review uses the PR objective that these strings render check-count chips.

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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