Skip to content

fix(mobile): keep tracker setup tied to the confirmed host - #52846

Merged
AmoabaKelvin merged 2 commits into
mainfrom
keep-mobile-jira-setup-tied-to-confirmed-host
Nov 30, 2026
Merged

AmoabaKelvin merged 2 commits into
mainfrom
keep-mobile-jira-setup-tied-to-confirmed-host

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

When you connect Jira or Linear from your phone, the token is saved on one specific computer. If your phone switched computers or the desktop changed which server saves tracker accounts while the setup form was open, the form could stay open with your typed token and silently send it to the new computer on a second tap. Now setup stays locked to the original computer. If the destination changes, the phone discards the stale draft, closes setup, and asks you to open it again to confirm the new computer.

Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​432 $\color{#cf222e}{\Huge{\mathbf{−}}}$​34 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​398
Prod 21 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​277 $\color{#cf222e}{\Huge{\mathbf{−}}}$​60 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​217

What Changed

  • Before:
    • trackerAccountWriteClient overwrote binding.current with the new destination after a mismatch refusal while keeping the setup sheet open with the user's draft and no visible new destination, so tapping Connect a second time sent the credentials to the new host.
    • TrackerAccountBinding did not record the paired desktop hostId, so switching between two paired desktops that both reported local (or both predated trackerAccountHost) matched as the same destination.
    • clientOnHost(...) ?? client fell back to an untagged desktop call when relay capability was missing for a runtime: tracker host.
    • useMobileTasksRuntimeHydration closed showLinearConnect on disconnect, host change, or unsupported host, but left showJiraConnect open, and MobileTasksJiraConnectDrawer kept its draft while hidden or when kept hydration kept taskUiReady true across a host switch.
    • mobileTasksListShowsError hid the Tasks error banner when Jira was disconnected.
  • After:
    • trackerAccountWriteClient binds both the paired desktop hostId and the desktop's trackerAccountHost, never silently rebinds on mismatch or unconfirmed open, aborts if the binding was cleared or replaced mid-read, and fails closed instead of falling back to an untagged client when relay capability is absent.
    • Transient read failures keep the originally confirmed binding so retrying still only succeeds if that same original host answers.
    • When a paired-host context changes (hostId, client, disconnect, hydration failure, or unsupported host), both Jira and Linear setup sheets close, their bindings clear, their drafts discard, and in-flight requests are fenced by binding/attempt identity.
    • When the destination changes mid-setup (or setup opened without a confirmed destination), the sheet closes, discards the stale draft, clears the binding, and shows tasks.trackerAccount.destinationChanged (added across all 11 mobile locales) above the connect prompt so the user must reopen setup to confirm the new destination.

Why

Silent rebinding inside trackerAccountWriteClient broke the promise of #52704: a user responding to "try again" with the same draft could send credentials to a different host without ever seeing or confirming the change. Keeping the binding immutable for the open setup session and discarding stale form state closes the gap across Jira connect, Linear connect, and Linear workspace switching in one owner.

Linked Issue

STA-19948. Follow-up to #52704.

Visual Proof

N/A. No new screens or layout changes. When a tracker destination changes mid-setup, the existing Jira or Linear sheet closes and the existing Tasks error banner displays the reopen-setup message.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

  • mobile/src/tasks/task-list/tracker-account-host.test.ts (9 tests): verifies paired-host mismatch refusal even when both desktops report local, repeated refusal without silent rebinding after tracker-host drift or unconfirmed open, explicit renewed binding after reopening, transient read failure keeping only the original host, fail-closed refusal without relay capability, in-flight binding clearing, older phone apps, and legacy desktops.

  • mobile/src/tasks/providers/jira/MobileTasksJiraConnectDrawer.test.tsx (3 tests): verifies immediate draft discard on paired-host switch even while taskUiReady stays true, closing and discarding stale form state with a reopen prompt when trackerAccountHost changes mid-setup, and ignoring late in-flight failures after a paired-host switch.

  • Ran pnpm --dir mobile typecheck, pnpm --dir mobile typecheck:tests, pnpm --dir mobile test src/tasks/task-list/tracker-account-host.test.ts src/tasks/providers/jira/MobileTasksJiraConnectDrawer.test.tsx, and pnpm check:changed (18/18 checks passed).

Performance

None, because the checks only run when opening or submitting tracker setup or changing paired-host context, with no new timers, polls, subscriptions, or extra RPC calls (mismatched paired hosts skip the verification settings.get read).

Risk

If a paired desktop changes its tracker host while the user is filling out Jira or Linear setup, the sheet now closes and clears the draft instead of allowing a second tap in the same sheet. That is the intended behavior so credentials never land on an unconfirmed computer. Older phone shells and legacy desktops keep their existing untagged path once paired host and destination are confirmed. A plain revert restores #52704's behavior.

Level: Low

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • No native store build is needed. Tasks is a host-served page.
  • Verified all 11 mobile locale catalogs contain tasks.trackerAccount.destinationChanged.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

After a paired-host or tracker-host change, trackerAccountWriteClient
silently rebound the open setup sheet to the new host on the first
refusal, and runtime hydration left the Jira setup drawer open with its
draft intact. Bindings now stay tied to the original paired host and
tracker destination, fail closed without silent rebinding or an untagged
relay fallback, and discard stale setup drafts when the host context or
destination changes.
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

Tracker account writes now validate the paired host and configured destination. Linear and Jira connection flows check for stale bindings and clients during asynchronous work. Setup state resets across hydration and drawer transitions, and the Jira drawer ignores stale results. The changes also update task-list error handling and add translations for changed destinations.

Merge Risk: Low · up to 477b7

The change keeps Jira and Linear setup tied to the destination the user confirmed, and the main safeguards look sound. One regression test for in-flight verification does not exercise the path it claims to cover, so a future change could remove the post-verification check without failing a test. Tightening that test is a small follow-up and does not block merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: tracker (Jira/Linear) setup on mobile is bound to the confirmed paired host, so a host change cannot silently redirect a credential draft. The changeset implements thi…
Description check Passed The description follows the repository template: ELI5, What Changed (before/after), Why, Linked Issue (STA-19948, follow-up to #52704), Visual Proof marked N/A with reason, Testing with named test fil…
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: Title check

Explanation

The title names the main change: tracker (Jira/Linear) setup on mobile is bound to the confirmed paired host, so a host change cannot silently redirect a credential draft. The changeset implements this across the binding, write client, and setup drawers. The title uses the conventional fix(mobile) prefix and is concise, so it is a clear match for the primary change.

Full details: Description check

Explanation

The description follows the repository template: ELI5, What Changed (before/after), Why, Linked Issue (STA-19948, follow-up to #52704), Visual Proof marked N/A with reason, Testing with named test files and commands, Performance with a reason, Risk with level and revert guidance, and the checklist. Some template sections are left blank or unfilled: the Linked Issue line still reads as a reference rather than a 'Fixes #' issue link, the Review and AI Disclosure sections are empty, and the Level is given but the template placeholder text was replaced. These gaps are minor, so the description is mostly complete.

  • 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

@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: 31e730fa-683b-45f0-83ce-958c95aaeb58
Commits

Reviewing files that changed from the base of the PR and between f11dc4e and 477b793.

Files selected for processing: 23

  • mobile/src/i18n/locales/de.json
  • mobile/src/i18n/locales/en.json
  • mobile/src/i18n/locales/es.json
  • mobile/src/i18n/locales/fr.json
  • mobile/src/i18n/locales/ja.json
  • mobile/src/i18n/locales/ko.json
  • mobile/src/i18n/locales/pt.json
  • mobile/src/i18n/locales/ru.json
  • mobile/src/i18n/locales/tr.json
  • mobile/src/i18n/locales/zh-Hant.json
  • mobile/src/i18n/locales/zh.json
  • mobile/src/tasks/providers/jira/MobileTasksJiraConnectDrawer.test.tsx
  • mobile/src/tasks/providers/jira/MobileTasksJiraConnectDrawer.tsx
  • mobile/src/tasks/screen-state/use-mobile-tasks-route-and-item-state.tsx
  • mobile/src/tasks/screen-state/use-mobile-tasks-runtime-hydration.tsx
  • mobile/src/tasks/screen/mobile-tasks-filter-selection.ts
  • mobile/src/tasks/task-list/mobile-tasks-list-state.tsx
  • mobile/src/tasks/task-list/mobile-tasks-list-surface.tsx
  • mobile/src/tasks/task-list/tracker-account-host.test.ts
  • mobile/src/tasks/task-list/tracker-account-host.ts
  • mobile/src/tasks/task-list/use-mobile-tasks-provider-load-actions.tsx
  • mobile/src/tasks/task-list/use-mobile-tasks-task-pagination-actions.tsx
  • mobile/src/tasks/workspace-creation/mobile-tasks-create-drawers.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

pairedHostId: 'desktop-a',
hostCapabilities: CAPS
})
binding.current = null

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 · Maintainability & Code Quality · Quick win

Clear the binding only after verification reaches the paused read.

trackerAccountWriteClient awaits currentBinding.destination before it reads the tracker destination. This test clears binding.current before that continuation runs. The guard at tracker-account-host.ts:114-116 then throws changed, so readTrackerAccountDestination never starts and the paused settings.get is never reached. The test passes, but it would also pass if the post-verification guard at tracker-account-host.ts:121-123 were removed.

Wait until the paused settings.get has started. Then clear the binding and release the read. Have the fixture signal when settings.get pauses. This makes the test fail when the post-verification identity check is removed.

@AmoabaKelvin
AmoabaKelvin merged commit e529974 into main Nov 30, 2026
27 checks passed
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