fix(backup): reject repeated Groups Admin Keep page tokens - #1079
fix(backup): reject repeated Groups Admin Keep page tokens#1079SebTardif wants to merge 3 commits into
Conversation
Groups, Admin, and Keep backup listing copied nextPageToken with no seen-set. A repeated Google continuation token hung gog backup push for those services. Walk those pages through collectAllPages (same cmd package). Admin group members already used loadPagedItems. 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. |
govet shadow failed CI because call.Do() reused err from the surrounding lookup. Use callErr, matching Groups list helpers. Signed-off-by: Sebastien Tardif <SebTardif@ncf.ca>
|
Codex review: blocked before merge. Reviewed September 5, 2026, 2:28 AM ET / 06:28 UTC. ClawSweeper reviewWhat this changesRoutes five Groups, Admin, and Keep backup listings through the existing pagination guard and adds repeated-token and successful-pagination tests. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 3 items remain The fix remains necessary on main and v0.39.0. The supplied pagination proof is sufficient, but the previously reported membership-retention regression still blocks merge. Priority: P2 Review scores
Verification
How this fits togetherBackup service adapters fetch Google account data and turn it into rows for encrypted Git snapshots. Their pagination and error handling determine which records reach the completed backup. flowchart TD
A[Backup push] --> B[Groups Admin and Keep adapters]
B --> C[Google API pages]
C --> D[Pagination guard]
D --> E[Collected records]
D --> F[Collection errors]
E --> G[Backup snapshot assembly]
F --> G
G --> H[Encrypted Git backup]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep the shared pagination guard while preserving successful membership pages and per-group error records, with compatibility coverage through snapshot assembly. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the repeated-token loop on main and the PR's separate row-loss trigger: return members on page one, then a provider error on page two. This review did not execute either scenario. Is this the best way to solve the issue? No, not as written: reusing the shared guard is appropriate, but its strict error behavior needs adapting to the membership collector's existing partial-result contract. 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)
|
golangci-lint dupl flagged the collectAllPages plus sort wrappers for Admin users and groups, and the matching httptest cases. Share fetchSortedBackupPages and a stuck-token handler so lint stays clean. Signed-off-by: Sebastien Tardif <SebTardif@ncf.ca>
|
Superseded by #1087, which incorporates Groups, Admin, and Keep cycle protection and preserves fetched membership rows on ordinary later-page API failures. Thanks @SebTardif. The separate Cloud Identity query issue #1059 remains open. Superseded by #1087, which incorporates Drive collaboration cycle protection without adding a new page ceiling. Encrypted per-file error records and continued collection were verified. Thanks @SebTardif. 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. |
What Problem This Solves
gog backup pushwith Groups, Admin, or Keep walks Google page tokens ininternal/cmd/backup_directory_keep.go. Five helpers copiednextPageTokeninto the next request with no seen-set: Cloud Identity group search, Cloud Identity memberships, Admin users, Admin groups, and Keep notes.When Google repeats a continuation token, those loops never terminate. Backup collection keeps requesting the same page and never finishes the snapshot.
Admin group members in the same file already use
loadPagedItems, which callscollectAllPages. Interactive Groups and Admin listing already use that helper too. Backup listing for Groups, Admin users/groups, and Keep was still on the unguarded loop.The same hang class is already closed for Chat and Classroom backup (#1063), Drive sync push listing (#1065), Drive audit permission listing (#1066), calendar and Gmail listing (#1004), and People/Gmail-from-contact/contacts-export listing (#1044, #1045, #1046). Drive backup listing is the open sibling #1078 (different file). This change does not touch
backup_drive.go.The unguarded loops landed in
efc3df2e(2026-04-27,feat(backup): expand google backup coverage).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-directory-page-tokenat current HEAD, compiledinternal/cmdlisting binary.go, then rangogcli-backup-paging.exewith-test.von the Groups, Admin users, Admin groups, Keep notes, and Cloud Identity membership hang-guard cases.pagination loop: repeated page token "stuck"after 2 list calls for Cloud Identity groups, Admin users, Admin groups, Keep notes, and Cloud Identity memberships.