Skip to content

feat(org): add finalized invoice commands - #659

Merged
ImLunaHey merged 2 commits into
mainfrom
luna/dep-4480-invoices
Nov 5, 2026
Merged

ImLunaHey merged 2 commits into
mainfrom
luna/dep-4480-invoices

Conversation

@ImLunaHey

@ImLunaHey ImLunaHey commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

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>'
  • Return full protobuf JSON responses, preserving signed integer amounts as strings and optional fields. List commands read one page and expose continuation tokens, including on empty filtered pages.
  • Accept organization tokens or owner user tokens with --org; preserve the token's organization unless explicitly selected. No interactive login.
  • Use published Buf commit 2ae2cc96583940688aa4b20766844296, retaining the existing Go generator and Connect runtime versions.
  • Document current/previous subscription and standalone history, pagination, and confidential document links.

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 invoices for reading finalized Stripe-backed billing data as JSON: list (paginated), get, and line-items / lines.

Commands call the new BillingService via NewBillingClient(), use static org auth (--token / DEPOT_TOKEN / config) and optional --org for owner user tokens—org switch is 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-token without 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.

@linear-code

linear-code Bot commented Nov 3, 2026

Copy link
Copy Markdown

DEP-4480

@ImLunaHey
ImLunaHey marked this pull request as ready for review November 5, 2026 13:15

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note

🤖 Cursor Grok 4.6 responding on behalf of Cursor Approval Agent

Risk: high. Approved. Cursor Bugbot completed successfully and reported no findings that need human review.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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, get and line-items subcommands in pkg/cmd/org/invoices.go. Each checks the token in PreRunE before making a request and checks --page-size is between 1 and 100. Each request has a 30s timeout, get fails if the response has no invoice, and output goes to the command's stdout as protojson.
  • Auth. It reuses the existing ResolveStaticOrgAuth and WithAuthenticationAndOrg helpers, which this PR doesn't change. The x-depot-org header is only sent when --org is given.
  • NewBillingClient in pkg/api/rpc.go, which is built the same way as NewCreditClient, 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.

@ImLunaHey
ImLunaHey merged commit 6237b01 into main Nov 5, 2026
13 checks passed
@ImLunaHey
ImLunaHey deleted the luna/dep-4480-invoices branch November 5, 2026 13:23
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