Repository navigation
test(harness): the Deno suite is not flaky — it is 132 failures from one broken magic link - #710
Merged
Merged
Conversation
…one broken magic link **#478 says the suite moves by about ±2 run to run. It does not.** Three consecutive runs against the same database, no changes between them: 205 passed | 185 failed (51s) 205 passed | 185 failed (46s) 205 passed | 185 failed (48s) and the sets of failing test *names* are byte-identical across all three — zero in run 1 not in run 3, zero in run 3 not in run 1. Whatever produced the ±2 in March is gone; determinism is not what is wrong with this suite now. What is wrong is that 132 of the 185 are one root cause wearing 132 costumes: 101x Auth setup is incomplete. Run auth.test.ts first. 31x Failed to get or create auth token Following it down: those suites call requireAuthSetup(), which reads tests/fixtures/tokens.json, which only auth.test.ts writes — and auth.test.ts fails first, so the file does not exist on a fresh checkout. It fails because the magic link it is sent is unparseable: TypeError: Invalid URL: 'env%28EXPO_PUBLIC_URL%29/auth/confirm?token_hash=...' config.toml:52 sets `site_url = "env(EXPO_PUBLIC_URL)"`, and the CLI never substituted it — the running container has `GOTRUE_SITE_URL=env(EXPO_PUBLIC_URL)` literally. `pnpm supa` loads .env via dotenv, and EXPO_PUBLIC_URL is defined only in .env.template. So every magic link GoTrue mints is built on a placeholder, and the whole suite falls over behind it. Three fixes here, in increasing order of how much they matter: **The credentials did not match the seed.** TEST_USERS.regular said 'testpassword123'; seeds/002a creates [email protected] with 'test123456'. Measured against the running stack: the seeded password returns 200 from /auth/v1/token, the constant here returned 400. Aligned to the seed, which is the source of truth for local users. Worth 15 tests on its own — 185 failures to 170. **TEST_USERS.admin was never created by anything.** No [email protected] in auth.users at all. New seed 002b, mirroring 002a. Deliberately an ordinary confirmed user rather than an elevated one: the suites use it as a *second distinct identity* — office.test.ts guards on `tokens.admin.token !== tokens.regular.token` — not for platform privileges. If some test does need elevation it will now fail on authorization, which is a true failure about the thing under test rather than a setup cascade. **The placeholder now announces itself.** completeMagicLinkAuth() checks for a literal `env(` before `new URL()` and explains exactly what is unset and that the stack must be restarted, instead of throwing a TypeError that reappears 132 times as "Auth setup is incomplete". The suite still cannot pass here, because this stack is running with the bad site_url and restarting it is not mine to do. But the next person gets one sentence naming the cause instead of 132 failures pointing at unrelated code. Also #680: a smoke that cannot reach the dev server now exits 97, not 1. The Expo dev server OOMs partway through a back-to-back smoke run; everything after fails with ERR_CONNECTION_REFUSED and reported as an assertion failure. One observed run reported three failures that were all the dead server — and all three passed individually against a fresh one. A gate that fails for environmental reasons is worse than no gate, because the natural response, re-run and see, is exactly how a real failure gets waved through. scripts/audit/lib/dev-server.mjs adds a preflight and a finish() that every smoke now exits through. A preflight alone would not be enough — the server dies *during* the run and the scripts tally page errors internally — so finish() re-checks the server at the moment it is about to report failure, and turns "the app is broken" into "the harness lost its server, exit 97". Verified against a dead port: exit code 97, and the output says nothing was asserted. This is the honest half of #680. The growth itself is not diagnosed here. Refs #478 Refs #680 Co-Authored-By: Claude Opus 5 <[email protected]>
playwright.config.ts recorded, as the reason not to add the office specs, that
ApplicationsKanbanBoard "renders no testID, data-testid or nativeID at all".
It does. Traced end to end:
StatusColumn <DroppableColumn id={status}>
DroppableColumn <KanbanColumn id={id}>
@scaffald/ui testID={`kanban-column-${id}`}
react-native-web domProps['data-testid'] = testID
(createDOMProps/index.js:836)
kanban-helpers.ts tries three selectors, and only the first two — [data-column]
and [data-status] — miss. The third, getByTestId(`kanban-column-${column}`),
resolves. The ids line up as well: KANBAN_COLUMNS is
new/screen/interview/offer/hired/rejected, every one of them in the board's
STATUSES. And test-office-jobs-kanban.spec.ts already selects
[data-testid="kanban-column-${status}"] directly against the same component.
Left as a comment rather than acted on, because what remains is not a code fix
but a verified green run, and that needs the full local stack — Supabase, the
api function, a warm dev server, seeded users past onboarding. Adding the spec
without that is still a known-unknown selection, which is the thing this file
warns against.
`npx playwright test --list` plans 103 tests across 10 files, up from the 100
in 9 the issue recorded — #574's setup fix now resolves.
Refs #553
Co-Authored-By: Claude Opus 5 <[email protected]>
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.
#478's premise does not reproduce
The issue says the suite moves by about ±2 run to run. Three consecutive runs against the same database, nothing changed between them:
The sets of failing test names are byte-identical across all three — zero in run 1 that are not in run 3, zero in run 3 that are not in run 1. Whatever produced the ±2 in March is gone. Determinism is not what is wrong with this suite now.
What is wrong: 132 failures are one cause
Following it down:
requireAuthSetup(), which readstests/fixtures/tokens.json.auth.test.tswrites that file — a whole suite hinging on a file produced by one test.auth.test.tsfails before it gets there, so the file does not exist on a fresh checkout.config.toml:52setssite_url = "env(EXPO_PUBLIC_URL)"and the CLI never substituted it. The running container has it literally:pnpm supaloads.envthrough dotenv (env-local→dotenv -e .env), andEXPO_PUBLIC_URLis defined only in.env.template. So every magic link GoTrue mints is built on a placeholder, and the suite falls over behind it.Three fixes, in increasing order of how much they matter
The credentials did not match the seed
TEST_USERS.regularsaidtestpassword123.seeds/002a_seed-api-test-user.sqlcreates[email protected]withtest123456. Measured against the running stack:/auth/v1/token[email protected]/test123456(seeded)[email protected]/testpassword123(constant)Aligned to the seed, which is the source of truth for local users. Worth 15 tests on its own: 185 → 170.
TEST_USERS.adminwas never created by anythingNo
[email protected]inauth.usersat all. New seed002b, mirroring002a.Deliberately an ordinary confirmed user, not an elevated one: the suites use this identity as a second distinct user —
office.test.tsguards ontokens.admin.token !== tokens.regular.token— rather than for platform privileges. If some test does need elevation it will now fail on authorization, which is a true failure about the thing under test instead of vanishing into a setup cascade.The placeholder now announces itself
completeMagicLinkAuth()checks for a literalenv(beforenew URL()and prints what is unset, where to set it, and that the stack must be restarted — instead of aTypeErrorthat reappears 132 times wearing a different name.What this does not do
The suite still cannot pass here, because this stack is running with the bad
site_urland restarting someone else's stack is not mine to do. The value is that the next person gets one sentence naming the cause rather than 132 failures pointing at unrelated code.Also unfixed, and worth its own issue: cleanup leaks. 16 orphaned
ccpa-test-*/deadline-test-*users are sitting inauth.usersfrom previous runs, socleanupCurrentTestData's wall-clock window is not catching everything it creates.#680: a smoke that loses its server no longer reports as an app failure
The Expo dev server OOMs partway through a back-to-back smoke run; everything after fails with
ERR_CONNECTION_REFUSEDand exits 1 — indistinguishable from a real assertion failure. One observed run reported three failures that were all the dead server, and all three passed individually against a fresh one.That is worse than having no gate: the natural response — re-run and see — is exactly how a real failure gets waved through.
scripts/audit/lib/dev-server.mjsadds a preflight plus afinish()that all seven smokes now exit through. A preflight alone is not enough, because the server dies during the run and the scripts tally page errors internally — sofinish()re-checks the server at the moment it is about to report failure and converts it toEXIT_INFRA(97).Verified against a dead port:
This is the honest half of #680 — its first acceptance box. The growth itself is not diagnosed here; the second box stays open.
Refs #478
Refs #680