Forget pushed event ids when Google Calendar is disconnected (Feature 16)
CI / ci (push) Successful in 3m49s
CI / ci (pull_request) Successful in 4m33s

Disconnect deleted the connection but left every pushed plan synced with
its stored event ids, though no calendar was chosen any more. It now
deletes the connection and runs the same invalidation as choosing another
calendar (forgetEvents: MarkCalendarPlansEdited, ClearCalendarEvents) in
one transaction, under the account lock. A refused revoke still changes
nothing.

Tests push three weeks, disconnect, and check each is changed with no
event id; then connect again, choose a calendar and push the whole week
to it. Also: a refused revoke keeps every week synced, and a disconnect
during a push waits for its record and then forgets it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 23:07:36 -04:00
co-authored by Claude Opus 5.5
parent 26fde27f54
commit fb7d8ddff8
8 changed files with 183 additions and 35 deletions
+3 -3
View File
@@ -173,9 +173,9 @@ type Querier interface {
// first.
ListWeekPlanDinnerIDs(ctx context.Context, weekStart string) ([]sql.NullString, error)
// Records that Calendar no longer shows the days with a calendar event id
// as planned, since another calendar is chosen: every plan with such a day
// is edited as MarkWeekPlanEdited does, so a synced plan becomes changed
// and a push that read it before is refused.
// as planned, since another calendar or none is chosen: every plan with
// such a day is edited as MarkWeekPlanEdited does, so a synced plan becomes
// changed and a push that read it before is refused.
MarkCalendarPlansEdited(ctx context.Context, updatedAt string) error
// Moves a dinner still in the Quest log to tried; a dinner with any other
// status is left as it is (0 rows).