Journal: link_calendar_event_to_log can drop a concurrently added child line #115

Closed
opened 2026-09-25 19:20:38 +00:00 by kayg · 4 comments
Owner

Follow-up from #98 (job/journal-cas). link_calendar_event_to_log builds an entry's child lines from its own earlier read; the entry ETag covers only the Log line, so a child line added by sync or another writer between that read and the write can be dropped. Fix: build the child lines inside the checked read-modify-write (store::update) from the current file text, like PATCH now does (commit 37971d2); add a race test injecting a child line between read and write.

Follow-up from #98 (job/journal-cas). link_calendar_event_to_log builds an entry's child lines from its own earlier read; the entry ETag covers only the Log line, so a child line added by sync or another writer between that read and the write can be dropped. Fix: build the child lines inside the checked read-modify-write (store::update) from the current file text, like PATCH now does (commit 37971d2); add a race test injecting a child line between read and write.
Author
Owner

Starting work on job/backend-misc, based on dev at 7c1d6c82ea98ac3772117a534fbb923825a60bab. I am tracing the calendar-event/log update and will move child-line construction into the checked update with a deterministic race regression test.

Starting work on `job/backend-misc`, based on `dev` at `7c1d6c82ea98ac3772117a534fbb923825a60bab`. I am tracing the calendar-event/log update and will move child-line construction into the checked update with a deterministic race regression test.
Author
Owner

Confirmed the race in crates/plugins/notes/src/calendar_links.rs: link_calendar_event_to_log builds the replacement from provider.get and calls provider.put; the ETag protects the Log line while the concurrently edited child block can be omitted. The checked store::update path already re-reads the Daily note after a failed compare-and-swap, so I am applying the child edit inside that closure.

Confirmed the race in `crates/plugins/notes/src/calendar_links.rs`: `link_calendar_event_to_log` builds the replacement from `provider.get` and calls `provider.put`; the ETag protects the Log line while the concurrently edited child block can be omitted. The checked `store::update` path already re-reads the Daily note after a failed compare-and-swap, so I am applying the child edit inside that closure.
Author
Owner

Continuing Forgejo #115 after the prior host kill. Branch: job/backend-misc; base SHA: 7c1d6c82ea98ac3772117a534fbb923825a60bab; starting HEAD: 04fcfe5ddfc70b7b37c09c165f1cd2ba699c2cf4. I am reviewing the existing checked read-modify-write fix and its injected race test, then I will verify the final merged branch state.

Continuing Forgejo #115 after the prior host kill. Branch: `job/backend-misc`; base SHA: `7c1d6c82ea98ac3772117a534fbb923825a60bab`; starting HEAD: `04fcfe5ddfc70b7b37c09c165f1cd2ba699c2cf4`. I am reviewing the existing checked read-modify-write fix and its injected race test, then I will verify the final merged branch state.
Author
Owner

Merged into dev at 57894643. Deploy status on #203.

Merged into dev at 57894643. Deploy status on #203.
kayg closed this issue 2026-09-26 21:02:30 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#115
No description provided.