The three `*.audit.test.ts` files from #195 are real PostgreSQL regressions,
but each one guards itself with a `skip` when its fixture URL is absent, so a
CI run without a database reported them as skipped and still exited 0.
Add a `Database Audit Tests` job that starts a disposable PostgreSQL 16
service, sets `TEST_INGEST_DATABASE_URL` and `TEST_BACKFILL_DATABASE_URL`,
and runs exactly the three files one at a time. Every file's TAP stream is
piped through `backend/scripts/assert-audit-tests-ran.mjs`, which fails the
job when any test is skipped, failed, cancelled or missing, so a dropped
service or an unset variable can no longer turn the audit into a green no-op.
Plain PostgreSQL is deliberate: the audit-high fixture refuses a database
where the timescaledb extension is installed, because the extension's own
`timescaledb_experimental.policies` view trips its stray-table guard. The job
therefore exercises the plain-PostgreSQL branch of `installChunkCatalog`,
which the fixture explicitly supports.
The job prints the server version it reached (host/port/database only, never
the fixture password) and keeps the TAP output as an artifact on failure.
Depends on #195 for the test files themselves; the job fails with an
explicit `::error` naming #195 while they are absent rather than passing.
The analysis integration test leaked its admin pg client whenever fixture
setup threw before the dynamic import of ../db/index.js: the finally block
referenced a block-scoped `pool` and raised ReferenceError, so `admin.end()`
never ran and node:test's failure was followed by an event loop that never
drained. CI reported the 25 ms error and then idled until GitHub's six-hour
job timeout.
- runState.integration.test.ts: provision the analytics/ops namespaces the
code under test actually qualifies (the fixture used a private schema, so
the test could never pass), register teardown with t.after before the first
statement, and bound the admin connection/statement/query timeouts.
- scripts/run-analysis-integration.mjs: preflight the database URL with a
bounded probe and a hard 120 s watchdog, exiting non-zero with an
actionable message when the dependency is absent, unreachable or wedged.
- ci.yml: job-level timeout-minutes: 45 and a 5-minute timeout on the step.
- runAnalysisIntegration.test.ts: pin the fail-fast contract.
Co-authored-by: Hermes Agent <hermes@localhost>