The job runs the real server and three workers on Node 20 (production's version) against MariaDB. It then tests them as a black box over HTTP and WebSocket: 20 tests, about 12 s. I used this instead of the app-factory refactor I'd planned: it tests what Gandalf and the workers actually talk to, with no changes to server.js.
Suite
Checks
gandalf.int.js
Gandalf's exact submit and poll flow (monitor.pyrun_command). A completed command's stdout comes from command_result. A failed one keeps its exit code and stderr. A wrong or missing key gets 401 on both endpoints. Missing fields or an unknown worker get 400; an unknown execution gets 404
auth.int.js
SSO identity, the 401 and 403 cases, the heartbeat key, and that /healthz exposes only status. The WebSocket upgrade is refused with no credentials, a wrong key or a wrong group. A signed-in browser gets live events, and a browser socket can't forge a command result
reliability.int.js
A worker killed mid-command fails the execution at once. A worker at capacity answers with a failure. An aborted execution stays failed when the late result arrives. A disconnected worker shows offline
Tests that need to kill or limit a worker start their own, and delete it afterwards.
A disconnected worker was never marked offline: it showed "online" until the stale-heartbeat sweep. The close handler deleted the worker's runtime-id entry first, then checked whether the socket was still live under its database id. Those ids are normally the same key, so the check always failed. The fix decides whether the socket is live before unmapping anything. Without the fix, all 4 reliability tests fail; with it, they pass.
Gandalf wasn't affected, because /api/internal/command checks live sockets, not the database status.
Other
scripts/ci/mariadb.sh now handles the in-container MariaDB setup for both the integration and UI jobs.
Deploy waits for all five checks.
README: a new "Integration tests" section.
Verification (local)
Lint has 0 errors; jest unit 67/67; integration 20/20; Playwright 30/30.
I ran integration then UI on the same stack to confirm the integration tests clean up after themselves.
After merge, I'll add CI / Integration (api) (push) to the required checks.
Part of #45 (phase 3).
## New CI job: `Integration (api)`
The job runs the real server and three workers on **Node 20** (production's version) against MariaDB. It then tests them as a black box over HTTP and WebSocket: 20 tests, about 12 s. I used this instead of the app-factory refactor I'd planned: it tests what Gandalf and the workers actually talk to, with no changes to `server.js`.
| Suite | Checks |
|---|---|
| `gandalf.int.js` | Gandalf's exact submit and poll flow (`monitor.py` `run_command`). A completed command's stdout comes from `command_result`. A failed one keeps its exit code and stderr. A wrong or missing key gets 401 on both endpoints. Missing fields or an unknown worker get 400; an unknown execution gets 404 |
| `auth.int.js` | SSO identity, the 401 and 403 cases, the heartbeat key, and that `/healthz` exposes only status. The WebSocket upgrade is refused with no credentials, a wrong key or a wrong group. A signed-in browser gets live events, and **a browser socket can't forge a command result** |
| `reliability.int.js` | A worker killed mid-command fails the execution at once. A worker at capacity answers with a failure. An aborted execution stays failed when the late result arrives. A disconnected worker shows offline |
Tests that need to kill or limit a worker start their own, and delete it afterwards.
## Bug found and fixed (from #42)
A disconnected worker was **never marked offline**: it showed "online" until the stale-heartbeat sweep. The close handler deleted the worker's runtime-id entry first, then checked whether the socket was still live under its database id. Those ids are normally the same key, so the check always failed. The fix decides whether the socket is live before unmapping anything. Without the fix, all 4 reliability tests fail; with it, they pass.
Gandalf wasn't affected, because `/api/internal/command` checks live sockets, not the database status.
## Other
- `scripts/ci/mariadb.sh` now handles the in-container MariaDB setup for both the integration and UI jobs.
- Deploy waits for all five checks.
- README: a new "Integration tests" section.
## Verification (local)
- Lint has 0 errors; jest unit 67/67; integration 20/20; Playwright 30/30.
- I ran integration then UI on the same stack to confirm the integration tests clean up after themselves.
After merge, I'll add `CI / Integration (api) (push)` to the required checks.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
New CI job `Integration (api)` (#45 phase 3) runs the real server and three
workers on Node 20 against MariaDB and tests them as a black box over HTTP
and WebSocket (20 tests, about 12 s):
- Gandalf contract: submit and poll, stdout from command_result, failures
with exit code and stderr, 401 for wrong or missing key, 400 for missing
fields or an unknown worker, 404 for an unknown execution
- Auth: SSO identity, 401/403, heartbeat key, /healthz exposes only status;
WebSocket upgrade refused without credentials, with a wrong key or a wrong
group; live events reach a signed-in browser; a browser socket cannot
forge a command result
- Reliability: a worker killed mid-command fails the execution at once; a
worker at capacity answers with a failure; an aborted execution stays
failed when the late result arrives; a disconnected worker shows offline
The last test found a bug from #42: the close handler deleted the worker's
runtime-id entry before checking whether the socket was still live under its
database id, and the two ids are normally the same key. So a disconnected
worker was never marked offline and showed 'online' until the stale
heartbeat sweep. Gandalf was unaffected (it checks live sockets).
MariaDB setup for CI moves to scripts/ci/mariadb.sh, shared by both jobs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jared
merged commit 4f32bd1363 into main2026-11-22 14:21:47 -05:00
jared
deleted branch ci-integration2026-11-22 14:21:50 -05:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part of #45 (phase 3).
New CI job:
Integration (api)The job runs the real server and three workers on Node 20 (production's version) against MariaDB. It then tests them as a black box over HTTP and WebSocket: 20 tests, about 12 s. I used this instead of the app-factory refactor I'd planned: it tests what Gandalf and the workers actually talk to, with no changes to
server.js.gandalf.int.jsmonitor.pyrun_command). A completed command's stdout comes fromcommand_result. A failed one keeps its exit code and stderr. A wrong or missing key gets 401 on both endpoints. Missing fields or an unknown worker get 400; an unknown execution gets 404auth.int.js/healthzexposes only status. The WebSocket upgrade is refused with no credentials, a wrong key or a wrong group. A signed-in browser gets live events, and a browser socket can't forge a command resultreliability.int.jsTests that need to kill or limit a worker start their own, and delete it afterwards.
Bug found and fixed (from #42)
A disconnected worker was never marked offline: it showed "online" until the stale-heartbeat sweep. The close handler deleted the worker's runtime-id entry first, then checked whether the socket was still live under its database id. Those ids are normally the same key, so the check always failed. The fix decides whether the socket is live before unmapping anything. Without the fix, all 4 reliability tests fail; with it, they pass.
Gandalf wasn't affected, because
/api/internal/commandchecks live sockets, not the database status.Other
scripts/ci/mariadb.shnow handles the in-container MariaDB setup for both the integration and UI jobs.Verification (local)
After merge, I'll add
CI / Integration (api) (push)to the required checks.🤖 Generated with Claude Code