Forget pushed event ids when another calendar is chosen (Feature 16)
CI / ci (push) Successful in 4m10s
CI / ci (pull_request) Successful in 4m25s

Choosing a calendar other than the stored one now clears every plan
day's calendar_event_id and edits each plan that had one (revision
raised, synced -> changed) in the same transaction as the choice, so a
stored event id is always on the chosen calendar and the next push
writes the whole week there.

PushEvents now runs the push's record under the same account-lock hold
as its event writes, so the chosen calendar cannot change between the
writes and the sync bookkeeping; a push that read a plan before the
choice is refused by its revision check (ErrPlanChanged).

Fixes review finding F-01 on task 5885d2b1-cf06-44ff-abf3-242d7763c3c9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 22:40:14 -04:00
co-authored by Claude Opus 5.5
parent 691c1ff34a
commit 26fde27f54
11 changed files with 364 additions and 69 deletions
+1 -1
View File
@@ -1326,6 +1326,6 @@ func TestStartBatchRefusesUnknownTrigger(t *testing.T) {
// noCalendar is a plan.Calendar for tests that never push.
type noCalendar struct{}
func (noCalendar) PushEvents(context.Context, []gcal.Event) error {
func (noCalendar) PushEvents(context.Context, []gcal.Event, func() error) error {
return errors.New("no calendar in this test")
}