Skip to content

feat(sync): apply batches per profile - #373

Merged
A-EDev merged 4 commits into
mainfrom
feat/sync2-batches-per-profile
Nov 1, 2026
Merged

A-EDev merged 4 commits into
mainfrom
feat/sync2-batches-per-profile

Conversation

@A-EDev

@A-EDev A-EDev commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • A run reads every linked profile's link (spec/protocol.md, Profiles):
    • The running profile's batches are applied as before.
    • Batches for linked profiles that aren't running are kept on this device and acknowledged as consumed.
  • After a switch, the first run applies the kept batches for the profile now running, in the order they were read, one transaction each, before it pushes.
  • A new device starts each link from that link's own snapshot. Each log is read from the lowest object the snapshots include, and a link's batches its snapshot already holds are skipped. This follows "Reading a link from its snapshot" in flow-sync#64.
  • Session::read_link reads a link from its snapshot for a profile that joins it later. The next run does this for every link in sync2_reading.
  • Snapshots are written only for the running profile's link, once nothing is kept for it.
  • Garbage collection waits for snapshots of every link this device reads, and no longer for links whose profiles record is deleted.
  • A group joined before this build maps its link to Default on the first run. Restore maps the adopted link to Default.
  • Live now and play name the running profile's link.

Related issue

Part of FLOW-SYNC/2 Phase 6 (Flow-Tube/Flow#1039).

Change type

  • Bug fix
  • Feature
  • Refactor or maintenance
  • Documentation
  • Build, packaging, or CI

Validation

  • pnpm test: 188 files, 1099 tests passed
  • pnpm build: passed
  • cargo fmt --manifest-path src-tauri/Cargo.toml --all -- --check: clean
  • cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets --all-features: no warnings in the changed code
  • cargo test --manifest-path src-tauri/Cargo.toml --all-targets --all-features: 1110 passed, 0 failed, 9 ignored
  • I smoke-tested the affected desktop behavior.

New tests in tests/sync2_profiles.rs:

  • batches for a profile that isn't running are kept, and apply to that profile only;
  • a new device starts two profiles from their own snapshots after old objects are gone;
  • a profile that joins a link reads it from its snapshot without reading included batches again;
  • a deleted link no longer holds back garbage collection.

Screenshots or recordings

Risk and compatibility

  • No migration (uses 0036).

  • Only Default can be linked until profiles choose links. In another profile, Default's batches are now kept instead of left unread, and they apply on the first sync after switching back to Default.

  • Battery and network: a run in a profile without a link exports nothing and pushes nothing.

  • No new secrets, private data, telemetry, or broad Tauri permissions were introduced.

  • User-facing documentation was updated where needed.

  • Dependency and lockfile changes are intentional and limited to this PR.

  • Breaking changes and upgrade steps are clearly documented.

@A-EDev
A-EDev changed the base branch from feat/sync2-link-storage to main November 1, 2026 21:04
@A-EDev
A-EDev merged commit dd49065 into main Nov 1, 2026
7 checks passed
@A-EDev
A-EDev deleted the feat/sync2-batches-per-profile branch November 1, 2026 22:39
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