Skip to content

A Mac re-announces its rows when its hub device changes (D-184) - #135

Merged
blove merged 2 commits into
mainfrom
blove/mac-reowns-rows
Nov 9, 2026
Merged

blove merged 2 commits into
mainfrom
blove/mac-reowns-rows

Conversation

@blove

@blove blove commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

The phone couldn't start a thread on the owner's Mac: "No ready connection on your Mac can start a thread in this project." The hub listed the Mac's connections under its earlier device record and the project under the current one, and the phone offers a project only its own Mac's connections (found at the new-thread composer's live gate; the phone-projects gate saw the same for projects).

Cause. A row's owner, on the hub (owner_device_id) and in the mirror (ownerDeviceId), is the device of its latest insert. When a Mac's device changes (a sign-in that gets a new device), nothing inserts its existing rows again, so they stay owned by the old device.

Fix (D-184).

  • Mac migration 0010_owned_rows adds hubLink.ownedAs, the device the Mac last announced its rows as.
  • HubSync.start calls WorkspaceDatabase.claimOwnedRows(): when ownedAs differs from the link's device and something was already pushed, it appends an insert per connections, projects, and threads row as the current device, and the normal push carries them. With nothing pushed yet (first join, join after leave, fresh account) it only records the device, since the coming upload is the whole log anyway. A link from before the migration re-announces once, which repairs existing installs like the owner's.
  • The inserts carry the oldest clock (000000000000-0000-<device>), so the hub and the mirror move ownership and Mac-only columns but never override a clocked column a phone edited. No hub or mirror change.

Tests. OwnedRowsTests (once per device; nothing pushed → record only; pre-migration link → once; link saves don't re-trigger), HubSyncTests.aNewDeviceReannouncesTheRowsItAlreadyPushed (fails with the call removed), and MirrorWritesTests.aReannouncedRowMovesItsOwnerAndKeepsAPhoneEdit. swift test 1,406 passed; lint and docs-index --check clean.

Deploy note. An older Mac build refuses a database migrated to 0010.

🤖 Generated with Claude Code

…-184)

A row's owner on the hub and in the phone's mirror is the device of its latest insert. A
Mac whose device changed kept its connections, projects, and threads owned by the old
device, so the phone offered a project none of its Mac's connections and could not start
a thread there. Mac migration 0010 adds hubLink.ownedAs; HubSync.start re-announces the
rows as inserts with the oldest clock when the device changed after something was pushed,
which moves ownership on the hub and in the mirror without overriding a phone's edit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@blove
blove enabled auto-merge November 5, 2026 16:24
@blove
blove merged commit bc42fcd into main Nov 9, 2026
7 of 8 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