Repository navigation
test(ci): assert status codes and response shape for the remaining /webhook/* routes - #176
Merged
OkiriGabriel merged 1 commit intoNov 21, 2026
Conversation
Extend the integration job's response checks from /webhook/manual to github, gitlab, bitbucket, alertmanager and grafana. Each route covers a queued event, an ignored event (or alert dedup for alertmanager) and invalid JSON -> 400. A shared helper step keeps each check short and prints the status and body on failure. Part of open-devops-agent#18
OkiriGabriel
approved these changes
Nov 21, 2026
OkiriGabriel
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @OpeyemiAdeniji, this covers every /webhook/* route, including the negative paths (draft PR, unsupported events, invalid JSON) and the Alertmanager dedupe from #147 (the second delivery must be duplicate_of the first incident). The post/expect helpers keep each check to two lines. When step 3 (fail closed) lands, the server step will need WEBHOOK_SECRET and these requests will need signing, as you planned in step 2. Approving.
OkiriGabriel
approved these changes
Nov 21, 2026
12 of 35 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #107, which asserted responses for
/webhook/manualonly. This extends the integration job to the other/webhook/*routes:github,gitlab,bitbucket,alertmanagerandgrafana.A new "Define Webhook Test Helpers" step writes two small shell functions to
$RUNNER_TEMP/webhook_helpers.sh:post(sends the request, captures status and body) andexpect(asserts the status code and ajqcondition, and on mismatch prints both and exits non-zero). Each route step sources it, so every check is two lines.What each route asserts:
workflow_run→ 200 queued,type == "cicd"; openedpull_request→ 200 queued,type == "code_review"; draft PR → 200 ignored,reason == "draft_pr";push→ 200 ignored,event == "push"; invalid JSON → 400JSON object requiredcicd; opened MR → 200 queued,code_review; successful pipeline → 200 ignored; invalid JSON → 400pullrequest:created→ 200 queued,code_review;repo:push→ 200 ignored,reason == "unsupported_event"; invalid JSON → 400incident_idsentry; the same alert again → 200duplicatewithduplicate_ofequal to the first incident id ([BUG] Repeated Alertmanager/Grafana notifications create duplicate incidents and can re-apply fixes #124 dedup); invalid JSON → 400incident_idsentry; invalid JSON → 400"Queued" means
status == "queued"plus a non-empty stringincident_id(or a one-elementincident_idsfor the alert routes).Part of #18 (this completes the
/webhook/*assertion item; Black, Safety/Bandit and coverage are still open there)Type of Change
CI configuration change (none of the listed types fit).
Platform/Component
Testing
Unit tests added/updated
Integration tests pass
Manual testing performed
Tested with dummy data
Tested in production-like environment
Sent every payload used in the new steps to the real routes in-process with FastAPI's
TestClient, without thewithblock so the lifespan and queue worker never ran;STORAGE_PROVIDER=memory(also the default the CI server uses) andWEBHOOK_SECRETunset. All responses matched the assertions above, including the alertmanager duplicate.Parsed the workflow with
yaml.safe_load, ran the helper step for real to generate the helpers file, and ranbash -non each newrun:script.jqisn't installed on my machine, so locally thejqfilters were checked by hand against the captured responses.CI result on this PR: the Integration Test job passed, and its log shows all 17 new assertions (
✓ ...lines) passing against the live server, including the alertmanager duplicate check. The other checks pass as well.Did not re-run the full test suite locally: this is a workflow-only change.
Test Configuration
Checklist
Screenshots (if applicable)
N/A
Breaking Changes
None to the application. In CI, changes to the status codes or response shape of these routes will now fail the integration job. As with #107, the fail-closed webhook work in #64 will need to update these steps (e.g. send a signature) if it lands.
Additional Notes
/webhook/alertmanagerwith only resolved alerts returns{"status": "queued", "incident_ids": []}, which reads as queued when nothing was. I deliberately did not assert that case so this PR doesn't lock it in; happy to open a separate issue/PR if you agree it should be something like"ignored".Reviewer Checklist