Skip to content

fix(mobile): name the source-control Back controls and split the dock's Close from Back (OTA phase C, C4.3) - #21739

Merged
Jinwoo-H merged 5 commits into
mainfrom
ota-c4-3-back-a11y
Sep 20, 2026
Merged

Jinwoo-H merged 5 commits into
mainfrom
ota-c4-3-back-a11y

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase C, C4.3: the Back controls the source-control and review routes will bring under the page-served Back rule (page-served-back-control-a11y.test.ts, C2.8) are fixed before the routes register (draft-ota-c4-3.md; design-ota-c4.md §7). Two commits on cef4416115, inert: no route registered, no PAGE_SERVED_SCREENS row.

Measured with a port of the census's reader over the two trees the rows will walk: MobileSourceControlHeader.tsx:29 failed both rules (no role; a label that is Close source control in the dock and Back to session on the route), CustomKeyModal.tsx:191 failed the role rule, MobileDiffReviewHeader.tsx already passed.

commit what
9623d347b5 the custom-key drawer's Back gets a button role; the census gains a case that holds the two arriving trees to the same two rules now, and says in its docstring that the C4.4 rows replace it
9fa1f41713 round 2: the arriving-trees presence case asserts per arriving screen module through backControlsIn, mirroring the registered block (per tree, src/components' two Backs let CustomKeyModal answer for the review header; renaming the review header's Back prop to onDismiss with label Return to session names MobileDiffReviewHeader.tsx now, and round 1's source-control rename still names its file)
cc5d917fcb round 1: the arriving-trees presence case asserts per tree (renaming the route branch's prop to onDismiss with label Return to session names src/source-control; the union count passed it); the refresh control gets a button role
1de8b3301b the header's one Pressable, which served both modes through onPress={onBack}, splits by mode: the embedded branch presses onClose and is named Close source control; the route branch presses onBack and is named Back to session, with a button role. The panel keeps the dock's behaviour exactly: its dismiss is still onRequestClose falling back to a pop, passed as onClose instead of chosen by mode

Why a split and not a label

The rule reads onPress={onBack} as a Back and then demands a Back-shaped name, so the cheap fix names the dock's dismiss "Back", which games the rule instead of satisfying it. After the split the census sees one Back control, not two: onClose is a destructured prop that matches neither the handler pattern nor a declaration in the file, so the Close is invisible to the rule by construction (the real predicate over src/source-control finds exactly one control, MobileSourceControlHeader.tsx at Back to session, both rules empty). That invisibility is the C2.8 residual gap and it is two-sided: a Back wired through a destructured prop named otherwise (onDismiss, Return to session) is equally invisible, which is why the component test below pins this file's wiring.

Nothing else pins this render-tree change: no scenario names these components in its sites, and no source-family or render-parity census covers src/source-control. So MobileSourceControlHeader.test.ts pins the split directly, red first against today's single control. The mutation that matters: renaming the Close to Back to close source control, exactly the gaming the split prevents, reds the component test and leaves the census green, because the census reads role and wording and a close named "Back" satisfies it completely. That is the argument for having both. The Close pressing onBack reds the component test and the census's label rule (a Close source control label on a Back-handler control).

Not in this PR

  • The two PAGE_SERVED_SCREENS rows: the census asserts the table equals the registered pathnames exactly, so a row added before its route reds the coverage case. C4.4 adds both rows with the routes; the review row puts all of src/components under the rule (accepted; moving the diff-review components to their own directory is a plan item).
  • MobileSourceControlHeader now requires onClose; its one consumer, the panel, supplies both handlers itself (onBack = () => router.back(), onClose = onRequestClose ?? (() => router.back())), and a route switch renders embedded={false}, so the C4.4 route file needs nothing here.

Verified

  • Lane gates on 1de8b3301b: mobile tsc, ratchet, whole-tree oxlint, oxfmt, root oxlint on the changed trees, full mobile suite (723 files, 8208 passed, no Errors line), config/scripts (220 files, 1999 passed), changed-code quality and react-doctor against cef4416115, merge-tree clean, machine-path grep clean.
  • Round 1 (on 1de8b3301b): approve; two body claims corrected above (only the rename mutation leaves the census green; no post-split fixture exists); folds: the arriving-trees presence case per tree, the refresh control's role.
  • Merge of main b766f512ec (de6e83e289, no conflicts) for the DiffViewer.tsx max-lines fix.
  • CodeRabbit on 9fa1f41713 asked the census to accept a Return to session label on the review header; that label exists only as round 2's mutation, the header's control is labelled Back (MobileDiffReviewHeader.tsx:52), so nothing changes.
  • Round 2 (on de6e83e289): approve; its one fold is 9fa1f41713; DOM through react-native-web: one dismiss control per mode with the expected names, only the role and the embedded handler moved against the base.
  • Lead reproduction: verify-gates.sh on 1de8b3301b against cef4416115, on de6e83e289 and 9fa1f41713 against b766f512ec; the review-header rename reds the per-module case on 9fa1f41713; the Close renamed Back to close source control reds the component test and leaves the Back census green.

Part of the mobile OTA plan (Phase C). Reference PR #13386, never merged.

…tree (OTA phase C, C4.3)

`CustomKeyModal`'s Back is a bare `Pressable` with a label and no role, so
a screen reader has nothing to announce it as. It is reachable today from
the session sheets and the terminal shortcut settings, so this is a gap
now, not only inside the page.

It surfaces here because `screenTree` takes a screen's directory: C4.4
registering the review route puts the whole of `src/components` under the
Back rule. Fixing it in the PR that registers would make a route entry
carry unrelated accessibility work, so the census gains a case that holds
the arriving trees to the same two rules before the rows land. Red first
it printed exactly what the rule would:

  src/components/CustomKeyModal.tsx:191 role=none label=Back

Once `PAGE_SERVED_SCREENS` has the two rows, `CONTROLS` covers these trees
and the new case becomes a second reading of the same thing; it says so.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…TA phase C, C4.3)

One `Pressable` served both modes — `onPress={onBack}` with a conditional
label, `X` docked and `ChevronLeft` full-screen. The Back census reads a
control by what its handler does, so it sees that one as a Back and then
requires a label starting with "Back", in a mode where the control
dismisses the dock beside the terminal. The cheap way to go green is to
call a close "Back", which satisfies the rule by making the wording wrong.

So the modes become two controls. Embedded presses `onClose` and is named
"Close source control"; otherwise it presses `onBack` and is named "Back
to session". Both carry the button role. The panel stops choosing by mode
and passes both handlers; the dock keeps exactly the behaviour it had, its
dismiss still `onRequestClose` falling back to a pop.

Probed before it was written: run through the census's own predicate, the
post-split shape yields one back control rather than two — `onClose`
matches neither the handler pattern nor a declaration this file holds,
being a destructured prop — so the Close is invisible to the rule and the
presence precondition still holds on the Back.

The component test is what the census cannot do. Nothing else pins this:
no golden names this component and no parity census covers
`src/source-control`. Red first against the single control, both cases
failed on the missing role. And renaming the Close to "Back to close
source control" — the gaming this split exists to prevent — reds the
component test while leaving the census green, which is the whole argument
for having both.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@coderabbitai

coderabbitai Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

MobileSourceControlHeader now accepts onClose and renders separate controls for embedded and non-embedded modes. MobileSourceControlPanel separates close handling from back navigation. New tests verify labels, roles, and callbacks. Accessibility checks now validate each arriving screen, and CustomKeyModal explicitly marks its Back control as a button.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 9fa1f

The new accessibility test rejects an approved review-header label and should be corrected before merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the implementation, rationale, scope, and verification in detail, but it does not follow the required template. It omits the required Linked Issue, Visual Proof or N/A stateme… Reformat the description using the repository template. Add a linked issue under “Linked Issue,” provide before-and-after visual proof or state N/A with a reason, include the required testing checklist and platform details, complete the che…
✅ Passed checks (3 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly identifies the mobile source-control accessibility fix and the separation of Close and Back behavior.
Full details: Description check

Explanation

The description explains the implementation, rationale, scope, and verification in detail, but it does not follow the required template. It omits the required Linked Issue, Visual Proof or N/A statement, checklist sections, and several required headings.

Resolution

Reformat the description using the repository template. Add a linked issue under “Linked Issue,” provide before-and-after visual proof or state N/A with a reason, include the required testing checklist and platform details, complete the checklist and Notes sections, and provide the required AI Disclosure and Review information where applicable.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

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

✅ No new issues found.

Reviewed changes

  • Split the header control — MobileSourceControlHeader.tsx renders two Pressables now: the embedded dock closes (onPress={onClose}, label Close source control) and the route goes back (onPress={onBack}, label Back to session), each with accessibilityRole="button".
  • Two panel handlers — MobileSourceControlPanel.tsx replaces the mode-selected onBack with onBack = () => router.back() and onClose = onRequestClose ?? (() => router.back()), preserving embedded and route behavior exactly.
  • Custom-key Back role — CustomKeyModal.tsx's existing Back control gains accessibilityRole="button".
  • New component test — MobileSourceControlHeader.test.ts pins the split: each mode renders one control, named and wired to its own handler.
  • Census pre-flight — the a11y census adds a describe holding src/components and src/source-control to the role and Back-label rules before C4.4 registers the routes.

ℹ️ The description's second mutation claim is inaccurate

The description says the Close pressing onBack "reds only the component test." It also reds the census: with onPress={onBack} the embedded control is detected behaviourally, and its Close source control label then fails the Back-prefix rule. This does not change the code, which is correct and well covered — the other mutation (renaming the Close to a Back-prefixed label) is the one that leaves the census green and only reds the component test, and that is the real justification for the split.

Technical details
# Description mutation claim vs. actual census behaviour

## Reproduction
- Change the embedded branch of `mobile/src/source-control/MobileSourceControlHeader.tsx` to `onPress={onBack}` and run the two changed suites.
- Result: `MobileSourceControlHeader.test.ts` fails (`calls` is `['back']`, expected `['close']`) **and** `page-served-back-control-a11y.test.ts` fails in `names every one of them in the app's own wording for Back` with `src/source-control/MobileSourceControlHeader.tsx:36 role=button label=Close source control`.

## Required outcome
- None in code. Optionally correct the PR description so the stated coverage argument matches the tests.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Jinwoo-H and others added 2 commits September 19, 2026 20:07
…ntrol (OTA phase C, C4.3 round 1)

The arriving-trees presence case counted controls over the union of both
trees, so one tree answered for the other. Per tree now, in the shape the
block above it already uses per screen module.

Red first, with the mutation round 1 named: rename the route branch's
handler to `onDismiss` and its label to `Return to session`, and the only
Back in `src/source-control` disappears. The per-tree case names that
tree. The same mutation against the union count passes all six cases,
which is what the change is for.

The refresh control had a label and no role, so react-native-web renders
a `div` carrying `aria-label` and a screen reader announces no control.
Its two siblings in this header already carry one.

Two claims in my round-1 report were wrong and I am the reason the body
carried them. The Close pressing `onBack` reds the census's label rule as
well as the component test, not the component test alone; and no fixture
of the post-split shape exists — the shape is read from the real file.
Both were stated from reasoning rather than from a run.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

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

✅ No new issues found.

Reviewed changes

Reviewed the delta since the prior pullfrog review at 1de8b33: the round-1 folds plus a clean merge of main.

  • Presence assertion is now per tree — page-served-back-control-a11y.test.ts asserts ARRIVING_TREES.filter((tree) => backControlsUnder(tree).length === 0).toEqual([]) instead of a union count, so src/components can no longer answer for src/source-control and let its only Back disappear behind a rename.
  • Refresh control gets a button role — MobileSourceControlHeader.tsx's refresh Pressable gains accessibilityRole="button"; it is not a census-detected Back control, so the role is additive and changes nothing the census reads.
  • Main merged — b766f512ec (the DiffViewer.tsx max-lines fix), conflict-free, no changes to the PR's own files.

The prior review's single observation (the description's second mutation claim was inaccurate) was corrected in the PR body in round 1. No new code issues in this delta.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…hase C, C4.3 round 2)

