Repository navigation
feat(org): add finalized invoice commands - #659
Conversation
There was a problem hiding this comment.
I reviewed this PR and didn't find any bugs. It adds a new command that reads billing data and moves the generated depot/api modules to a new revision, so a human should still look it over, mainly to confirm the module revision and when it can ship (it depends on the API side being deployed).
What was reviewed:
- The
list,getandline-itemssubcommands in pkg/cmd/org/invoices.go. Each checks the token in PreRunE before making a request and checks--page-sizeis between 1 and 100. Each request has a 30s timeout,getfails if the response has no invoice, and output goes to the command's stdout as protojson. - Auth. It reuses the existing
ResolveStaticOrgAuthandWithAuthenticationAndOrghelpers, which this PR doesn't change. Thex-depot-orgheader is only sent when--orgis given. NewBillingClientin pkg/api/rpc.go, which is built the same way asNewCreditClient, and the new command's registration in org.go.
Extended reasoning...
The change adds a new read-only depot org invoices command group (about 130 lines of command code plus 238 lines of tests), a one-function Billing client in pkg/api/rpc.go, a README section, and an update of the buf.build depot/api generated modules. The sensitive part is exposing invoice data, including confidential hosted/PDF document links, using existing token-based auth. The auth helpers themselves are not modified. I deferred rather than approved because this is a new billing feature with a generated-API dependency update and a release that has to wait for the API deployment, which a maintainer should sign off on. No CODEOWNERS file covers these paths and there are no outstanding review objections.


Add finalized invoice exports under
depot org invoices:depot org invoices list --page-size 100 depot org invoices get in_example depot org invoices line-items in_example --page-token '<nextPageToken>'--org; preserve the token's organization unless explicitly selected. No interactive login.2ae2cc96583940688aa4b20766844296, retaining the existing Go generator and Connect runtime versions.Validation: full
go test ./...; organization-command race tests; golangci-lint; module verification/tidy; binary build and command-help smoke checks. Tests exercise real HTTP/2 Connect requests, auth headers, exact JSON amounts, empty-page continuation, invalid inputs, and API errors without retries. Hosted cross-platform packaging and upstream validation remain CI checks.Release after API #5892 is verified deployed. This CLI uses Buf modules directly and does not depend on the Go SDK release.
Part of DEP-4480. SDK counterparts: Node #36, Go #65.
Catch up on this pull request in Depot
Note
Medium Risk
Exposes billing invoice metadata and confidential PDF/hosted URLs in JSON output, with org-scoped auth; behavior is read-only but touches sensitive financial data.
Overview
Adds
depot org invoicesfor reading finalized Stripe-backed billing data as JSON:list(paginated),get, andline-items/lines.Commands call the new
BillingServiceviaNewBillingClient(), use static org auth (--token/DEPOT_TOKEN/ config) and optional--orgfor owner user tokens—org switchis ignored and there is no interactive login. Responses are full protobuf JSON with amounts as strings; list operations expose--page-size(1–100) and--page-tokenwithout auto-pagination or opening hosted/PDF links.The Depot API Buf modules are bumped to commit
2ae2cc965839, README documents usage and limits, and tests cover HTTP/2 Connect auth headers, JSON precision, empty-page continuation tokens, errors without retries, and validation that skips API calls when input or credentials are invalid.Reviewed by Cursor Bugbot for commit 9345f54. Bugbot is set up for automated code reviews on this repo. Configure here.