Story: Shared test database rerun safety
Table of Contents
This page documents a story in Sprint 25. It captures the goal, current status, acceptance criteria, and the tasks that compose it.
1. Goal
Every ctest and CDash Experimental cycle is rerunnable without manual database surgery, even after an earlier fixture-writing run aborted mid-run.
2. Status
| Field | Value |
|---|---|
| State | DONE |
| Parent sprint | Sprint 25 |
| Now | Nothing. |
| Waiting on | Nothing. |
| Next | Nothing. |
| Last touched | 2026-09-04 |
3. Acceptance
- An aborted fixture-writing run leaves no residue that poisons the next run: ctest and CDash Experimental cycles are rerunnable with no manual database surgery, verified by an abort-then-rerun reproduction. Done 2026-09-04: SIGKILL reproduction plus ctest 71/71 and a CDash Experimental submission green with no manual cleanup between runs.
- The mechanism keys on the synthetic markers (change_reason_code system.test, the test DML user), honours the bitemporal close semantics, and never touches rows a real user created. Done 2026-09-04: pre-run sweep keys on the markers and rides the ON DELETE DO INSTEAD rules; seed rows carry system.initial_load and the DDL user, so they are untouched.
4. Tasks
| Task | State | Start | End | Description |
|---|---|---|---|---|
| Close the test-db rerun-safety gap | DONE | 2026-09-04 | 2026-09-04 | An aborted ores.iam.core.tests run leaves OPEN bitemporal rows in the shared per-worktree test database that poison the next run with duplicate-key failures; the gap needs a root-cause write-up and a suite-level or harness-level fix. |
5. Decisions
- 2026-09-04: chose a harness-level pre-run sweep over failure-safe
teardown for rerun safety. Teardown cannot run when a process is
SIGKILLed and the fixture suites have no teardown today, so only a
sweep covers the hard-abort case. The sweep keys on the synthetic
markers (
change_reason_code = 'system.test', the test DML user asperformed_by), scopes to the system tenant and OPEN rows, and issues a plain DELETE so each table's existingON DELETE DO INSTEADrule performs the bitemporal close — no new DDL, no new close semantics, idempotent. The statement lives intest_database_manager, the invocation indatabase_lifecycle_listenerattestRunStarting, and the registering binary names the tables it writes into the shared tenant. Only tables whose residue can collide are registered: a collision needs a unique key that is deterministic across runs, which holds only for the faker-named tenant_types and tenant_statuses rows of the iam repository tests.
6. Out of scope
- Changes to ctest parallelism policy (CTEST_MAX_PARALLELISM): the rerun-safety failure mode is leftover open rows, not parallelism.
- Altering the bitemporal schema or the ON DELETE DO INSTEAD close semantics of the shared database.
- Reconciling the quarantined codegen regeneration byproducts (stash entry ad0c738b9a): that is the regen-byproduct-hygiene memory's concern, not this story's.