Round 1 moved the arriving-trees presence assertion from the union to
each tree, which was not far enough. `src/components` holds two Backs, so
the tree answers for both: renaming `MobileDiffReviewHeader`'s handler to
`onDismiss` and its label to `Return to session` leaves every case in the
file green, with `CustomKeyModal.tsx:191` standing in for the screen that
just lost its Back. Reproduced before the change — six passed with the
review header's Back gone.

Per screen module now, which is what the table above already does and for
the same reason its docstring gives: a directory with more than one
control cannot say which one a rule was written about. The two modules
are named and the trees derive from them, so the pair C4.4 adds to
`PAGE_SERVED_SCREENS` is the same pair spelled once here.

Both mutations red on the new case and name the file: the review header's
rename names `src/components/MobileDiffReviewHeader.tsx`, and round 1's
source-control rename still names its own, so this does not trade one
cover for another.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@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: Advanced

Run ID: 32339b6c-12fc-426d-a801-cd5e1990e101

📥 Commits

Reviewing files that changed from the base of the PR and between de6e83e and 9fa1f41.

📒 Files selected for processing (1)
  • mobile/src/mobile-web-shell/page-served-back-control-a11y.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.

*/
const ARRIVING_SCREENS = [
'src/source-control/MobileSourceControlHeader.tsx',
'src/components/MobileDiffReviewHeader.tsx'

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Accept the review header’s approved label.

ARRIVING_SCREENS now includes MobileDiffReviewHeader.tsx, but the census still requires labels matching ^Back\b. The review route control is labeled Return to session, so this test will reject the valid control. Use one shared label predicate that accepts both Back to session and Return to session.

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

✅ No new issues found.

Reviewed changes

Reviewed the delta since the prior pullfrog review at de6e83e: the round-2 commit only (ARRIVING_SCREENS), a test-only change.

  • Presence assertion is now per arriving screen — the census replaces tree-level ARRIVING_TREES = ['src/components', 'src/source-control'] with ARRIVING_SCREENS, naming src/source-control/MobileSourceControlHeader.tsx and src/components/MobileDiffReviewHeader.tsx, and derives the trees from them. The presence case now checks backControlsIn(screen) per screen, so CustomKeyModal in src/components can no longer stand in for the review header's Back.
  • Docstring records the rationale — the block documents that a tree can hold more than one Back and that the named modules are the ones that render each route's Back, mirroring PAGE_SERVED_SCREENS.

Verified locally: both changed suites pass (8 tests), and the author's mutation (renaming the review header's Back to Return to session/onDismiss) fails the per-screen presence case naming src/components/MobileDiffReviewHeader.tsx, confirming the assertion is non-vacuous. The prior review's only observation was body-only with no inline threads, so there was nothing to retire.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit 65cde9b into main Sep 20, 2026
24 checks passed
@Jinwoo-H
Jinwoo-H deleted the ota-c4-3-back-a11y branch September 20, 2026 00:51
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.

2 participants