Skip to content

Latest commit

 

History

History
91 lines (67 loc) · 4.03 KB

make_fixture_tracker.md

File metadata and controls

91 lines (67 loc) · 4.03 KB

make_fixture_tracker.sh

Revision: 2 Last modified: 2026-12-04T20:58:46Z

Overview

Builds a real workable-items tracker (SQLite) inside a throw-away consumer-shaped fixture project, for fastcycle tests that read <ROOT>/docs/workable_items.db.

The canon checkout ships no tracker DB, so the fastcycle suites that read one could not be genuinely exercised. This helper creates a fixture project whose DB is produced by the real engine (scripts/workable-items, built with go build) — no mocks (§11.4.289). Only the history timestamps are then rewritten with sqlite3, so the scenario is deterministic (the engine stamps "today"). The engine's own validate must still accept the resulting DB; the helper fails if it does not.

Prerequisites

  • go on PATH (builds the engine).
  • sqlite3 on PATH (seeds timestamps, reads the DB).

Both are the tests' required topology (§11.4.69). Their absence is reported by the caller as hardware_not_present, never as a failure.

Usage

# fresh mktemp fixture; prints exactly one line: the absolute DB path
DB="$(tests/lib/make_fixture_tracker.sh)"

# explicit fixture directory (must not exist, or must be empty)
tests/lib/make_fixture_tracker.sh /tmp/my-fixture/p

Run the suites through the fixture so their ROOT is the fixture (that is what makes docs/workable_items.db resolve):

bash <FIXTURE_DIR>/constitution/scripts/fastcycle/tests/test_select_sample_r5_regression.sh

The caller owns cleanup of <FIXTURE_DIR> (use a ${VAR:?}-guarded rm).

Edge cases

  • <FIXTURE_DIR> exists and is non-empty → exit 2.
  • go or sqlite3 missing → exit 2.
  • Engine build, add, close, or validate failure → exit 3.
  • The script prints the DB path on stdout only; all evidence goes to stderr.

Internal behaviour

  1. Symlinks <FIXTURE_DIR>/constitution → this checkout, so the tests resolve the canon through a consumer layout.
  2. Builds <FIXTURE_DIR>/bin/workable-items from scripts/workable-items.
  3. Seeds 17 items (ATM-601..607, 700, 951..958, 960) via add + close, each with its own evidence/<id>/ev.log, then rewrites on_date/created_at for a deterministic scenario.
  4. Seeds the bulk-import cluster: ATM-810..819 (Task), all closed on 2026-08-18 and sharing one evidence dirname evidence/bulk/, of which ATM-819 is additionally retroactive (Opened→closure gap 10 s). A cluster is identified by (dirname(evidence_path), closure on_date); ten distinct dirnames (as step 3 produces) give ten groups of size 1, so the cluster dimension would be unrepresentable.
  5. Seeds two Reopened rows: ATM-954 (2026-08-12, created_at on the same day) and ATM-956 (on_date 2026-08-10, created_at 2026-06-01 — a different day, and outside the later windows).
  6. Runs the engine's validate; exits 3 if it rejects the DB.

Steps 4 and 5 exist for the S13 real-data control needle (CON-583). S13 asserts that two sample-selection alternatives each change at least one outcome on this corpus:

Alternative Needs the corpus to carry Seeded by
retroactive before bulk (precedence) an item that is both bulk and retroactive step 4 (ATM-819)
reopened window keyed on created_at a Reopened row whose created_at day differs from its on_date day, positioned so window membership flips step 5 (ATM-956)

Both are seeded into the corpus rather than asserted away in the test, so S13 keeps its full strength.

Related scripts

  • tests/gates/test_fastcycle_real_db.sh — the gate that builds this fixture and asserts the fastcycle suites are genuinely exercised.
  • scripts/fastcycle/tests/test_select_sample_r5_regression.sh — S13's real-data oracle pass.
  • scripts/fastcycle/tests/test_reopen_rate_red.sh — the sibling suite; control needle #2.
  • scripts/workable-items/ — the real engine the fixture is built from.

Last verified date

2026-11-25 — bash tests/gates/test_fastcycle_real_db.sh → RESULT: PASS (items=27, history=56, 12 ok / 0 NOT ok).