Repository navigation
Group the sidebar by machine by default when the account has two machines (851-4436) - #1438
Merged
pondorasti merged 8 commits intoNov 26, 2026
Conversation
pondorasti
added a commit
that referenced
this pull request
Nov 19, 2026
…1-4436) Review fixes for #1438: - Decide only after this session has received the synced preferences from every reachable machine (tracked per machine in ConfigSync), not from an on-disk replica that any local write creates. - "oneMachine" is now a fallback ranked below the existing-account "settled" fallback, and both lose to any real write, so a one-machine record can never beat "settled". - The automatic Machine grouping is written as a fallback, so a grouping the user picked on another device wins even if it syncs here later. - Count the machines the sidebar lists (de-duplicated allMachines, minus sandboxes), folding an offline entry that shares its name with another machine (a stale record after a reinstall or data reset). Other offline machines still count. On a Mac, wait until the local server has reported in, so this Mac's own cloud record is folded in. - The watcher stops once settled or when its environment is gone; the environment cancels it on teardown. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pondorasti
force-pushed
the
alexandru/851-4436-group-the-sidebar-by-machine-once-when-a
branch
from
November 19, 2026 22:23
be9c5c1 to
7968cf5
Compare
pondorasti
added a commit
that referenced
this pull request
Nov 19, 2026
… (851-4436) Code review fixes for #1438: - Decide only when every machine the sidebar lists (sandboxes left out) is connected and has delivered the synced preferences since it last connected. A second Mac set up while the first one sleeps now waits for it instead of settling and missing the switch. - Forget a machine's delivered preferences when it reconnects, so a reconnect waits for a fresh merge. - Count the sidebar's de-duplicated machine list without folding by name: two Macs that share a name are two machines. A stale offline record of this Mac can't be synced, so it holds the decision instead of switching a one-Mac account. - A fallback write for a key that isn't synced falls back to a local set-if-absent on the watcher's own preferences, so the step can't repeat. - Rename cancelOnTeardown to cancelOnDeinit to say what it does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pondorasti
added a commit
that referenced
this pull request
Nov 19, 2026
…1-4436) Review fixes for #1438: - Decide only after this session has received the synced preferences from every reachable machine (tracked per machine in ConfigSync), not from an on-disk replica that any local write creates. - "oneMachine" is now a fallback ranked below the existing-account "settled" fallback, and both lose to any real write, so a one-machine record can never beat "settled". - The automatic Machine grouping is written as a fallback, so a grouping the user picked on another device wins even if it syncs here later. - Count the machines the sidebar lists (de-duplicated allMachines, minus sandboxes), folding an offline entry that shares its name with another machine (a stale record after a reinstall or data reset). Other offline machines still count. On a Mac, wait until the local server has reported in, so this Mac's own cloud record is folded in. - The watcher stops once settled or when its environment is gone; the environment cancels it on teardown. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pondorasti
force-pushed
the
alexandru/851-4436-group-the-sidebar-by-machine-once-when-a
branch
from
November 19, 2026 22:43
ea1a0da to
91eeb77
Compare
pondorasti
added a commit
that referenced
this pull request
Nov 19, 2026
… (851-4436) Code review fixes for #1438: - Decide only when every machine the sidebar lists (sandboxes left out) is connected and has delivered the synced preferences since it last connected. A second Mac set up while the first one sleeps now waits for it instead of settling and missing the switch. - Forget a machine's delivered preferences when it reconnects, so a reconnect waits for a fresh merge. - Count the sidebar's de-duplicated machine list without folding by name: two Macs that share a name are two machines. A stale offline record of this Mac can't be synced, so it holds the decision instead of switching a one-Mac account. - A fallback write for a key that isn't synced falls back to a local set-if-absent on the watcher's own preferences, so the step can't repeat. - Rename cancelOnTeardown to cancelOnDeinit to say what it does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pondorasti
force-pushed
the
alexandru/851-4436-group-the-sidebar-by-machine-once-when-a
branch
from
November 26, 2026 01:09
91eeb77 to
943f47e
Compare
pondorasti
added a commit
that referenced
this pull request
Nov 26, 2026
…cheap (851-4436) Code review fixes for #1438: - A saved grouping this build can't decode (for example a case added by a newer build) still counts as the user's choice and shows None, as it did before, instead of falling back to the machine default. - The default reads a machine count that doesn't build the machine list, since the sidebar reads the grouping once per row. Co-Authored-By: Claude Fable 5.2 <[email protected]>
pondorasti
force-pushed
the
alexandru/851-4436-group-the-sidebar-by-machine-once-when-a
branch
from
November 26, 2026 01:36
943f47e to
8e533f8
Compare
pondorasti
added a commit
that referenced
this pull request
Nov 26, 2026
…cheap (851-4436) Code review fixes for #1438: - A saved grouping this build can't decode (for example a case added by a newer build) still counts as the user's choice and shows None, as it did before, instead of falling back to the machine default. - The default reads a machine count that doesn't build the machine list, since the sidebar reads the grouping once per row. Co-Authored-By: Claude Fable 5.2 <[email protected]>
pondorasti
force-pushed
the
alexandru/851-4436-group-the-sidebar-by-machine-once-when-a
branch
from
November 26, 2026 02:49
8e533f8 to
5d69a0a
Compare
pondorasti
added a commit
that referenced
this pull request
Nov 26, 2026
…436) Code review fixes for #1438: - The automatic grouping now comes from AccountMachineCount, a small observable model on AppEnvironment. It only takes a new count once the cloud account has finished loading and, on a Mac, once the Mac knows its own cloud device ID. Until then it shows the last count, which is remembered in a local preference that is not synced, so launch never regroups. - Machines are counted by device ID: this Mac plus every other non-sandbox record. The count no longer depends on a machine being online or on its name, so a same-named Mac that sleeps doesn't flip the grouping, and this Mac's own record is never a second machine, even when it was renamed in the cloud. - The grouping reads the saved value first and touches the machine count only when nothing is saved. - The iOS sample sidebar saves an explicit grouping after its reset. Co-Authored-By: Claude Fable 5.2 <[email protected]>
pondorasti
added a commit
that referenced
this pull request
Nov 26, 2026
…om app start-up (851-4436) Code review fixes for #1438: - Signed in with no machine list loaded yet (no cache and the cloud unreachable), the count stays unknown, so the remembered result keeps showing instead of a wrong count being saved. - The count follows a cloud provider that is attached after start-up. - The apps start following the count at launch, next to preference sync, so preview and test environments no longer write the remembered count into the shared preferences. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ines (851-4436) When the user has never picked a sidebar grouping, the effective grouping is now computed: Machine while the account has two or more machines, None otherwise. It follows the machine count up and down, and nothing is written automatically. A saved grouping, including None, always wins. - SidebarGroupingChoice is the one place that holds the rule. The macOS sidebar, the command palette, and the iOS sidebar and options menu all read the effective grouping through it, and the Grouping menu's checkmark shows it. Picking an item saves it as an explicit choice. - The count is the machines the sidebar lists, without sandboxes, so a second Mac with the same name counts and a stale offline record of this Mac doesn't. This replaces the earlier one-time switch: no marker key, watcher, or sync changes remain. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…cheap (851-4436) Code review fixes for #1438: - A saved grouping this build can't decode (for example a case added by a newer build) still counts as the user's choice and shows None, as it did before, instead of falling back to the machine default. - The default reads a machine count that doesn't build the machine list, since the sidebar reads the grouping once per row. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…436) Code review fixes for #1438: - The automatic grouping now comes from AccountMachineCount, a small observable model on AppEnvironment. It only takes a new count once the cloud account has finished loading and, on a Mac, once the Mac knows its own cloud device ID. Until then it shows the last count, which is remembered in a local preference that is not synced, so launch never regroups. - Machines are counted by device ID: this Mac plus every other non-sandbox record. The count no longer depends on a machine being online or on its name, so a same-named Mac that sleeps doesn't flip the grouping, and this Mac's own record is never a second machine, even when it was renamed in the cloud. - The grouping reads the saved value first and touches the machine count only when nothing is saved. - The iOS sample sidebar saves an explicit grouping after its reset. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…851-4436) The iOS Grouping menu now uses checkmark toggles that always save the tapped grouping, so tapping the one already shown keeps it as an explicit choice without relying on how a menu Picker handles a repeat pick. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…om app start-up (851-4436) Code review fixes for #1438: - Signed in with no machine list loaded yet (no cache and the cloud unreachable), the count stays unknown, so the remembered result keeps showing instead of a wrong count being saved. - The count follows a cloud provider that is attached after start-up. - The apps start following the count at launch, next to preference sync, so preview and test environments no longer write the remembered count into the shared preferences. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Calling follow() again no longer adds another observation chain, and a manual update supersedes the pending one instead of stacking up. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…851-4436) The iOS options menu is the Picker from main again, now bound to the effective grouping, so the Grouping row still shows the current choice. Whether picking the already-checked option saves it is unverified on iOS. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…vironment's preferences (851-4436) - A sign-in in progress now leaves the machine count unsettled, so re-running sign-in while signed in no longer drops the count for a moment and regroups the sidebar. Only a real signed-out state counts as this Mac alone. - SidebarGroupingChoice reads the saved grouping from the environment's own preferences, the same store the remembered machine count uses. Co-Authored-By: Claude Fable 5.2 <[email protected]>
pondorasti
force-pushed
the
alexandru/851-4436-group-the-sidebar-by-machine-once-when-a
branch
from
November 26, 2026 03:40
7d99787 to
abaadf0
Compare
pondorasti
deleted the
alexandru/851-4436-group-the-sidebar-by-machine-once-when-a
branch
November 26, 2026 03:48
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.
Fixes 851-4436
When the user has never picked a sidebar grouping, the sidebar groups by Machine while the account has two or more machines, and stays on None otherwise.
The rule
SidebarGroupingChoiceinCodevisorUIholds the rule. The macOS sidebar, the command palette, and the iOS sidebar and options menu all read the grouping through it.A count that is settled before it is used
AccountMachineCount(a small observable model onAppEnvironment) holds the count the default uses.machines.lastKnownAccountMachineCount). So launch never regroups, and this Mac's own record can't be mistaken for a second machine while it is still unidentified.Known limits
Tests
SidebarGroupingChoiceTests(14 tests) pass, three runs in a row. Each of these fails when its fix is swapped out:CodevisorMachine.local.name);The rest cover the basic rule, sandboxes, an unreadable saved value, and signing out. macOS and iOS both build.
Tophat (macOS dev app, ad-hoc signed because the Apple Development certificate is still revoked)
"machine".Not hand-checked on iOS. The simulator could not be run: starting it pushed this Mac's load past 600, so I stopped. The iOS app builds.
Evidence (also on the Linear ticket):
Shots 01–07 are from the previous head; the rule they show is unchanged.
🤖 Generated with Claude Code