Repository navigation
Finish the region split for Home and Session Chat on both platforms - #1017
Merged
Merged
Conversation
The composer dictation card (phases, model download, partial transcript, level, the delayed Insert and cancellation) moves out of the facade into a new region. The facade keeps one-line forwarders, the dictationFinishDelayMs test seam, and the transcript splice, which the region calls back. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Offers The one-time Chip timeline intro (OPE-270) and Timeline Style picker (#805) move out of the facade: their visibility, picker options, shared notice slot, settle and load timers, and preference writes. The facade calls the region from the same places in the combine collector, keeps the analytics (logged when the region reports the offer was up), and keeps its companion constants as aliases. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eader The header's project identity (seed from Home's cached inventories, server refine, and the worktree.updated re-refine for the checkout's projects) moves out of the facade. bind still seeds synchronously before writing the initial UI state; the facade's single live-event collector delegates worktree.updated to the region. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The working footer (chrome, hold, wake-up and the workingLamp log), the pending-prompts strip (gate, wake-up, steer/queue/cancel requests) and the background work rows (finish times, seen Done rows) move out of the facade. mergeUiState calls turnStatus.resolve where the footer was resolved, and the region resolves footer, strip and rows in the same order with the same clock reads. Analytics and the capability check stay in the facade. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d rows The Move to worktree region now owns the New worktree form, the composed SessionChatWorktreeMoveUiState (availability, rows, form), opening the form from the current checkout, the row lookup for a move, and the branch Home knows for a moved-to checkout. It exposes the same five flows the facade combined as `changes`, which the facade still collects at the same position in init. The form keeps its own default dispatcher until the facade's ioDispatcher seam is set. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
SessionChatNewSessionDraft now owns the #1004 draft before its first send: claiming and adopting the profile's draft, mirroring the composer into the store (paused while binding), the Run session in card and its sheets, base branches, Add project, discard / leave / release, and the create step (worktree, session, model seed). The facade keeps binding the regions, promotion, and the send orchestration, and makes every call at the point the code ran before, so nothing reads the new draft earlier than it did. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…meline How the built rows are presented moves from the facade into the timeline region: the live step rail mark (with its identity cache), step entry debounce and activity card footer holds with their wake-up, activity card sheet and child-session observation, unfolded step rails, expanded chip paragraphs, the image viewer, and server image previews. The facade calls presentMessages, syncStepTiming, the footer and debounce reads, the image viewer reconcile and syncActivityChildren at the same points of mergeUiState and publishUiState. Presentation changes stay partial writes of the published UI state through a host interface and are kept out of the region's state flow, so emission order and count do not change. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The constructor parameters that now only feed regions (connection profile store, worktree and project repositories, Home projects snapshot, worktree inventory cache, server file previews, new session draft store, Home worktrees feed) become plain parameters, and the imports the moved code needed go. The constructor signature, and so the Hilt binding, does not change. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Both existing Home regions now report every state write through an optional synchronous onChange callback, in the same call as the write. Nothing uses it yet; their state flows stay. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Add project sheet session (opening, field typing and debounced listing, folder navigation, row summaries, retry) and the validate and save half of addProject move to region/HomeAddProject.kt. The facade keeps analytics, the guards in front of them, and everything after a path is added (dismiss, reload, draft, scope request, snackbar), in the same order. Sheet changes still patch Empty/Loaded event-style. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title / server switcher chrome, the pending switch id, the switch paint generation, the profile switch call and abandoning a switch that did not land move to region/HomeServers.kt. The facade keeps the profile lifecycle subscriptions and, through onSwitchStarted and onSwitchAbandoned, stopping observations, painting the switched server and reloading, in the same order. serversChrome re-exports the region flow for now. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Per added path project resolution (cache seeding and live), worktree inventories, branch lookups, the v1 live lists of non-added worktrees, and publishing Home's projects to Session Chat and the Worktrees screen move to region/HomeWorktrees.kt. The facade launches the publish collectors at the same init positions and patches index changes into Loaded synchronously, as before. HomeDirectoryRows becomes internal so the region can read it. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
First part of the HomeProjectList region. The region now owns Home's content (the facade's uiState is written only through its synchronous onChange) together with live observation of the added paths, building Home rows, first loads of new projects, parked first server snapshots, and paging. stopLiveObservations still cancels load-more, resets paging and stops the worktree extras and reload in one place. The facade keeps the load, probe and cache paint for the next step and re-exports every public flow. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
runHomeLoad becomes HomeProjectList.load, with the cache-first paint, the probe (which still asks the archived menu to recheck), loading the sections, and the probe-failure wait on the address check. Painting a switched-to server from cache moves too; it reads the switch generation through an isCurrent lambda, so both checks see live values. The call order of cache paint, probe, live observations and worktree reload is unchanged, and so is behaviour. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Last part of the HomeProjectList region: opening the New session draft (pending open and the reveal-newest token), the pending scope request, Home hidden/revealed, project reorder and its save, project removal and its confirm, the Add project sheet patch into Empty/Loaded, and the project session create error. Analytics and the snackbar stay in the facade, in the same order around each action; the facade re-exports every public flow. Unused facade imports go. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
uiState becomes StateFlow<HomeUiState>: the content mode (MainScreenUiState) plus servers chrome, live connection status, refreshing, snackbar, session actions, archived menu entry, paging, reveal-newest token and pending scope request. Every region reports into it through a synchronous onChange in the same call as its write; the live connection status is mapped by an always-on collector seeded from the current chrome. The ten extra public flows are removed and the MainScreen wrapper reads one state. MainScreenViewModelTest is rewritten mechanically to read the same values from uiState (content collectors map and dedupe the content); no expected value changes. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Constructor collaborators the facade only hands to regions become plain constructor parameters (the constructor signature and Hilt bindings do not change). Dead logging helpers and the content setter go; content writes go through HomeProjectList only. Region helpers used only inside HomeProjectList become private. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…st host Review follow-ups. Home reads the paging set through derived state so the session list recomposes only when that set changes, as it did before Home had one UI state. A timeline built without a facade gets its own stand-in host instead of sharing one. Behaviour is unchanged. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Pure file move of AddProjectFolderItem, AddProjectBarTarget, AddProjectRoot, AddProjectSuggestion, AddProjectSheetState and AddProjectSheetInputs out of the Home view model file. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…+ onChange Both regions now follow the Session Chat region shape: a plain MainActor class with one Equatable `state` and an `onChange` callback instead of Observable properties. The Home view model mirrors each state into an observable property, and gains refreshArchivedMenu(scopeID:worktreesEnabled:) so the view no longer reaches into the region. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Add project sheet session (open, field typing with debounced listing, folder navigation, row summaries, browser, retry, validating and saving the chosen path) moves into HomeAddProject. The Home view model keeps analytics, the reload after an add, the scope request, the snackbar, and writing the sheet into its content when the region publishes one. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title / server switcher chrome, the pending switch id, its paint generation and the serialized switch task move into HomeServers. The Home view model handles the region's switch-started and switch-abandoned callbacks (stop live updates, paint the cached server, reload). Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Project resolutions, worktree inventories and directories, v1 extra directories, branches, server project info, the worktree marks and branch lookup helpers, and their tasks move into HomeWorktrees. Every mutation reports through onChange, which the Home view model mirrors so its projects stay current; the section patch for a worktree mark stays in the view model through onSectionMark. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Probing, cache-first paint, sections, live observation of each added path, first project loads, paging, reorder, remove, the pending session open, scope request and reveal token, and painting a switched server move into HomeProjectList. The region stops HomeWorktrees' observations with its own, so no caller can stop only half. The Home view model keeps analytics, the snackbar, connection lifecycle routing and read-throughs for the view. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every region reports through onChange to publishUiState(), which rebuilds HomeUiState synchronously and assigns it only when it changed. uiState is the view model's only observable stored property; the mirrors and read-throughs are gone, and ProjectListHomeView reads viewModel.uiState. The live connection status keeps its equality guard. The view model tests read uiState instead of the old properties; no expected value changed. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The static projects and removable-directories helpers only served the intermediate mirrors; the instance methods carry the logic again. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The composer dictation card, its insert generation, the finish task and the finish delay move out of the Screen Model into a new region. The facade keeps its dictation forwarders and the dictationFinishDelayNs test seam, splices Insert's transcript through updateComposerText, and keeps the level fast path that updates only uiState.dictation. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The one-time Chip timeline intro (OPE-270) and Timeline Style picker (#805), their notices, tasks and preference writes move into a new region. Publish calls its silent updateTurnActive and observeTimelineLoad; the facade keeps the analytics, logged when the region reports an offer was hidden, and aliases for the constants tests read. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eader The header's project identity, its cached seed, the server refresh with its inventory loads, the checkout project ids and the worktree.updated observation move into a new region. The facade keeps a sessionEventTask for live revert updates, which shared that task before. MainActor.run hops became plain assignments inside the MainActor region; the cancellation checks stay where they were. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…TurnStatus The working footer (chrome, hold and its wake, the workingLamp log), the pending-prompts gate and wake, the steer / queue / cancel calls, and the background work rows (finish times, live-since, Done-tab seen ids) move into SessionChatTurnStatus. Publish calls its silent resolve(_:) at the same point; wakes republish through onWake. The facade keeps the capability guard and analytics before each pending prompt call, and the pure pendingPrompts(loaded:optimistic:) helper. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move to worktree (#785) leaves the Screen Model: the sheet flag, the New worktree form, the move call with its notice and error, and the session.moved observation with movedDirectory. The facade keeps the capability and created-session guards, the screen-view analytics, and exposes the form as worktreeCreate for the view. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The draft (#1004), its store and profile key, the Run-session-in context, base branches, the protocol probe, and the create step of the first send (worktree, session, model seeding) move into SessionChatNewSessionDraft. The facade keeps binding regions to the draft's checkout, the send orchestration around the composer, promotion and the prompt send, in the same order as before. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The chip-timeline paragraphs expanded past +N more move from the Screen Model into the Timeline region's state, next to the other presentation state it already owns. Expanding still republishes without a step timing pass, and promoting a draft clears them silently at the same point as before. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Groups the six region properties added by the split next to the existing ones in the Screen Model. No code change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-up. The load-more footer and trigger read which directories have live lists and older sessions. Those were observable on the view model before the split and private to HomeProjectList after it, so a change to them alone no longer redrew Home. HomeProjectList now mirrors them into HomeSessionPagingState on Home's UI state. Co-Authored-By: Claude Fable 5.2 <[email protected]>
ivanfenenko
marked this pull request as ready for review
November 10, 2026 19:24
Collaborator
Author
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e5f677a. Configure here.
…tick A server switch paints the target server's cached projects before the switch lands. When the switch did not stick, Home reloaded without clearing them, and the reload keeps any project it already has for a path, so the active server could show the other server's project ids and names until the server resolved the path again. Android already clears them. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Finishes the region split that
docs/architecture.mddescribes for Home and Session Chat, on both platforms. The four Screen Models become facades: regions own behaviour and state, the facade composes one UI state, forwards actions, and logs analytics. This is a refactor; nothing a user sees is meant to change.What changed
Home has one UI state.
MainScreenViewModelexposeduiStateplus ten more public flows, andProjectListHomeViewModelmany separate observable properties. Both now expose a singleHomeUiState; the former content state is itscontentfield, with servers chrome, snackbar, live status, refreshing, session actions, paging and requests beside it.Home has regions (same names on both platforms, under
ui/main/regionandUI/Main/Region):HomeProjectList: probe, cache-first paint, sections, live rows, first loads, paging, reorder, remove, opening a New session draftHomeWorktrees: project grouping inputs, worktree marks and extra observationsHomeServers: the server switcher and its paint generationHomeAddProject: the Add project sheetHomeSessionActionsandHomeArchivedMenualready existed; on iOS they move from@Observableto thestate+onChangeshape Session Chat regions useSession Chat's facade hands more to regions:
SessionChatDictation,SessionChatTimelineOffers,SessionChatProjectHeader,SessionChatTurnStatus,SessionChatNewSessionDraftSessionChatWorktreeMovegrows on Android and is new on iOSSessionChatTimelinetakes the timeline presentation state on Android and the expanded paragraphs on iOSSessionChatViewModel.ktSessionChatViewModel.swiftMainScreenViewModel.ktProjectListHomeViewModel.swiftWhat stays in the facades is constructor wiring, state composition, analytics, and the forwarders the views call. Views still talk only to the facade.
How to read it
35 commits, one per step, each compiling on its own:
Session Chat (Android): …×8Home (Android): …×9Region split (Android): …review follow-upsHome (iOS): …×8Session Chat (iOS): …×8Home (iOS): publish the paging inputs …review follow-upThe moves are easiest to check with the old file beside the new region. No public facade API that a view calls was renamed, apart from Home's state reads.
Deliberately not done
HomeProjectsSnapshot,WorktreeInventoryCache,HomeWorktreesFeed,NewSessionDraftStoreand similar; they pass them to the region that does. Removing them from the signatures would need injected region factories, a new layer with no behaviour gain. No DI module changed.ActiveConnectionManagerstays in the facades: there is no capabilities interface to put it behind.Checks
On the final head:
./gradlew :app:testDebugUnitTest— 3,508 tests, 0 failures, 1 skipped (a benchmark marked@Ignore).:app:assembleDebugand:app:compileDebugAndroidTestKotlinsucceed.:screenshot:compileDebugKotlinsucceeds on JDK 21.mainhas the same gap; Android already cleared them. The last commit resets them and adds a test that fails without the reset.Tests changed in two files only, both mechanically, for the single Home state:
MainScreenViewModelTest.ktandProjectListHomeViewModelTests.swiftreaduiState.content,uiState.sessionActionsand so on where they read separate properties before. No assertion or expected value changed, and no test was removed. Session Chat tests are unchanged on both platforms.Risks / Follow-ups
worktree.updatedare handled by two tasks where one loop handled both; they change separate state. In a few places an analytics call now follows the region call in the same synchronous turn where it preceded it.MessageSyncTests.messagePartDelta_appendsStreamingText(iOS),MessageContentPreparerTestandSseRecoveryFaultOracleTest(Android, under heavy machine load).HomeUiStateto child views on iOS so SwiftUI can skip unchanged parts (the body already re-ran on these changes before); a capabilities interface so Screen Models stop takingActiveConnectionManager;AppRootViewbuilds a new Home view model on each body evaluation because its factory is not a singleton (same onmain).🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Large, behavior-preserving Home refactor spanning live session paging, server switching, and worktree sync—subtle ordering or emission regressions are possible despite unit tests.
Overview
Android Home finishes the region split:
MainScreenViewModelnow exposes oneHomeUiState(content plus servers, paging, session actions, archived menu, snackbar, refresh, and live connection status) instead of many separateStateFlows. Logic moves intoHomeProjectList,HomeWorktrees,HomeServers, andHomeAddProject; existingHomeSessionActionsandHomeArchivedMenugain synchronousonChangehooks that patch that unified state.MainScreencollectshomeonce and usesderivedStateOffor paging inputs to limit list recomposition.iOS aligns
HomeArchivedMenuwith the samestate+onChangepattern (replacing@Observable).SessionChatUiModelsaddsexpandedStepParagraphsfor chip-timeline step expansion state.Reviewed by Cursor Bugbot for commit e5f677a. Bugbot is set up for automated code reviews on this repo. Configure here.