What I observed
Two concurrent creates with the same name can both fail and leave no destination or child registry row.
Reproduction
I initialized a fresh source containing file.txt, then started these commands concurrently against the same database:
target/debug/rift --database "$db" create "$source" --name same >a.out 2>a.err &
a_pid=$!
target/debug/rift --database "$db" create "$source" --name same >b.out 2>b.err &
b_pid=$!
wait "$a_pid"; a_status=$?
wait "$b_pid"; b_status=$?
printf 'A=%s B=%s\n' "$a_status" "$b_status"
cat a.err b.err
test -e "$destination"; echo "destination exists: $?"
sqlite3 "$db" 'select count(*) from rift where parent_id is not null;'
One failing pair produced:
File exists (os error 17)
copy-on-write cloning unavailable: failed to clone .../source/file.txt: No such file or directory (os error 2)
Both statuses were nonzero, the destination was absent, and the database had no child row. Across three runs of 100 fresh pairs, I reproduced that outcome 28, 54, and 49 times, 131 of 300 pairs total.
Expected
One create succeeds and the other reports a collision, leaving one complete destination and one child registry row.
Actual
Both creates can fail, and cleanup removes the destination produced during the race.
Environment
- Rift commit
757a22cb247f
- macOS 26.6.2, arm64, APFS
What I observed
Two concurrent creates with the same name can both fail and leave no destination or child registry row.
Reproduction
I initialized a fresh source containing
file.txt, then started these commands concurrently against the same database:One failing pair produced:
Both statuses were nonzero, the destination was absent, and the database had no child row. Across three runs of 100 fresh pairs, I reproduced that outcome 28, 54, and 49 times, 131 of 300 pairs total.
Expected
One create succeeds and the other reports a collision, leaving one complete destination and one child registry row.
Actual
Both creates can fail, and cleanup removes the destination produced during the race.
Environment
757a22cb247f