The first suite for pg-agent-store.ts: the class exercised
(7 tests) through a recording fake of the createQueenPool seam,
snapshotted-and-restored with the repo's proven queen-roadmap
pattern (the real module copied before the mock and re-installed
in afterAll - measured: without the restore the shared CI process
shows 55 failures in the later queen, task-queue and vault
suites). Pinned: the not-connected refusal, the one-pool lifecycle,
the upsert ON CONFLICT statement with its JSON metadata params, the
heartbeat touch-count answer, the offline/delete statements, the
row-to-card mapping with the online filter in the WHERE clause, the
matrix view read and the prune id answer. No database, no network,
no container; the subject is untouched.
Closes #1658
Closes #1658
What changed
One new file:
trios/agent-server/apps/server/tests/api/pg-agent-store.test.ts(the path the issue's Success Criteria names). The subjectpg-agent-store.tsis untouched.The single exported class is exercised (7
it(blocks) through a recording fake of thecreateQueenPoolseam - the pool interface the store uses (query, end, on):PgAgentStore not connected; connect builds exactly one pool for the DSN (a second connect is a no-op); disconnect ends it and further queries are refused.ON CONFLICT (id) DO UPDATEwith the card fields and the JSON metadata params; the heartbeat's touch-count answer (true on rowCount 1, false on 0); the offline UPDATE and the DELETE with their params; the row-to-card mapping with the online filter measured in the WHERE clause (and its absence forlistAgents(false)); the matrix view read and the prune answering the ids it took offline with the interval in the SQL.The mock is process-global in bun's shared CI process, so it is wrapped in the repo's proven snapshot-and-restore pattern from
queen-roadmap.test.ts: the real module is copied to a plain object BEFORE the mock and re-installed inafterAll. Measured: without the restore, the fulltests/apirun shows 55 failures in the later queen-roadmap, task-queue and vault suites; with it, the run is back to the 8 pre-existing local vault failures (missingageCLI on this machine - CI installs it). No database, no network, no container.How it was verified (FR-004)
7 pass / 0 fail / 23 expect() calls, Ran 7 tests across 1 file.4 failout of 7, quoted raw above. The subject was restored byte-identical (git checkout) and the suite passes again.tests/apione-process run with this suite is 2150 tests / 8 fail - identical to the baseline failure set (the local vault/age failures), proving the snapshot-and-restore contains the mock. The file isbiome ci-clean and contributes no typecheck error (local monorepo typecheck: base set, 0 mentions of the new file).Not verified
Tests / server-apijob re-runs the suite on this SHA.Dmitrii Fedorov (@dmitrii-f-t27)