Skip to content

feat(drive): add read-only reporting commands#554

Merged
steipete merged 1 commit intomainfrom
feat/drive-reporting-readonly
May 5, 2026
Merged

feat(drive): add read-only reporting commands#554
steipete merged 1 commit intomainfrom
feat/drive-reporting-readonly

Conversation

@steipete
Copy link
Copy Markdown
Collaborator

@steipete steipete commented May 5, 2026

Summary

  • extract the read-only Drive reporting slice from feat: drive reporting/sync + contacts dedupe #116: drive tree, drive du, and drive inventory
  • keep Drive sync and contacts dedupe out of this PR for separate review
  • add generated command docs, README examples, changelog credit, and command/fake-Drive coverage

Testing

  • go test -vet=off ./internal/cmd -run 'Test(SanitizeDriveName|JoinDrivePath|SummarizeDriveDu|ExecuteDriveTreeJSON)'\n- make build\n- make docs-commands\n- make ci\n- make docs-site\n- live Drive smoke on clawdbot@gmail.com: created temporary folder/subfolder/files, verified drive tree, drive inventory, and drive du JSON output, then permanently deleted the temporary folder\n\nExtracted-from: feat: drive reporting/sync + contacts dedupe #116\nCo-authored-by: Rohan Patnaik rohan-patnaik@users.noreply.github.com

Co-authored-by: Rohan Patnaik <rohan-patnaik@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd64bb95d4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +336 to +338
if opts.MaxItems > 0 && len(out) >= opts.MaxItems {
truncated = true
return out, truncated, nil
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply --max after inventory sorting

drive inventory passes MaxItems into listDriveTree, which truncates during traversal before sortDriveInventory runs. This makes --sort ... --max N return only the first N discovered items (then sorted), not the top N for the requested sort key; in large/deep folders this can omit the actual largest/newest paths users asked for.

Useful? React with 👍 / 👎.

Comment on lines +369 to +373
out = append(out, resp.Files...)
if resp.NextPageToken == "" {
break
}
pageToken = resp.NextPageToken
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Stop paginating children once max results is reached

Even when callers set a small --max, this function always fetches every page of a folder before returning children, so drive tree/drive inventory can still issue very large API reads and consume significant time/quota on big roots. Since --max is advertised as a hard cap, pagination should short-circuit as soon as the caller has enough items.

Useful? React with 👍 / 👎.

@steipete steipete merged commit e9c496e into main May 5, 2026
10 checks passed
@steipete steipete deleted the feat/drive-reporting-readonly branch May 5, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant