Phase 2: implement --delay-updates #264

Closed
TapTap wants to merge 0 commits from feat/p2-delay-updates into dev
Owner

Receiver stages all successful writes and publishes them atomically only after the whole transfer completes (both single-threaded and -m, publish exactly once after writer/receiver threads drain and before the outcomes frame so remove-source-files sees real publication). Crash leftovers wiped on next run; abort cleans staging; --inplace rejected; protocol bumped 2.5.0->2.6.0 for the new wire bool. Tests: config round-trip, CLI parse, unit delay suite, integration TestDelayUpdates.

Receiver stages all successful writes and publishes them atomically only after the whole transfer completes (both single-threaded and -m, publish exactly once after writer/receiver threads drain and before the outcomes frame so remove-source-files sees real publication). Crash leftovers wiped on next run; abort cleans staging; --inplace rejected; protocol bumped 2.5.0->2.6.0 for the new wire bool. Tests: config round-trip, CLI parse, unit delay suite, integration TestDelayUpdates.
TapTap added 1 commit 2026-09-06 13:44:11 +02:00
feat: implement --delay-updates receiver staging and publication
CI / lint (pull_request) Failing after 22s
CI / build-and-test (pull_request) Skipped
CI / sanitizers (address) (pull_request) Skipped
CI / sanitizers (undefined) (pull_request) Skipped
CI / fuzz-build (pull_request) Skipped
CI / coverage (pull_request) Skipped
CI / valgrind (pull_request) Skipped
a2a82dd856
Stage every successfully written file under a private 0700 .fastsync-stage
directory inside the receive root and atomically publish all staged files
only after the whole protocol stream (manifest/delete handling included)
has completed, immediately before the success/outcome frame.  On any
abort/error before publication nothing is installed and staging is removed;
a publish failure aborts the transfer with best-effort cleanup of the
remainder (already-published files are not rolled back).  Crash leftovers
are wiped when the next delayed transfer starts.

Wire: new delay_updates config flag (selection-options block), protocol
version bumped to 2.6.0, client/server validation rejects --inplace.
CLI/usage/validation updated.  Works in single-threaded and -m modes
(exactly one write_thread stages files; the staged-file registry is
mutex-protected; publication runs once after both threads join).
--existing/--ignore-existing/--update decide against the final destination
at stage time; --backup is deferred to publication.  remove_source_files
outcomes are only sent after publication so skipped/unpublished sources are
never deleted.  Default (no flag) behavior is unchanged.

Tests: config wire round-trip, CLI parse, --inplace rejection, new
test_delay_updates unit suite (27 suites total), and integration
TestDelayUpdates covering single/-m parity, incremental reruns, remove
source files, receiver-skip ordering, and a deterministic publish-failure
abort path.
Author
Owner

Merged into dev (HEAD a196522).

Merged to dev (delay-updates landed in the wave-B merge chain; dev HEAD a196522, CI run #469 all green). Independent c-review found 2 blockers, both fixed: (1) --delete walker now skips the .fastsync-stage staging dir so staged files are published after delete; (2) backup-dir reserved-name collision (.fastsync-stage) rejected client+server-side. Also reworked the publish-failure test to actually exercise mid-publish, added post-publish wipe logging, and serialized concurrent delayed sessions with an exclusive flock. Protocol bumped to 2.6.0. Closing as merged.

**Merged into dev** (HEAD a196522). Merged to dev (delay-updates landed in the wave-B merge chain; dev HEAD a196522, CI run #469 all green). Independent c-review found 2 blockers, both fixed: (1) --delete walker now skips the .fastsync-stage staging dir so staged files are published after delete; (2) backup-dir reserved-name collision (.fastsync-stage) rejected client+server-side. Also reworked the publish-failure test to actually exercise mid-publish, added post-publish wipe logging, and serialized concurrent delayed sessions with an exclusive flock. Protocol bumped to 2.6.0. Closing as merged.
TapTap closed this pull request 2026-09-06 14:31:55 +02:00

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#264