Repository navigation
fix(mobile): refuse phone tracker setup unless its destination host is confirmed - #52704
Conversation
[Medium impact] The PR appears safe to merge; no new blocking issue was found. SummaryPhone setup now checks the account destination again before sending Linear or Jira account writes.
|
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
…sn't confirmed Phone Linear and Jira setup bound the account host to a client instance and fell back to an unscoped client when the desktop's settings couldn't be read or the client changed during setup, so a token or workspace choice could follow whatever the desktop's default was at submit time. Setup now binds the destination host id as it opens, re-reads it right before the write, and sends the write to that host through the current connection. When the destination can't be read, changed, or can't be reached, the write is refused and the sheet asks the user to reconnect and try again.
…hone apps working
…eep it across a failed read Reading host capabilities inside loadLinearContext reloaded the Linear context whenever a status reply landed with an equal capability list. The binding now carries the capabilities it was taken with, and a refusal caused by an unreadable destination keeps the bound host so the next attempt succeeds.
…d issue reads The setup binding now survives a reconnect, so reading Linear status through it could ask a different host than the team and issue reads after the desktop's default changed. Status reads go untagged with the rest; account writes still only go out after the bound host is confirmed as the current tracker host.
0b3b2a0 to
a78a1d8
Compare
ELI5
Connecting Linear or Jira from the phone saves your token on one specific computer. Before, if the phone couldn't confirm which computer that was, or the choice changed while you were filling in the form, the token could end up on another computer you own. Now the phone checks the destination right before sending. If it can't confirm it, or the destination changed, it stops and asks you to reconnect and try again.
What Changed
Before: Linear and Jira setup on the phone bound the account host to a client instance when setup opened. Two things made it fail open, falling back to an untagged write that the desktop pins to its current default tracker host:
So a token (
jira.connect,linear.connect) or a workspace choice (linear.selectWorkspace) could follow whatever the desktop's default was at submit time, not the host the user set up against.After:
tracker-account-host.ts, the one place both trackers use, binds a destination as setup opens. The destination is a host id, or "a desktop older than per-host tracker accounts, which stores the account itself", or "unconfirmed". Every account write then:On refusal: the user sees "Couldn't confirm which computer saves this account. Reconnect, then try again." (in all 11 phone languages). The sheet stays open. A confirmed new destination becomes the one the next attempt checks, so retrying in the same sheet works. A failed read keeps the original binding.
Older phone apps that can't tag a host send untagged after the re-read confirms the destination. The desktop pins untagged account setup to that same host.
Linear workspace switch: reloads the Linear context after a failure, so the picker shows the workspace the desktop kept.
Linear status read: stays untagged, like the team and issue reads, so all Linear reads ask the same host. Writes only go out once the bound host is confirmed as that same tracker host.
Capabilities: the host capabilities used to scope the write are captured with the binding. That keeps the Linear context load off a capability-identity dependency, which would otherwise reload it on every status reply.
Why
The destination check belongs where both trackers decide where an account goes, not in each sheet. Tagging the write with a verified host id closes the gap between the check and the write for every current phone app, because the desktop won't move a tagged call. The only untagged cases left are legacy desktops (no per-host tracker accounts, so nowhere else to go) and phone apps too old to tag. Both are re-checked within one round trip of the write.
Linked Issue
STA-19691. Follow-up to #51202 (phone Jira setup), whose setup binding this hardens for both Linear and Jira.
Visual Proof
N/A. No new screens. The only visible change is the error line in the existing Connect Linear and Connect Jira sheets and the Linear workspace switch, shown only when the destination can't be confirmed.
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.tsdrives the real owner through a fake desktop that records each call'sexecutionHost. It covers:With the old fail-open fallback restored, 3 of the refusal cases fail.
pnpm check:changed, the mobile typecheck and the mobile tests typecheck pass.Performance
One extra
settings.getper user-tapped account write: Linear connect, Jira connect, workspace switch. The one read when setup opens already existed. No timers, polls or subscriptions. The Linear context load keeps main's dependencies (client,connState,tasksSupported), so status replies with an equal capability list still trigger no reload. When nothing is being set up, there's no added work.Risk
The riskiest part is refusing a write that would have worked: for example, a desktop whose settings read fails transiently as the user taps Connect. The user sees the reconnect message and the next tap goes through, and the guard never sends a write without a confirmed destination. A plain revert restores the old fail-open behaviour.
Level: Low
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
trackerAccountHost(older than per-host tracker accounts) stores the account itself, as before. Current desktops always report it.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)