- worker/worker.js exports PulseWorker and starts only when run directly
(no behaviour change for the service; CT 153 needs no redeploy).
- tests/worker.test.js: success, exit code and stderr, timeout kill,
capacity rejection, slot release after failure, ping/pong, no sends
while disconnected.
- jest coverage floors (ratchet at today's levels): lib/ 90% lines and
statements, 80% branches and functions; worker/ 40%.
- The audit job writes a CycloneDX SBOM of production dependencies and
keeps it 90 days for each main build.
Part of #45 phases 3 and 4.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
New required-to-be job `UI (playwright)` (#45 phase 5): the official
Playwright image with a MariaDB service container. scripts/ci/ui-stack.sh
starts the real server and three workers (WORKER_AUTH_ENFORCE=1), then
tests/ui/ runs 30 tests on desktop and a phone viewport:
- every page loads with no page errors, console errors or failed requests
(enforced by a shared fixture for every test)
- quick commands run on a worker and their output and status show in
Executions; multi-worker mode; failing commands show as failed
- workflows are created and run from the UI and complete on all workers
- Executions updates live over the authenticated browser WebSocket
- no SSO identity: 401 page and API; wrong group: 403
- every page fits a phone screen
External requests are blocked in tests so SSO headers never leave the
machine. Deploy now also waits for the UI job. The API and execution rate
limits can be raised with PULSE_API_RATE_MAX / PULSE_EXEC_RATE_MAX for
test stacks; production defaults are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The deploy job lived in lint.yml and needed only eslint, while jest and
npm audit ran in separate workflows. A merge that failed its tests still
deployed to production. (#45 phase 1)
- Combine everything into .gitea/workflows/ci.yml with jobs lint, test,
audit, deploy and notify. Deploy needs all three checks and runs only
on push to main.
- Builds are reproducible: npm ci everywhere, eslint from the lockfile
(new `npm run lint`), and setup-node pinned to Node 20 (production).
- Actions are pinned to full commit SHAs, with the version in a comment,
following tinker_tickets.
- Workflow permissions default to contents: read; only deploy can write
(for its tag). A deploy-production concurrency group queues deploys
instead of running two at once. Superseded branch runs are cancelled.
- The deploy payload now carries the sha and a timestamp, so signatures
differ per deploy (the server verifies them in phase 2). After the
webhook, CI waits until Pulse is serving again before tagging.
- The Matrix alert now fires for any failed job on main, for the weekly
audit, and for every successful deploy.
- New lint step: fail on em or en dashes in Pulse-owned files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Fix design-system class names that do not exist in base.css (.lt-alert--error,
.lt-form-hint); add shared .lt-modal-lg, .lt-field-error and .is-invalid rules
- Remove public/index.html and the public/base.js symlink
- package.json: start script, correct main
- README: vendored design system, Web UI section, new env vars, read-only dev mode
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HamVMDrA8RqhyxmUHgiqRp
- lint.yml: add notify-failure Matrix alert job; add Tag deployed commit
step to deploy job with deploy-YYYY.MM.DD-N tagging via Gitea API
- package.json: add --coverage flag to jest test script
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extract validateWebhookUrl, applyParams, evalCondition, calculateNextRun
to lib/utils.js so they can be tested without DB connection
- Fix cron-parser v5 API: parseExpression → CronExpressionParser.parse
- Add 31 jest tests covering all four utility functions
- Add test.yml CI workflow running jest on every push/PR
- Add jest devDependency
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rate limiting: 300 req/15min general, 20 req/min on POST /api/executions
- Cron schedule type support using cron-parser for full cron expressions
- Webhook notifications: POST to workflow webhook_url on execution complete/failed
- Dry-run mode: simulate workflow execution without running any commands
- Global execution timeout via EXECUTION_MAX_MINUTES env var (default 60min)
- Execution filtering: status, workflow_id, started_by, after, before, search
- Event-driven command result delivery (replaces 500ms DB polling)
- Atomic log appends via JSON_ARRAY_APPEND (no read-modify-write race)
- Separate browserClients/workerClients sets (workers no longer receive broadcasts)
- Stale execution cleanup on startup (mark running→failed after crash)
- Scheduler overlap prevention (skip if same workflow already running)
- Frontend: webhook_url field in create/edit workflow modals
- Frontend: dry-run checkbox in workflow param modal
- Frontend: ESC closes modals, ws.onerror handler added
- Frontend: selectedExecutions changed from Array to Set (O(1) ops)
- Frontend: XSS fixes via escapeHtml() on all user-controlled innerHTML
- Frontend: param modal keydown listener deduplication fix
- Remove unused npm packages (bcryptjs, body-parser, cors, js-yaml, jsonwebtoken)
- Add express-rate-limit and cron-parser dependencies
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>