Skip to content

fix(swift-ios): keep selected threads live across navigation - #11858

Open
mackinleysmith wants to merge 1 commit into
pingdotgg:t3code/rebuild-mobile-app-swiftfrom
mackinleysmith:t3code/swift-thread-subscription-ownership
Open

mackinleysmith wants to merge 1 commit into
pingdotgg:t3code/rebuild-mobile-app-swiftfrom
mackinleysmith:t3code/swift-thread-subscription-ownership

Conversation

@mackinleysmith

Copy link
Copy Markdown
Contributor

What Changed

Switching between cached threads could leave old history on screen without a live subscription or a reconnect indicator. Split-view navigation could cancel the detail view's load and invoke its cleanup while the newly selected thread was still opening.

The workspace selection now owns a model-managed load and subscription. Switching or clearing selection cancels the previous load and releases its subscription; collapsing to the sidebar retains the selected thread. Retries use the same owner, cancelled results cannot replace newer history, and the view reads loading state from the model.

Why

This covers the cached-thread switching failure reproduced while reviewing #11491, including reopening during delayed credential renewal. It targets the current Swift app branch and does not depend on that PR. The existing cache/resume and foreground reconnect paths remain in use, with at most one selected thread subscription retained while the sidebar is visible.

The scope is the native Swift iOS client, across Back, swipe-back, thread selection, and retry. Provider adapters, wire contracts, and other clients do not change. This does not establish why an app might spontaneously return to the thread list after backgrounding.

Verification

  • 124 tests passed in FeatureRootModelTests and NativeThreadCatchUpTests on iPhone 17e / iOS 26.5, with parallel simulator testing disabled.
  • Added controlled asynchronous tests for A → B → A, both completion orders, late cancelled results, repeated selection, and cancelling a refresh when selection closes. Updated the draft-restoration fixture to select through the model.
  • Simulator: A → B → cached A receives the completed server response and a subsequent live response; Back and edge-swipe reopening remain live.
  • Simulator: suspend for 94 seconds, sever the socket, expire the managed credential, delay renewal by 20 seconds, then reopen another cached thread. Missing history catches up and subsequent live messages arrive.
  • Relay testing used a disposable local HTTPS/WSS stand-in and the native managed authorization path. It did not exercise production T3 Connect, Clerk, or production DPoP validation. Test injection and logging stayed outside this PR.
  • git diff --check passed.

UI Changes

Before/after screenshots and a short simulator recording were captured. Upload is pending because no browser session was available for GitHub attachments.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Model: GPT-6. Harness: Codex in T3 Code.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 15, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 110595b

Macroscope's review found this PR approvable — This is a focused Swift iOS bug fix that relocates selected-thread loading and subscription ownership to the workspace model, preventing navigation-driven cancellation and stale results. The runtime change is localized and supported by targeted concurrency tests, with no schema, product-default, infrastructure, or static-analysis configuration changes.

You can add or adjust custom eligibility rules. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant