Skip to content

[WPB-22549] Add curl to integration test failure reports.#5048

Open
fisx wants to merge 16 commits intodevelopfrom
WPB-22549-add-curl-to-integration-test-failure-reports
Open

[WPB-22549] Add curl to integration test failure reports.#5048
fisx wants to merge 16 commits intodevelopfrom
WPB-22549-add-curl-to-integration-test-failure-reports

Conversation

@fisx
Copy link
Contributor

@fisx fisx commented Feb 19, 2026

example

upside: every test failure report comes with a script how to reproduce in curl.
downside: test failure reports make even more noise now.

TODO:

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Feb 19, 2026
@fisx fisx force-pushed the WPB-22549-add-curl-to-integration-test-failure-reports branch from 62b06f2 to 870c8ee Compare February 27, 2026 12:51
@fisx fisx marked this pull request as ready for review February 27, 2026 13:42
@fisx fisx requested review from a team as code owners February 27, 2026 13:42
@battermann battermann requested a review from Copilot March 2, 2026 08:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds curl command traces to integration test failure reports, making it easier to reproduce failing test scenarios. When a test fails, the full HTTP traffic is now shown in curl "pseudo-syntax" so developers can reproduce the exact API calls. This feature is opt-in via the WIRE_INTEGRATION_TEST_VERBOSITY=1 environment variable.

Changes:

  • Adds a curlTrace IORef [String] field to Env, initialized fresh per-test in mkEnv
  • Records each HTTP request (and its response summary) in curlTrace inside submit in Testlib/HTTP.hs
  • Displays the curl trace in all three failure handlers (AssertionFailure, AppFailure, generic SomeException) when WIRE_INTEGRATION_TEST_VERBOSITY=1 is set

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
integration/test/Testlib/Types.hs Adds curlTrace field to Env; adds/modifies requestToCurl and dataBinary helpers; adds DeriveGeneric pragma and imports
integration/test/Testlib/HTTP.hs Modifies submit to record each request + response into curlTrace
integration/test/Testlib/Env.hs Initializes curlTrace IORef in mkEnv
integration/test/Testlib/Assertions.hs Adds renderCurlTrace and calls it in all failure detail printers; adds GHC.IORef and System.Posix.Env imports
integration/test/Testlib/Run.hs Passes env to failure handler functions
postgres-schema.sql Schema changes to meetings and conversation tables (appears unrelated to PR)
cassandra-schema.cql Adds history_depth column (appears unrelated to PR)
changelog.d/5-internal/WPB-22549-add-curl-to-integration-test-failure-reports Changelog entry for the new feature

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

Copy link
Contributor

@battermann battermann left a comment

Choose a reason for hiding this comment

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

Just one comment. Also there seem to be some valid comments from copilot.

status = HTTP.statusCode (HTTP.responseStatus response)
headers = HTTP.responseHeaders response
curl <- asks (.curlTrace)
_ <- liftIO $ modifyIORef' curl (<> [requestToCurl request, "# ==> " <> show (status, body, headers), ""])
Copy link
Contributor

Choose a reason for hiding this comment

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

should we maybe guard for the WIRE_INTEGRATION_TEST_VERBOSITY flag here already before modifying the curlTrace. to safe some resource?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fisx and others added 7 commits March 2, 2026 12:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@fisx
Copy link
Contributor Author

fisx commented Mar 2, 2026

I get this now when I add some failing request with body '"\ to some test:

HTTP trace in curl pseudo-syntax:
curl -X 'POST' 'http://127.0.0.1:8082/i/users' -H 'Content-Type: application/json' -H 'Z-Connection: conn' -H 'Z-User: example.com' --data-binary '{"email":"yV7OKh8f@example.com","icon":"default","name":"yV7OKh8f@example.com","password":"hunter2.","team":{"icon":"default","name":"integration test team"}}'
# ==> (201,"{\"accent_id\":0,\"assets\":[],\"email\":\"yV7OKh8f@example.com\",\"id\":\"585efd2b-693c-4392-b8cf-4ae2a98ef29e\",\"locale\":\"en\",\"managed_by\":\"wire\",\"name\":\"yV7OKh8f@example.com\",\"picture\":[],\"qualified_id\":{\"domain\":\"example.com\",\"id\":\"585efd2b-693c-4392-b8cf-4ae2a98ef29e\"},\"searchable\":true,\"status\":\"active\",\"supported_protocols\":[\"proteus\"],\"team\":\"a240c154-4630-4f7d-aacc-ceabbf727e4d\",\"type\":\"regular\"}",[("Transfer-Encoding","chunked"),("Date","Mon, 02 Mar 2026 11:35:59 GMT"),("Server","Warp/3.4.12"),("traceparent","00-d3ce7c22d6555e801e9ef4176f695584-a9042e6f22a27ae0-01"),("tracestate",""),("Content-Encoding","gzip"),("Content-Type","application/json;charset=utf-8"),("Location","585efd2b-693c-4392-b8cf-4ae2a98ef29e"),("Vary","Accept-Encoding")])

[...]

curl -X 'POST' 'http://127.0.0.1:8082/v15/teams/a240c154-4630-4f7d-aacc-ceabbf727e4d/apps' -H 'Content-Type: application/json' -H 'Z-Connection: conn' -H 'Z-User: 585efd2b-693c-4392-b8cf-4ae2a98ef29e' --data-binary '{"app":{"accent_id":null,"assets":null,"category":"notinenum","description":"some description of this app","metadata":{},"name":"chappie","picture":null},"password":"hunter2."}'
# ==> (400,"{\"code\":400,\"label\":\"bad-request\",\"message\":\"Error in $.app.category: Unexpected value for enum Category\"}",[("Transfer-Encoding","chunked"),("Date","Mon, 02 Mar 2026 11:36:00 GMT"),("Server","Warp/3.4.12"),("traceparent","00-3e0ce9a25f22a721a8f85903bccba4f6-80ff59990be07d22-01"),("tracestate",""),("Content-Encoding","gzip"),("Content-Type","application/json;charset=utf-8"),("Vary","Accept-Encoding")])

curl -X 'POST' 'http://127.0.0.1:8085/v15/egal' -H 'Content-Type: application/json' -H 'Z-Connection: conn' -H 'Z-User: 585efd2b-693c-4392-b8cf-4ae2a98ef29e' --data-binary "$(printf %s 'JyJc' | base64 -d)"
# ==> (404,"{\"code\":404,\"label\":\"no-endpoint\",\"message\":\"The requested endpoint does not exist\"}",[("Transfer-Encoding","chunked"),("Date","Mon, 02 Mar 2026 11:36:00 GMT"),("Server","Warp/3.4.12"),("traceparent","00-623256f2de67ecd2e55a5b9b2332b617-47a0a146bf318b68-01"),("tracestate",""),("Content-Encoding","gzip"),("Content-Type","application/json"),("Vary","Accept-Encoding")])

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

postgres-schema.sql:20

  • The changes to postgres-schema.sql (new recurrence_frequency ENUM type, meetings table schema updates with NOT NULL constraints and CHECK constraints, reordering of constraints, history_depth bigint column added to conversation) and cassandra-schema.cql (history_depth bigint added to conversation) do not appear to relate to the PR description "Add curl to integration test failure reports." These schema changes include updates that look like they were bundled together from a different branch or feature. It's worth verifying whether these schema changes are intentional and belong here.
-- Dumped from database version 17.7
-- Dumped by pg_dump version 17.7

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;

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

fisx and others added 3 commits March 2, 2026 17:08
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants