feat(photos): add upload and app-created album commands - #1185
beyondzero wants to merge 1 commit into
Conversation
|
🦞👀 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: needs maintainer review before merge. Reviewed October 4, 2026, 12:23 PM ET / 16:23 UTC (Revision 3). ClawSweeper reviewWhat this changesAdds Google Photos uploads and app-created album commands, an opt-in OAuth write scope, documentation, and regression tests. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and v0.43.0 lack the requested commands. The earlier findings are resolved, the live proof supports the authorization boundary, and no blocking patch defect remains. Priority: P2 Review scores
Verification
How this fits togetherThe Photos CLI connects account credentials and local media files to Google's Photos Library API. It returns app-created media and album information as JSON or terminal output. flowchart TD
A[Local media files] --> B[Photos commands]
C[Account and OAuth scopes] --> D[Authenticated client]
B --> D
D --> E[Read-only request guard]
E --> F[Google Photos API]
F --> G[Media and album results]
G --> B
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Extend the existing Photos client with explicit opt-in writes while preserving read-only defaults and narrowed grants. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this adds commands absent from main. The contributor supplies a concrete real-account transcript demonstrating the new behavior. Is this the best way to solve the issue? Yes. Reusing the existing Photos client and scope-selection pattern is a focused implementation, and the updated narrowing logic preserves the intended authorization boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 414e2ff8afa2. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
Photos Library API writes that remain after the 2025 scope changes: 'photos upload' (raw upload + mediaItems:batchCreate, optional album and description, per-item results, --dry-run) and 'photos albums list|create'. Upload is opt-in: 'gog auth add --photos-scope=append' adds photoslibrary.appendonly; the default photos scope stays read-only, and --readonly with --photos-scope=append is refused. Only photo and video file types are sent, so an arbitrary file's bytes never reach the upload endpoint. The --readonly transport already blocks the new POSTs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. This addresses all three items: the P1 grant narrowing, the changelog, and the real-behaviour proof. Fix: narrowing Photos no longer keeps an earlier append grant
Authority-chain proof (live)This uses one real consumer Google account and one Desktop OAuth client throughout, with a generated test image and a throwaway app-created album. The account, client ID, album and media IDs, and local paths are redacted. Generated authorization URLs ( A. Append grant: album create and upload succeed. The stored scopes include B. Narrow the same account and client to read-only (default Drive/Gmail modes): C. Writes after narrowing, without D. Re-widening needs the explicit opt-in, and then works again: Automatic reauthorization runs only after |
5c40088 to
23b7f7d
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
What
Adds the Photos Library API writes that still exist after Google's 2025 scope changes:
gog photos upload <file>...uploads bytes (uploads), then creates media items (mediaItems:batchCreate). It can add them to an app-created album (--album) and set a description (--description), and it reports a result per item.--dry-runis supported.gog photos albums listandgog photos albums create <title>work on app-created albums.Scope: upload is opt-in
The default
photosscope is unchanged:photoslibrary.readonly.appcreateddataonly. Uploading needsgog auth add <email> --services photos --photos-scope=append, which addsphotoslibrary.appendonly. This follows the--gmail-scope/--drive-scopepattern, so existing read-only setups and--enable-commands photosallowlists gain no write access by default.--readonlywith--photos-scope=appendis refused atauth add. The existing--readonlytransport already blocksPOST /v1/uploads,mediaItems:batchCreateandPOST /v1/albums; this was verified against a live token. When Google refuses an upload with 403, the error names the flag to re-run with.File types: only photo and video extensions are accepted. Anything else (a text file, a key file) is refused locally, before any bytes are sent to the upload endpoint.
Regenerated: the README auth table (
scripts/gen-auth-services-md.go), the command docs and thegog-photosagent skill (make agent-skills).Why
Since the 2025 Library API changes, the only thing an app can do with a user's Photos library is create media and albums, and work inside what it created.
gog photoscould read app-created media but not create any. That left gog unable to do the one write the API still allows.Testing
make cipasses (fmt-check, golangci-lint, deadcode, test, docs-check, agent-skills-check), with new tests ininternal/cmd/photos_write_test.goandinternal/googleauth/service_test.go(default stays read-only, append is opt-in, readonly+append and unknown modes are refused).descriptionset through the API shows under Info → Other in Google Photos and is searchable. It is not the user-editable "Add a description" caption, which only a person in the app can set. This is documented in the command help.🤖 Generated with Claude Code