fix: align windows lifecycle test with server layout#1592
Conversation
Reviewer noteThis PR is one of six small, independent PRs opened from the same triage pass. They can be reviewed and merged independently:
Focus for this PR: repair Review surface: test-only plus supporting plan/spec. No brainstorm server runtime files are changed. Verification: before the fix the lifecycle test failed on current Risk to check: whether the updated owner-PID assertions correctly reflect current behavior: invalid owner PID at startup survives with |
|
The drifts you identified were real and worth fixing. We landed a smaller targeted repair on
Verified locally on macOS: 9 passed, 0 failed, 3 skipped (the Windows-only tests). Closing this PR; thanks for surfacing the drift. — Claude Opus 4.7, Claude Code 2.1.150 |
What problem are you trying to solve?
While verifying the brainstorm visual companion tests on current
dev, I found thattests/brainstorm-server/windows-lifecycle.test.shis no longer testing the current brainstorm server. It has drifted behind three implementation changes:server.jstoserver.cjs, but the lifecycle test still runsnode .../server.js, which fails withMODULE_NOT_FOUND.state/(state/server-info,state/server.pid), but the lifecycle test still waits for.server-infoand writes.server.pidat the session root.owner-pid-invalid, disables owner monitoring, and keeps the server running. The lifecycle test still expected that case to self-terminate after 60 seconds.On current
dev, before this fix, runningbash tests/brainstorm-server/windows-lifecycle.test.shon macOS produced:After fixing only the entrypoint and state paths, the same test got past startup but exposed the stale owner-PID assertion:
What does this PR change?
This PR updates
windows-lifecycle.test.shto launchserver.cjs, readstate/server-info, writestate/server.pidfor the stop test, and assert the current owner-PID behavior.It preserves the existing runtime code. The test now checks both sides of owner monitoring: dead-at-startup owner PIDs are logged as invalid and do not kill the server immediately, while a live owner process that exits after startup still causes lifecycle shutdown and logs
owner process exited.Is this change appropriate for the core library?
Yes. This is a core test-harness repair for the brainstorm visual companion server. It does not add dependencies, alter runtime behavior, introduce a new harness, or add project-specific configuration. It restores coverage for existing cross-platform lifecycle behavior.
What alternatives did you consider?
I considered only changing
server.jstoserver.cjs, but that still left the test failing because the server no longer writes.server-infoat the session root.I considered only updating paths and changing the dead-at-startup PID expectation to "server survives", but that would remove the control that verifies owner monitoring still shuts down when a valid owner exits. Instead, this PR keeps both cases: invalid owner at startup survives, valid owner that exits shuts down.
I did not add a
server.jscompatibility wrapper because the accepted fix for the ESM/CommonJS issue was to useserver.cjsdirectly.Does this PR contain multiple unrelated changes?
No. All changes are in one test script plus the supporting spec/plan, and all address one problem:
windows-lifecycle.test.shhad stale assumptions about the current brainstorm server entrypoint, state layout, and owner-PID semantics.Existing PRs
PR #784 is related prior art for the
server.js->server.cjsrename. It was closed because the commit was cherry-picked todev; this PR updates the lifecycle test that still referenced the old filename.PR #879 is related prior art for owner-PID behavior. The current
devbehavior supersedes the test's old assumption: invalid owner PIDs at startup are logged asowner-pid-invalidand monitoring is disabled, while valid owner-exit still shuts the server down.I also searched for open/closed PRs matching
windows lifecycle owner-pid server-infoandbrainstorm server state/server-info windows-lifecycle; no duplicate PRs were found.Environment tested
New harness support (required if this PR adds a new harness)
Not applicable. This PR does not add support for a new harness.
Clean-session transcript for "Let's make a react todo list"
Evaluation
devrevealedwindows-lifecycle.test.shfailed before exercising current lifecycle behavior.bash tests/brainstorm-server/windows-lifecycle.test.shproduced0 passed, 3 failed, 3 skippedbecause the test launched missingserver.js.6 passed, 2 failed, 3 skipped, showing the remaining stale owner-PID assertion.11 passed, 0 failed, 3 skippedon macOS.Verification run locally:
Rigor
superpowers:writing-skillsand completed adversarial pressure testing (paste results below)This is not a skills change. The first checkbox is intentionally not checked.
The test now covers both owner-PID branches instead of only the old happy path:
Human review