Integration tests for the Gandalf contract, auth and reliability; fix worker offline status
CI / Lint (eslint) (push) Successful in 46s
CI / Security (npm audit) (push) Successful in 26s
CI / Integration (api) (push) Successful in 1m31s
CI / Test (jest) (pull_request) Successful in 50s
CI / UI (playwright) (push) Successful in 2m31s
CI / Integration (api) (pull_request) Successful in 1m58s
CI / Test (jest) (push) Successful in 13s
CI / Deploy (push) Skipped
CI / Notify (push) Skipped
CI / UI (playwright) (pull_request) Successful in 2m16s
CI / Lint (eslint) (pull_request) Successful in 15s
CI / Security (npm audit) (pull_request) Successful in 15s
CI / Deploy (pull_request) Skipped
CI / Notify (pull_request) Skipped

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>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-22 14:14:28 -05:00
1 parent 1d5b8cdd53
commit def926d41e
11 files changed
+391 -21

No files matched your search

+29 -14
View File
@@ -1,6 +1,6 @@
name: CI
# One pipeline: lint, test, audit and the UI tests must all pass before main deploys (#45).
# One pipeline: lint, unit tests, audit, integration and UI tests must all pass before main deploys (#45).
# Actions are pinned to full commit SHAs (version in the trailing comment).
on:
@@ -63,6 +63,30 @@ jobs:
- name: Audit production and dev dependencies
run: npm audit --audit-level=high
integration:
name: Integration (api)
runs-on: ubuntu-latest
container: node:20-bookworm # the server and workers on production's Node
env:
DB_HOST: 127.0.0.1
DB_PORT: '3306'
DB_NAME: pulse
DB_USER: pulse
DB_PASSWORD: ci-only # throwaway database inside the job container
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Install dependencies (lockfile only)
run: npm ci
- name: Start MariaDB
run: scripts/ci/mariadb.sh
- name: Start Pulse with three workers
run: scripts/ci/ui-stack.sh start
- name: Run integration tests (Gandalf contract, auth, reliability)
run: npm run test:integration -- --ci
- name: Server and worker logs
if: always()
run: tail -n 200 .ui-stack/*.log || true
ui:
name: UI (playwright)
runs-on: ubuntu-latest
@@ -80,16 +104,7 @@ jobs:
- name: Install dependencies (lockfile only)
run: npm ci
- name: Start MariaDB
# Inside the job container: the runner puts jobs on Docker's default bridge
# network, where service containers can't be reached by name.
run: |
apt-get update -qq
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends mariadb-server >/dev/null
mkdir -p /run/mysqld && chown mysql:mysql /run/mysqld
(mariadbd --user=mysql --bind-address=127.0.0.1 --port=3306 >/tmp/mariadb.log 2>&1 &)
for i in $(seq 1 30); do mariadb-admin ping --silent && break; sleep 1; done
mariadb -e "CREATE DATABASE pulse; CREATE USER 'pulse'@'127.0.0.1' IDENTIFIED BY 'ci-only'; GRANT ALL ON pulse.* TO 'pulse'@'127.0.0.1'"
echo "node $(node --version), $(mariadb --version)"
run: scripts/ci/mariadb.sh
- name: Start Pulse with three workers
run: scripts/ci/ui-stack.sh start
- name: Run Playwright (desktop and mobile)
@@ -110,7 +125,7 @@ jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [lint, test, audit, ui]
needs: [lint, test, audit, integration, ui]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# Never run two deploys at once; queue instead of cancelling a deploy mid-way.
concurrency:
@@ -169,7 +184,7 @@ jobs:
notify:
name: Notify
runs-on: ubuntu-latest
needs: [lint, test, audit, ui, deploy]
needs: [lint, test, audit, integration, ui, deploy]
# Alert on any failure on main or in the weekly audit, and on every deploy outcome.
if: >-
always() && (
@@ -183,7 +198,7 @@ jobs:
REPO: ${{ github.repository }}
BRANCH: ${{ github.ref_name }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
RESULTS: "lint=${{ needs.lint.result }} test=${{ needs.test.result }} audit=${{ needs.audit.result }} ui=${{ needs.ui.result }} deploy=${{ needs.deploy.result }}"
RESULTS: "lint=${{ needs.lint.result }} test=${{ needs.test.result }} audit=${{ needs.audit.result }} integration=${{ needs.integration.result }} ui=${{ needs.ui.result }} deploy=${{ needs.deploy.result }}"
DEPLOYED: ${{ needs.deploy.result == 'success' }}
run: |
if [ -z "$MATRIX_WEBHOOK_URL" ] || [ "$MATRIX_WEBHOOK_URL" = "CONFIGURE_ME" ]; then exit 0; fi