Repository navigation
[P2] fix(mobile): put the PR sidebar and branch chip on the shared check classifier - #11815
Conversation
…eck classifier Co-authored-by: Orca <[email protected]>
Greptile SummaryThis PR unifies mobile's PR-check classifier with the shared desktop classifier, eliminating three concrete display inconsistencies:
Confidence Score: 5/5Safe to merge — all changes are presentation-only, touch no persisted state, and fix real display bugs that caused mobile to contradict desktop and itself. The three defects are well-characterized and the fixes are targeted: a two-entry allowlist addition in the parser, a deletion of a duplicate classifier, and a one-line text disambiguation. The OUTCOME_BY_SHARED and OUTCOME_BY_STATE mapping tables are typed as exhaustive Record<…> so any future addition to the shared CheckOutcome union will surface as a type error rather than a silent fallthrough. Tests cover all three production failure scenarios with before/after assertions. No schema, wire contract, or persisted state is touched. Files Needing Attention: No files require special attention. The shared module src/shared/provider-check-summary.ts is read-only from this PR's perspective and is well-tested by the existing desktop suite.
|
| Filename | Overview |
|---|---|
| mobile/src/components/pr-sidebar/pr-checks-presentation.ts | Removes the local classifier sets and delegates to the shared module; mapping tables are exhaustive (typed as Record<…>) and the label-building logic is unchanged. |
| mobile/src/source-control/mobile-pr-chip-summary.ts | Switches buildChipRollup to use summarizeProviderChecks directly and correctly distinguishes empty-check-list from all-neutral-check-list in the fallback text. |
| mobile/src/session/github-pr-value-readers.ts | Adds action_required to the conclusion allowlist so merge-blocking gates survive the parsing boundary and reach the shared classifier as failures. |
| mobile/src/components/pr-sidebar/pr-checks-presentation.test.ts | Tests updated and new cases added covering all three defects; the neutral-only set test correctly removes skipped (which now counts as passed). |
| mobile/src/source-control/mobile-pr-chip-summary.test.ts | Three new tests verify the three defect scenarios (skipped counting, action_required failing, neutral-only label), complementing the existing coverage well. |
| mobile/src/session/github-pr-value-readers.test.ts | New readCheckRunConclusion test block validates that action_required survives parsing and reaches the shared classifier as a failure; round-trip verified. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[GitHub API\ncheck run data] --> B[readCheckRunConclusion\ngithub-pr-value-readers.ts]
B -->|action_required now preserved\nwas: dropped → null| C[PRCheckDetail\nconclusion field]
C --> D{Surface}
D -->|Mobile chip\nbuildChipRollup| E[summarizeProviderChecks\nshared module]
D -->|Mobile sidebar\nsummarizePRChecks| F[summarizeProviderChecks\nshared module]
D -->|Desktop| G[summarizeProviderChecks\nshared module]
E --> H[classifyCheckOutcome\nskipped→passed\naction_required→failed]
F --> H
G --> H
H --> I[Single consistent\ncheck result]
I -->|Before fix: mobile used\nlocal sets — skipped→neutral\naction_required→pending| J[❌ Inconsistent\nbetween surfaces]
I -->|After fix: all surfaces\nuse shared classifier| K[✅ Consistent\nacross desktop & mobile]
Reviews (1): Last reviewed commit: "[P2] fix(mobile): put the PR sidebar and..." | Re-trigger Greptile
📝 WalkthroughWalkthroughMobile check handling now uses shared classification and summary logic. The reader preserves 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4171375e-7f87-4fbf-bf8b-553ff28688e3
📒 Files selected for processing (6)
mobile/src/components/pr-sidebar/pr-checks-presentation.test.tsmobile/src/components/pr-sidebar/pr-checks-presentation.tsmobile/src/session/github-pr-value-readers.test.tsmobile/src/session/github-pr-value-readers.tsmobile/src/source-control/mobile-pr-chip-summary.test.tsmobile/src/source-control/mobile-pr-chip-summary.ts
| describe('readCheckRunConclusion', () => { | ||
| it('keeps every conclusion the shared classifier can act on', () => { | ||
| for (const conclusion of ['success', 'failure', 'cancelled', 'timed_out', 'skipped']) { | ||
| expect(readCheckRunConclusion(conclusion)).toBe(conclusion) | ||
| } | ||
| }) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Cover neutral and pending conclusions.
The test claims to cover every supported conclusion, but it omits neutral and pending. Both values are accepted by readCheckRunConclusion and classified by the shared summary logic.
Proposed fix
- for (const conclusion of ['success', 'failure', 'cancelled', 'timed_out', 'skipped']) {
+ for (const conclusion of ['success', 'failure', 'cancelled', 'timed_out', 'skipped', 'neutral', 'pending']) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| describe('readCheckRunConclusion', () => { | |
| it('keeps every conclusion the shared classifier can act on', () => { | |
| for (const conclusion of ['success', 'failure', 'cancelled', 'timed_out', 'skipped']) { | |
| expect(readCheckRunConclusion(conclusion)).toBe(conclusion) | |
| } | |
| }) | |
| describe('readCheckRunConclusion', () => { | |
| it('keeps every conclusion the shared classifier can act on', () => { | |
| for (const conclusion of ['success', 'failure', 'cancelled', 'timed_out', 'skipped', 'neutral', 'pending']) { | |
| expect(readCheckRunConclusion(conclusion)).toBe(conclusion) | |
| } | |
| }) |
…eck classifier (stablyai#11815) Co-authored-by: Orca <[email protected]>
Summary
Follow-on to #11700, found by the
v1.4.163-rc.1..v1.4.163-rc.3production release scan (independently corroborated by an external scan, then verified against the source at the target ref).#11700 moved every desktop check surface onto one shared classifier and left mobile behind. Mobile kept a second copy of the rules, so the same PR reads differently depending on which mobile surface you look at — and one mobile surface contradicts another.
Three concrete defects
1.
skippedcounts as unresolved on mobile, passed on desktop.pr-checks-presentation.tshad its ownSUCCESS_CONCLUSIONS = new Set(['success']), while the shared classifier isnew Set(['success', 'skipped']). A PR with 2 successes and 1 skipped check renders2/3on the mobile branch chip and3/3in the desktop header and the mobile tasks grid.2. A PR whose checks all resolved to nothing renders as "No checks".
buildChipRollupfell through to{ text: 'No checks' }wheneverpassed,pendingandfailedwere all zero — which is also true when there are checks and they all came back neutral. That is a different fact being reported as the same fact. With the shared classifier a 2-skipped PR now reads2/2, and a genuinely all-neutral PR reads "Unresolved checks".3.
action_requiredis dropped at the parsing boundary.readCheckRunConclusioningithub-pr-value-readers.tsdid not listaction_requiredamong the accepted values, so it returnednull.PRCheckDetail['conclusion']allows it (src/shared/types.ts:1400), the host emits it (src/main/github/mappers.ts:26), and the host synthesizes suites carrying it (src/main/github/client.ts:3425,:3551). The shared classifier treats it as a failure, because it blocks merge.Defect 3 is the sharpest: a merge-blocking approval gate arrived as a
nullconclusion, was read as "still pending", and — with a passing check alongside it — the chip rendered green1/2for a PR that desktop correctly showed as failing.Fix
pr-checks-presentation.ts:2-37— deleted the localSUCCESS_CONCLUSIONS/FAILURE_CONCLUSIONSsets;checkOutcomenow delegates toclassifyCheckOutcomethrough apassed|failed|pending|neutral→success|failure|pending|neutralname map. Mobile's own outcome vocabulary is preserved; only the rules move.pr-checks-presentation.ts:66-102—summarizePRCheckstakes its counts and its worst-case rollup fromsummarizeProviderChecks. Only the label wording stays mobile's.pr-checks-presentation.ts:119— addedcase 'action_required': return 'Action required'tocheckStatusLabel, so the per-check row has a name for it.mobile-pr-chip-summary.ts:94— the branch chip readssummarizeProviderChecksdirectly, and distinguishes "no checks" from "checks that resolved to nothing actionable".github-pr-value-readers.ts:85—action_requiredaccepted.ELI5
Your PR has a list of automated checks, and Orca shows you a little summary badge. Desktop and mobile were reading that list with two different rulebooks, so they gave different answers about the same PR:
2/3on your phone and3/3on your laptop. Worse, mobile disagreed with itself: the tasks grid said2/2 passedwhile the branch card said "No checks", for one PR.This PR deletes mobile's private rulebook and points it at the shared one, so both devices describe the same PR the same way.
Screenshots
Not captured. These surfaces are React Native (
mobile/), not the Electron renderer, so the/electronCDP screenshot workflow does not reach them and the desktop dev build cannot render them. Rather than substitute a recreated or mocked image, the visible change is stated exactly and pinned by assertions on the rendered chip objects:{ kind: 'passed', text: '2/3' }{ kind: 'passed', text: '3/3' }action_required{ kind: 'passed', text: '1/2' }green{ kind: 'failing', … }red{ kind: 'none', text: 'No checks' }{ kind: 'none', text: 'Unresolved checks' }These are the literal
expected/actualvalues from the test run below, not a description of them.Proof of fix
With the three production files reverted to
origin/mainand the tests kept —npx vitest run --config mobile/vitest.config.ts:Every one of the three defects reproduces as a distinct assertion. With the fix restored: 3 files / 41 tests passed.
Proof of no regression
src/shared/provider-check-summary.ts, so the desktop consumers of that module were re-run).npx oxfmt --checkandnpx oxlintclean.max-linesdisable ormobile/.oxlintrc.jsonbump added;pr-checks-presentation.tsgets shorter (−34 net), since the local classifier is deleted rather than added to.Visible mobile behaviour changes beyond the reported bug — disclosed
Delegating to the shared classifier necessarily changes three more things, all of which are the shared rulebook's existing, deliberate answers:
nullconclusion now reads neutral (grey) instead of pending (amber). Mobile previously called it pending; it is finished, so it is not pending.skippedsorts to the bottom of the checks list with the other non-blocking outcomes, rather than among successes.Testing
pnpm lint— clean (oxlint, type-aware audit, reliability gates, max-lines ratchet, localization catalog/extraction/coverage);oxfmt --checkclean via lint-stagedpnpm typecheck(desktop) — clean (tsc: node + cli + web); coverssrc/shared/provider-check-summary.ts, the module this PR newly depends onmobile/tsc --noEmit— not run.mobile/node_modulesis empty in this worktree, so the mobile TypeScript program cannot resolveexpo,react-native, or its other types. Needs CI or apnpm installinmobile/to be meaningful; saying it passed would be a fabricationpnpm test— mobile targeted files, plus the full desktop suite for shared-module consumerspnpm build— not run; no build-graph, packaging, or dependency changeMobile test environment caveat, stated plainly:
mobile/node_modulesis empty in this worktree, somobile/vitest.config.tscannot resolveexpo/tsconfig.base.json. The three files above were run by temporarily stubbing that single file and removing the stub afterwards; the worktree was left exactly as found. A fullmobile/suite run in this worktree produces 82 file-level failures, allCannot find modulefor uninstalled packages, plus one genuine test failure inmobile/src/mock-server-key-pair.test.ts("makes concurrent creators converge on the persisted winner"). That failure was proven pre-existing and unrelated by stashingmobile/srcand re-running: it still fails. Neither is caused by this PR, and both should be confirmed against CI's installed environment.AI Review Report
Reviewed by Claude Opus 5 as part of a 45-agent release scan with adversarial refutation. Two independent verifiers initially split on the severity of the
action_requireddefect and an adjudicator settled it. Risks checked:PRCheckDetailshape, and GitLabmanualgates map toneutral. Delegating to the shared classifier means the mobile chip now agrees with desktop on blocked GitLab pipelines as well.mobile-backcompat-review. No persisted state, cached schema, settings key, or relay wire contract is touched; a rollback to a prior mobile build simply restores the old presentation of the same server data. No migration needed.checkOutcomeandsummarizePRCheckswere traced.mobile-pr-chip-summary.tswas the one that needed a corresponding change (it now callssummarizeProviderChecksdirectly rather than going throughsummarizePRChecks, since it only needs the counts); the checks-list rows and the sort order follow fromcheckOutcomeand were re-asserted.buildChipRollupfeeds a label and a colour token only; mobile merge gating lives inpr-auto-merge-availability.ts, which does not read it. That is why these are P2 and not P1 — the wrong badge misinforms, it does not enable a bad merge.Security Audit
eval, no path handling, no auth, no secrets.readCheckRunConclusionnow accepts one additional literal,'action_required'. It remains an exact-match allowlist against a closed set of string literals with anullfallback for everything else — the parser is not loosened structurally, and no untrusted value can now reach a wider code path than before. The value is only ever compared against sets and used to pick a label and a colour token.Notes
2/3arithmetic and the droppedaction_required. Both turned out to be instances of the same root cause — a duplicated classifier — so the fix removes the duplicate rather than patching the two symptoms, which also resolved the "No checks" mislabel that neither scan had flagged.Made with Orca 🐋