fix(e2e): kill dev server trees and stop teardown hook timeouts - #423
Conversation
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Disabled knowledge base sources:
📝 WalkthroughWalkthroughThe end-to-end development-server cleanup now discovers and terminates the full process tree, escalates from SIGTERM to SIGKILL, and waits for cleanup on early exits. Fixture cleanup hooks use 60-second timeouts. Users-list teardown deletes tracked users concurrently before removing temporary configuration. Estimated code review effort: 4 (Complex) | ~45 minutes Suggested reviewers: Comment |
Summary
Two teardown bugs have been failing E2E runs on
main. Cleanup hooks ran on bun's 5s default timeout while each test-user delete shells out to a coldbun src/cli.tsand hits BAPI, which regularly takes longer than that with eight files running in parallel — so a test that had already passed got failed by its own cleanup. Cleanup hooks now get a 60s timeout, andusers-listdeletes its users concurrently.That flake then became a guaranteed failure because
killDevServersignalled only the spawnednpxwrapper. npm forwards SIGTERM and exits, so the harness logged "dev server stopped" while the real dev server was reparented to init, still holding its port and dev lockfile; the retry reused the same project dir and died with "Another dev server is already running".killDevServernow snapshots the full process tree before signalling — descendants become unreachable fromproc.pidonce the wrapper exits — SIGTERMs it, and escalates to SIGKILL for anything that outlasts the grace period, comparing command lines to guard against pid reuse. Tree liveness replacesproc.exitedas the stopping condition, which also fixes a hang when an orphan holds the inherited stdio pipes.Test plan
format:check,lint,typecheck,test(2618 pass, 0 fail)nextjs-pages-router+users-listagainst the live API: 5 pass, 0 fail, no dev-server processes left behind