fix(backup): reject repeated Calendar Contacts Tasks page tokens - #1081
fix(backup): reject repeated Calendar Contacts Tasks page tokens#1081SebTardif wants to merge 2 commits into
Conversation
Route calendar, contacts, and tasks backup listing through collectAllPages so a repeated Google continuation token fails closed instead of hanging gog backup push. Signed-off-by: Sebastien Tardif <SebTardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 5, 2026, 3:28 AM ET / 07:28 UTC. ClawSweeper reviewWhat this changesRoute nine Calendar, Contacts, and Tasks backup listings through the existing pagination guard and add repeated-token and successful-pagination tests. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 4 items remain The fix remains necessary on main and v0.39.0, and the supplied fault-injection proof supports the pagination guard. The previously reported ACL data-loss regression remains unresolved. Priority: P2 Review scores
Verification
How this fits togetherGoogle service adapters collect account data for encrypted backup snapshots. Their pagination and error handling determine which records reach the backup repository and whether collection can finish. flowchart TD
A[Backup push] --> B[Calendar Contacts Tasks adapters]
C[Google API pages] --> B
B --> D[Pagination guard]
D --> E[Collected records]
D --> F[Listing error]
E --> G[Encrypted snapshot]
F --> H[Abort collection or record ACL error]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep bounded pagination while preserving earlier ACL pages and per-calendar error rows, with documented and verified final-snapshot failure behavior. Do we have a high-confidence way to reproduce the issue? Yes, source establishes deterministic triggers: repeated tokens keep main’s loops running, and a populated ACL page followed by HTTP 403 exposes the PR’s partial-result regression. No tests were executed in this read-only review. Is this the best way to solve the issue? The shared guard is the right approach, but the ACL adapter must preserve its existing best-effort contract using local error handling, as the merged Classroom adapter already does. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 25703c789da5. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Keep the httptest listing cases off t.Parallel so Windows CI does not hit a json/v2 runtime fault while the rest of internal/cmd is running. Signed-off-by: Sebastien Tardif <SebTardif@ncf.ca>
|
Superseded by #1087, which incorporates Calendar, Contacts, and Tasks cycle protection while retaining fetched ACL rows on ordinary API errors. Backup failure and encrypted-row behavior were verified. Thanks @SebTardif. Superseded by #1087, which incorporates Workspace and Forms pagination protection without introducing new page limits. Stock-CLI runs verified fatal inventory failures and embedded Forms error records. Thanks @SebTardif. Superseded by #1087, which incorporates contact-dedupe cycle protection while preserving early completion at --max. Repeated tokens stop before a partial plan or contact changes. Thanks @SebTardif. |
What Problem This Solves
gog backup pushwith calendar, contacts, or tasks walks Google page tokens in nine list helpers ininternal/cmd/backup_services.go(calendar ACL, settings, calendars, events, People connections, other contacts, contact groups, task lists, and tasks). Each helper copiednextPageTokeninto the next request with no seen-set.When Calendar, People, or Tasks repeats a continuation token, those loops never terminate. Backup collection keeps requesting the same page and never finishes the snapshot.
The same hang class is already closed for Chat and Classroom backup (#1063), Drive backup listing (#1078), Groups/Admin/Keep backup listing (#1079), Drive collaboration listing (#1080), Drive sync and audit listing (#1065, #1066), interactive calendar listing (#1004), and People/Gmail-from-contact/contacts-export listing (#1044, #1045, #1046). Calendar, Contacts, and Tasks backup listing was still on the unguarded loop. Interactive
gog calendarlisting already usescollectAllPages; backup did not.Evidence
terminal output from the compiled
internal/cmdlisting binary after the patch. A stuck continuation token is rejected after two list calls, with no third request:Before the patch, the same stuck token made a third list request and returned HTTP 400 from the safety cap (
unexpected extra ... page request after 3 list calls) instead of stopping on the repeated token.Real behavior proof
gog backup pushwith those services never finished those listings.fix/backup-services-page-tokenat current HEAD, compiledinternal/cmdlisting binary.go, then rangogcli-backup-services.exewith-test.von the calendar, connections, task-list, and event hang-guard cases.pagination loop: repeated page token "stuck"after 2 list calls forfetchBackupCalendars,fetchBackupConnections,fetchBackupTaskLists, andfetchBackupCalendarEvents.--best-efforthandling after the listing error. Settings, other-contacts, contact-groups, ACL, and per-list task paging use the samecollectAllPagesrewrite.Summary
Route the nine Calendar, Contacts, and Tasks backup list helpers through existing
collectAllPages. Keep the original page sizes, field masks, show-deleted flags, sorts, and ACL best-effort error rows.Related: #1063, #1078, #1079, #1080, #1065, #1066, #1004, #1044, #1045, #1046.
Introduced in
efc3df2e(2026-04-27,feat(backup): expand google backup coverage). Calendar list helper later moved in6f917ee7.