Skip to content

Add batch --simulate flag - #11

Closed
jclusso wants to merge 2 commits into
masterfrom
batch-simulate
Closed

jclusso wants to merge 2 commits into
masterfrom
batch-simulate

Conversation

@jclusso

@jclusso jclusso commented May 27, 2026

Copy link
Copy Markdown
Member

batch verify gains a --simulate flag forwarding the documented test-key-only error-simulation parameter (generic_error, insufficient_credits_error, payment_error, card_error), so error handling can be exercised without real verifications.

The documented captcha_response parameter stays unexposed by design — it only applies to public API keys in client-side CAPTCHA flows, not a secret-key CLI — with a code comment recording why.

`batch verify` gains a --simulate flag forwarding the documented test-key-only error-simulation parameter (generic_error, insufficient_credits_error, payment_error, card_error), so error handling can be exercised without real verifications.

The documented captcha_response parameter stays unexposed by design — it only applies to public API keys in client-side CAPTCHA flows, not a secret-key CLI — with a code comment recording why.
Copilot AI review requested due to automatic review settings May 27, 2026 20:52

Copilot AI 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.

Pull request overview

Adds support for simulating documented test-key-only API errors when submitting batch verifications, enabling local exercising of CLI error handling without performing real verifications.

Changes:

  • Add Simulate to api.SubmitBatchOptions and forward it as simulate in the batch submission form body.
  • Expose --simulate on emailable batch verify and thread it into submission options.
  • Add an e2e test ensuring --simulate is forwarded; add a comment explaining why captcha_response remains intentionally unexposed for verify.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
internal/api/client.go Adds Simulate option and forwards simulate parameter in batch submission POST body.
cmd/verify.go Adds a clarifying comment about intentionally not exposing captcha_response.
cmd/batch.go Adds --simulate flag and wires it into SubmitBatchOptions.
cmd/batch_e2e_test.go Adds an e2e test asserting --simulate is included in the submit form body.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/batch.go
Comment on lines +221 to +227
if cmd.Flags().Changed("simulate") {
v, err := cmd.Flags().GetString("simulate")
if err != nil {
return nil, err
}
opts.Simulate = v
any = true
Comment thread cmd/verify.go
Comment on lines +81 to +84
// The documented `captcha_response` parameter is intentionally not exposed:
// it only applies to public API keys behind a CAPTCHA challenge in
// client-side (browser/mobile) flows. The CLI authenticates with a secret
// key, where CAPTCHA never applies, so a flag for it would be dead weight.
@jclusso

jclusso commented May 27, 2026

Copy link
Copy Markdown
Member Author

Closing — --simulate is test-key-only, and using a test key in a CLI to simulate billing/card errors isn't a realistic workflow. Not worth the added flag surface.

@jclusso jclusso closed this May 27, 2026
@jclusso
jclusso deleted the batch-simulate branch May 27, 2026 22:37
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.

2 participants