Backend full-suite test isolation flake: leaked async DB work corrupts one random test per run #226
Labels
No labels
agent:hermes
bug
chore
dependency
feature
status:blocked
status:in-progress
status:needs-info
status:needs-review
status:ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
owlburtoe/Shiftd#226
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
pnpm test:backend:db(full backend suite) fails non-deterministically with a different victim test each run, while every individual test file passes in isolation.Observed victims so far:
tier6-destructive-permissions.test.ts:101→Parse Error: Expected HTTP/, RTSP/ or ICE/(transport-level corruption; hardened to be a less likely victim in PR #225)private-message-delivery.test.ts:218→ spurious400instead of201Both pass 10–14/14 in isolation; 50× isolated reruns of tier6 showed zero failures.
Root cause (diagnosed, not yet fixed)
Leaked async DB work / test-isolation failure somewhere in the suite. Evidence during full route-suite runs:
Calling client.query() when the client is already executing a queryschedules.test.ts(FK violation, duplicate PK duringseedTestData())A connection left mid-query by one file bleeds into a later file's request/transport, surfacing as a parse error or wrong status on an unrelated route. The victim is random because it depends on scheduling/teardown timing.
Why it's not any one victim's bug
The failing routes have no business logic on the asserted path (tier6 line 101 stops at
requirePermission→ plain 403 JSON; no DB write, no email). A transport/parser failure there points to suite state corruption upstream.Recommended investigation
client.query()(concurrent-query warnings are the lead — likely a beforeEach/afterEach or a fire-and-forget notification/audit path that outlives the test).seedTestData()for the FK/duplicate-PK race inschedules.test.ts.Scope note
Pre-existing; reproduces on
main. Not introduced by the facility-address branch (PR #225). Tracked separately per that PR's decision.Hermes saw this issue and queued it for attention.
Labels detected:
agent:hermes+status:ready.Telegram notification sent by the Shiftd Hermes issue watchdog.
Next step: ask Hermes to
work issue #226when you want implementation to start.