Public: anyone can read this; the crew can change it.

An admin sends a webhook a test `ping` delivery through the API and MCP, and sees it among the deliveries #7943

Closed opened this
Closed without merging

An admin can now fire a test ping at one webhook through the API or the MCP, and it shows up among that hook's deliveries. I ran the ping tests, the MCP size test, test/contract.test.ts, test/api-hook-deliveries.test.ts, test/webhooks.test.ts, the gate script and tsc, and all passed.

Notes

stopped closed without shipping deploy 2fc70cc

opened this

An admin can now fire a test ping at one webhook through the API or the MCP, and it shows up among that hook's deliveries.

I ran the ping tests, the MCP size test, test/contract.test.ts, test/api-hook-deliveries.test.ts, test/webhooks.test.ts, the gate script and tsc, and all passed. scripts/fast.ts named 1394 of 1733 test files, so I ran only the ones close to this change. The forge's full check runs on the push.

  • Route: POST /api/v1/repos/:owner/:name/hooks/:id/ping answers 202 with { id }, the id of the new delivery. It uses the same admin scope and repo-admin gate as the deliveries route. A non-admin gets 404, a missing hook gets 404, and no credentials get 401.
  • MCP: the existing hooks tool gains the action ping with id, answering { id }. I added no new tool, so the MCP size ceilings are untouched.
  • Queue: pingWebhook in src/core/webhooks.ts writes a ping event and one delivery for that hook only, whatever kinds it subscribes to. It does not go through the event bus, so no other hook hears it. The request is made later by deliverDue, so the egress refusal applies. A private address shows as a failed delivery with its reason, and the request never makes a fetch of its own.
  • Body: the body is { kind, repo, hook, at }, sent as it stands and signed like every delivery. Other event kinds keep their existing envelope.
  • Rate limit: at most 3 pings per hook per minute, counted from the stored ping events. Past that the route answers 429 with retry-after, and MCP answers rate_limited.
  • Contract: the route is in the OpenAPI list.
  • Tests: test/hook-ping.test.ts covers the ping appearing in the API and MCP deliveries, delivery only to the pinged hook, a valid signature on a body of exactly those four keys, a failed delivery for a private address, the refusals above, and the rate limit.

I did not add a ping button to the hooks page, because the issue asks only for the API and MCP.

Closes #7872

commented

An admin can now fire a test ping at one webhook through the API or the MCP, and it shows up among that hook's deliveries.

I ran the ping tests, the MCP size test, test/contract.test.ts, test/api-hook-deliveries.test.ts, test/webhooks.test.ts, the gate script and tsc, and all passed. scripts/fast.ts named 1394 of 1733 test files, so I ran only the ones close to this change. The forge's full check runs on the push.

  • Route: POST /api/v1/repos/:owner/:name/hooks/:id/ping answers 202 with { id }, the id of the new delivery. It uses the same admin scope and repo-admin gate as the deliveries route. A non-admin gets 404, a missing hook gets 404, and no credentials get 401.
  • MCP: the existing hooks tool gains the action ping with id, answering { id }. I added no new tool, so the MCP size ceilings are untouched.
  • Queue: pingWebhook in src/core/webhooks.ts writes a ping event and one delivery for that hook only, whatever kinds it subscribes to. It does not go through the event bus, so no other hook hears it. The request is made later by deliverDue, so the egress refusal applies. A private address shows as a failed delivery with its reason, and the request never makes a fetch of its own.
  • Body: the body is { kind, repo, hook, at }, sent as it stands and signed like every delivery. Other event kinds keep their existing envelope.
  • Rate limit: at most 3 pings per hook per minute, counted from the stored ping events. Past that the route answers 429 with retry-after, and MCP answers rate_limited.
  • Contract: the route is in the OpenAPI list.
  • Tests: test/hook-ping.test.ts covers the ping appearing in the API and MCP deliveries, delivery only to the pinged hook, a valid signature on a body of exactly those four keys, a failed delivery for a private address, the refusals above, and the rate limit.

I did not add a ping button to the hooks page, because the issue asks only for the API and MCP.

commented

Declined: I can't reproduce the failure, and nothing in this pull touches the test that failed. I haven't pushed anything. Run log: https://forge.open-platform.sh/trevato/forge/runs/01m6czkwkg65th22dkp2j3nyk5

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs