Correlate browser e2e /run logs via X-Test-ID - #317
Merged
Merged
Conversation
Visual tests never sent Playwright's test id, so aggregator attachments used a random control uuid and were empty when /run hung. API tests already send testId in the body; control logged the header/uuid instead when those differed. Prefer JSON testId over X-Test-ID (Firefox fetch breaks if the page sets extra headers). Browser tests inject the id with addInitScript and attach aggregator logs in finally, including failed waits. Co-authored-by: Max Schmitt <max@schmitt.mx>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Reproduce the visual e2e hang: JSON Playwright testId plus a different X-Test-ID, no workers available. Aggregator must store control logs under the body id, not the header. Co-authored-by: Max Schmitt <max@schmitt.mx>
Clients send Playwright's test id on the request header, not in JSON. Control overwrites the worker payload from that header (or the request uuid). runCode sets X-Test-ID on the fetch; do not use extra page headers. Co-authored-by: Max Schmitt <max@schmitt.mx>
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.
Why
CI visual e2e flakes (Turnstile / Firefox
/runhangs) had empty aggregator attachments. The aggregator keys logs bytestId. Browser tests never sent Playwright’s test id, so control stored logs under a uuid the report did not look up — and if/runnever returned, attachment never ran.This PR does not change who mints
requestId. Client-facingtestIdis onlyX-Test-ID. Control copies that onto the worker job JSON. Do not usepage.setExtraHTTPHeaders(Firefox then failsfetch('/service/control/run')).Who invents the IDs
requestId— unchangedControl always does
uuid.New()inhandleRunand overwritesreq.RequestID. IncomingX-Request-IDand JSONrequestIdare ignored.testId— before vs afterpayload.testIdafter/runreturned; a hang attached nothingtest.info().testIdviaaddInitScript→X-Test-IDon therunCodefetch. Attach infinally. Init script is on thepagefixture (all visual tests, not onlyexecuteExample)testIdPlaywright’s
testIdis not auuid.New()string. Control’s fallback is.JSON
testIdon the/runbody is ignored. It remains on the AMQP worker payload after control copies the header.Code
control-service:testID = X-Test-IDelse request uuid; overwritereq.TestIDfrontend/src/utils.ts:runCodesetsX-Test-IDwhenwindow.__TRY_PLAYWRIGHT_TEST_ID__is set (production never sets it)e2e/tests/logAggregator.ts:installE2ETestId+attachAggregatorLogspagefixture; attach infinallyX-Test-IDonlyTest plan
go test ./control-service/TestHandleRunPostsAggregatorLogsUnderHeaderTestID: POST/runwithX-Test-ID=pw-idand JSONtestId=from-body, no workers (10s hang). Asserts 503, responsetestIdispw-id, aggregator has control lines underpw-id, andfrom-bodyis empty.Validation
No k3s here. The httptest is the hung
/runcase. Passed locally (go test ./control-service/).