Pin LIVE_PARTS_SQL expiry clause and harden audit integration suite (#88) #39

Merged
backmeupplz merged 3 commits from fix/88-live-parts-expiry-tests into main 2026-10-12 18:18:32 +00:00
backmeupplz commented 2026-10-12 17:57:59 +00:00 (Migrated from github.com)

Agentboard #88 (follow-up from #84 / PR #36 review nits).

Changes

  1. Expiry clause pinned. New integration test: expired reports that maintain() must keep (an intent and a sending report whose leases outlive expires_at) hold 3 unsent parts, yet LIVE_PARTS_SQL counts 0 and capacity 2 admits two new intents and then refuses a third. Removing o.expires_at>statement_timestamp() fails this test (and only this test).
  2. Integration suite stable under load.
    • Per-test budget 60s (100k-row test 180s) instead of Bun's 5s default.
    • Every audit, pool and pg client a test opens is registered and closed in beforeEach, so a timed-out test (whose finally never runs) cannot leave a running worker or open transaction behind.
    • Fixture resets tables in production lock order (sink row first, then TRUNCATE) and before initialize(), so a straggler can't deadlock the reset and rows from an aborted run can't push index creation past the 1s statement timeout. Test pools use lock_timeout 10s so a lock wait fails instead of hanging.
  3. Retention growth alert (optional item). summary() now includes retained (total retained reports); the index logs a content-free deletion_audit_retention_high warning on each health tick while it exceeds RETAINED_REPORTS_ALERT = 100,000 (the tested scale).

Verification (local, Postgres 14, host load 37–58)

  • bun run typecheck clean; bun run check with both test DBs: 519 pass / 0 fail.
  • Audit integration suite: 24/24 pass under load (it failed 7/23 on main under the same load: 100k test timed out, its open transaction then blocked/deadlocked the following tests).
  • Mutation: expiry clause removed → the new test fails.
  • Cascade probe (temporary test that times out holding the sink row with a worker running): with this change only the probe fails; with the beforeEach cleanup disabled, 16 following tests fail.

Review

Independent Opus review at 42ed722 found 2 should-fix issues plus 1 nit, all fixed in 8af8907:

  • the cleanup beforeEach now has an explicit 60s budget (Bun's 5s hook default could cut cleanup short);
  • the reset also clears deletion_audit_outbox on a 004-only schema, so 005 can't copy leftover rows;
  • the docs claim is softened.

Re-review at 8af8907: CLEAN. CI is green at 8af8907.

Agentboard #88 (follow-up from #84 / PR #36 review nits). ## Changes 1. **Expiry clause pinned.** New integration test: expired reports that `maintain()` must keep (an `intent` and a `sending` report whose leases outlive `expires_at`) hold 3 unsent parts, yet `LIVE_PARTS_SQL` counts 0 and capacity 2 admits two new intents and then refuses a third. Removing `o.expires_at>statement_timestamp()` fails this test (and only this test). 2. **Integration suite stable under load.** - Per-test budget 60s (100k-row test 180s) instead of Bun's 5s default. - Every audit, pool and pg client a test opens is registered and closed in `beforeEach`, so a timed-out test (whose `finally` never runs) cannot leave a running worker or open transaction behind. - Fixture resets tables in production lock order (sink row first, then TRUNCATE) and before `initialize()`, so a straggler can't deadlock the reset and rows from an aborted run can't push index creation past the 1s statement timeout. Test pools use `lock_timeout` 10s so a lock wait fails instead of hanging. 3. **Retention growth alert (optional item).** `summary()` now includes `retained` (total retained reports); the index logs a content-free `deletion_audit_retention_high` warning on each health tick while it exceeds `RETAINED_REPORTS_ALERT` = 100,000 (the tested scale). ## Verification (local, Postgres 14, host load 37–58) - `bun run typecheck` clean; `bun run check` with both test DBs: 519 pass / 0 fail. - Audit integration suite: 24/24 pass under load (it failed 7/23 on main under the same load: 100k test timed out, its open transaction then blocked/deadlocked the following tests). - Mutation: expiry clause removed → the new test fails. - Cascade probe (temporary test that times out holding the sink row with a worker running): with this change only the probe fails; with the `beforeEach` cleanup disabled, 16 following tests fail. ## Review Independent Opus review at 42ed722 found 2 should-fix issues plus 1 nit, all fixed in 8af8907: - the cleanup `beforeEach` now has an explicit 60s budget (Bun's 5s hook default could cut cleanup short); - the reset also clears `deletion_audit_outbox` on a 004-only schema, so 005 can't copy leftover rows; - the docs claim is softened. Re-review at 8af8907: **CLEAN**. CI is green at 8af8907.
Sign in to join this conversation.
No description provided.