Repository navigation
Sync: joining adopts the sync data's default key; CLI asks per item; iCloud placeholders download - #358
Merged
Conversation
…iCloud placeholders download
Default gateway key on join
- Every installation generates a default gateway key. When the key that
default_key points to has the same name on both sides and a different
value, joining is not a conflict: the joining device takes the sync
data's value, in both join modes (a pinned default key is no longer kept
over it on use_remote), and GatewayKeysChanged follows so taken-over
clients are updated. Decisions given for that item are ignored.
- POST /sync/enable/preview lists it in the new SyncJoinPreview.auto
({ item, action: overwrite, reason: default_key }); the row itself stays
in rows. auto is filled for initial configurations too.
twcore sync enable
- Merging asks about each item that differs; the default is "use the sync
data", "keep this device's version" says it replaces the other devices'
one, and "keep both" is offered where a new name is suggested. Before,
pressing Enter skipped every conflict, which pushed this device's values
(its default key among them) onto the other devices.
- The device name defaults to the computer name: ComputerName (then
LocalHostName) on macOS, the host name on Linux, COMPUTERNAME on Windows.
iCloud placeholders (macOS 13 and earlier)
- Reading the real name of a legacy .name.icloud placeholder does not
download it. The folder location now asks iCloud to download it through
NSFileManager startDownloadingUbiquitousItemAtURL:error:, called from the
system osascript (JavaScript for Automation) with the path as an argument,
at most every 5 minutes per file.
- A placeholder (an empty read) is "arriving", not "unreadable": it does not
count toward the 30 minutes after which unreadable files are skipped, and
is skipped only after a day so it cannot hold uploads back forever. The
keyring gets the same treatment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Three follow-ups on sync, on top of #357.
Default gateway key on join
Every installation generates a default gateway key. When the key that
default_keypoints to has the same name on both sides and a different value, joining does not treat it as a conflict. The joining device takes the sync data's value, so it lines up with the devices already syncing:GatewayKeysChangedfollows, so clients set up on the joining device are updated.POST /sync/enable/previewreturns the newSyncJoinPreview.auto: [{ item, action: "overwrite", reason: "default_key" }]. The row stays inrows, and the UI shows it as "use the sync data" with the note about clients.autois also filled for initial configurations.twcore sync enableuuse the sync data (default),kkeep this device's version (the prompt says it replaces the other devices' one), andrkeep both where a new name is suggested. Before this, Enter skipped every conflict, which uploaded this device's values (its default key included) over the other devices'.scutil --get ComputerName(thenLocalHostName) on macOS, the host name on Linux,COMPUTERNAMEon Windows. Before this, macOS fell back toserver.iCloud placeholders (macOS 13 and earlier)
Reading the real name behind a legacy
.name.icloudplaceholder does not download it.NSFileManager startDownloadingUbiquitousItemAtURL:error:(the documented API, available since 10.7;brctl downloadis gone on current macOS).osascript(JavaScript for Automation), with the path passed as an argument, at most every 5 minutes per file. There are no native calls in core.Tests
tw-control/tests/sync_regressions.rs: merge join adopts the default key even with a "skip" decision; a fresh device with taken-over clients adopts it onuse_remote;GatewayKeysChangedis emitted; the other device's key is unchanged. The earlier merge-join test is updated to the new rule.tw-sync/tests/regressions.rs: placeholders are still waited for after 30 minutes and skipped after a day. A macOS-only unit test runs the download request script (it answersfalsefor a file outside iCloud). The device-name helper has unit tests.cargo test --workspace3828 passed, 0 failed;cargo clippy --workspace --all-targets -D warningsclean;cargo fmt --checkclean;scripts/smoke.sh84 passed, 0 failed. The platform-specific functions were also linted for the Linux and Windows targets in a scratch crate.twcore sync enableoffered the computer name as the device name, printed the default-key note, asked about the one differing upstream (default: use the sync data), and adopted the sync data's default key. The other device's key stayed as it was.🤖 Generated with Claude Code