Skip to content

feat(cli): send a test event from webhooks test when --data is not given - #95

Merged
thebrandonlucas merged 1 commit into
feat/cli-list-all-hintfrom
feat/cli-webhook-test-default
Oct 22, 2026
Merged

thebrandonlucas merged 1 commit into
feat/cli-list-all-hintfrom
feat/cli-webhook-test-default

Conversation

@thebrandonlucas

@thebrandonlucas thebrandonlucas commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

voltage webhooks test WEBHOOK_ID without --data now sends a test event. Before, it failed with "This operation requires --data @file or --data -" and didn't say what to send.

The body is the contract's test payload, with a new delivery_id each time:

{"delivery_id": "<new UUID>", "payload": {"type": "test", "detail": {"event": "created", "data": "Test delivery from voltage webhooks test"}}}

It goes through check_payload like any other friendly body. --data still sends your own payload. Without --execute, the command only describes the change, as before. The help has an example for each form, and the long help explains the default.

In the CLI benchmark, both CLI setups hit this error on T4. Agents read the help twice, or built the payload with curl. Closes #81.

Stack: 6 of 6, on #94. It doesn't depend on the PRs below it.

  • User-visible change: CHANGELOG.md (Unreleased) and docs/guides/webhooks.md are updated.
  • The verification gate passes: fmt, clippy, machete, cargo test (262 tests) and check-coverage.py. The new help example also runs offline without --execute.
  • Reviewed against feat(cli): accept --all on lists that return every item at once #94. A unit test checks the payload and that each test gets a fresh delivery_id. An integration test sends it to a mock API: the response is a 202, and the request body has type test, event created and a UUID delivery_id. The existing test for the "requires --data" error now uses payments check, which still needs a body.
  • CRAP on 286c6b2: 0 functions at or above 20. The highest is wait_for_payment at 19.60. friendly_body is 16.28 and friendly_flags is 8.0.
  • Checks not run: a live staging send. The payload matches the contract's test_webhook_test example.

@thebrandonlucas
thebrandonlucas added this pull request to stack #89 October 22, 2026 19:42
@thebrandonlucas
thebrandonlucas marked this pull request as ready for review October 22, 2026 19:43
@thebrandonlucas
thebrandonlucas force-pushed the feat/cli-webhook-test-default branch from 286c6b2 to 26ace56 Compare October 22, 2026 20:33
@thebrandonlucas
thebrandonlucas force-pushed the feat/cli-webhook-test-default branch from 26ace56 to 1612d08 Compare October 22, 2026 21:14

@tee8z tee8z 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.

Approved 1612d08 against feat/cli-list-all-hint (#94 30481de). The patch matches 26ace56, and only the CHANGELOG context changed in the rebase.

  • --data still wins: api_invocation matches DataFlags { data: Some(_) } as BodySource::Raw before it asks friendly_flags, so the default body applies only without --data.
  • The body matches the contract: TestWebhookRequest { delivery_id, payload }, with payload as {type: "test", detail: TestPayload { event: "created", data }}. Each call gets a new delivery_id.
  • The test for the "requires --data" error moves to payments check, which still needs a body, so that error path is still covered.

Validation: on 26ace56, the same patch, cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo machete --with-metadata, cargo test --locked (141 unit, 123 integration, on a rerun without load) and python3 scripts/check-coverage.py passed. CRAP measured 632 functions with none at or above 20. The highest was wait_for_payment at 19.95; its coverage varies with timing between runs, and this PR does not touch it. I did not run the gate locally on this head. CI is green.

@thebrandonlucas
thebrandonlucas merged commit 8dfa4ee into master Oct 22, 2026
8 of 14 checks passed
@thebrandonlucas
thebrandonlucas deleted the feat/cli-webhook-test-default branch October 22, 2026 21:53
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.

webhooks test: requires --data but never says what payload to send

2 participants