Skip to content

cold-store-reaper(test): suite takes 162s for 80 tests — every test pays ~1.5s of fresh-manifest schema creation in setUp #1435

Closed

Description

@dezren39

Finding

The cold-store-reaper test suite takes 162 s for 80 tests, and the cost is not the tests — it is per-test setup: every test creates a fresh cold-store home, and creating the manifest schema costs ~1.3–1.7 s each time.

Verified this run (main 37418e56, sandbox VM):

  • python3 -m unittest discover -s pkgs/cold-store-reaper/tests → Ran 80 tests in 162.238s (OK, 1 skipped).
  • Per-test timing: slowest single test 6.2 s, only 13 of 80 under 2 s, test bodies near-instant (e.g. test_auth_url_shape body: 0.01 s; its setUp: 1.51 s).
  • Isolation: ColdStore(home).init() on a fresh home = 1.67 s; second init() on the same home = 0.01 s. cProfile of a fresh init(): 1.30 s total, of which 1.295 s is a single call — sqlite3.Connection.executescript inside ColdStore.db() (cold_store.py:369), running schema.sql to create the manifest.
  • Every test class derives from ColdStoreTestBase.setUp (tests/test_cold_store.py:232), which builds a brand-new TemporaryDirectory home and calls store.init() — so the suite pays the fresh-schema cost ~80 times (plus stacked fake Drive/S3/D1 servers in subclasses). The turso-export and drill tests pay it again per test through their own fixtures.

The absolute executescript cost varies with filesystem fsync speed (this VM is slow; a fast CI disk will be quicker), but the structure — full schema creation per test instead of once per suite — dominates the runtime anywhere and grows linearly with the test count.

Why it matters

A 2–3 minute suite is a suite people stop running locally — which compounds #1427 (no CI runs these tests at all): the package's only safety net is both unwired and slow. It also slows every future CI wiring: a path-filtered workflow (per #1427) that takes ~3 minutes for one small package will pressure people to skip it. Backup-integrity code deserves a suite that runs in seconds.

Acceptance criteria

  • The suite's wall-clock drops by at least ~5x on this VM (162 s → under ~35 s) with all 80 tests still passing and none deleted or weakened.
  • Fresh-schema creation happens once per suite/run (e.g. a template manifest built once and copied per test, or an equivalent shared fixture), while each test still gets an isolated manifest it can mutate freely.
  • Tests that specifically exercise first-run schema creation/migrations (fresh-home init, pre-v4 manifest migration) keep a genuinely fresh home — they are the exception, not the default fixture.
  • The measurement is repeated and recorded on the PR (before/after wall-clock for the full discover run).

Activity

  1. added
    kind/testTest coverage, test infrastructure, or test-only fixes
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 27, 2026
  2. developing-today commented on Oct 27, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    Filed this run by the new-issue-creator (lane A). Measured on main 37418e56: full discover run 162.238s for 80 tests; per-test timing shows bodies near-instant and setUp dominant (test_auth_url_shape: setUp 1.51s, body 0.01s); cProfile of a fresh ColdStore.init() puts 1.295s of 1.30s in the single executescript call in ColdStore.db() (cold_store.py:369). Companion to #1427 (no CI runs the suite).

    • Session / ID: cron new-issue-creator-code-a run 2026-10-27 10:05 CDT
    • Found via: filed this run
    • Task: filed the issue; queued a triage packet for routing
    • Expectation: effort/m — done when the suite runs ≥5x faster via once-per-suite schema creation, with fresh-home tests (init/migrations) keeping real fresh homes
    • Links: packet enqueued to repo-health-code-pilot this run
  4. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  5. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 27, 2026
  6. 18 remaining items

  7. added
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/needs-reviewQueue task finished and is awaiting review
    on Oct 31, 2026
  8. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  9. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 1, 2026
  10. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    agent-note:v1

    event: picked_up
    task_id: 1492
    queue: repo-health-code-pilot
    worker: repo-worker-code (lane D)
    stage: verified
    pr: https://github.com/developing-today/code/pull/3254
    note: >
      Resume: run 41253284293 now COMPLETE — python: unittest suites PASS and
      worker: local proof PASS on head 091224592, so the park's resume
      condition is met. PR mergeable_state=clean, 0 review threads. Fresh
      Codex re-review requested; merging once it lands clean (or quota-fails
      with zero findings, per the prior park note).
  11. added a commit that references this issue on Nov 1, 2026
  12. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    agent-note:v1

    event: done
    task_id: 1492
    queue: repo-health-code-pilot
    worker: repo-worker-code (lane D)
    stage: bookkeeping_complete
    pr: https://github.com/developing-today/code/pull/3254
    merge_sha: 7abf085055c51fa03c71ce9d749eff7b09988260
    note: >
      PR 3254 MERGED and #1435 closed. Run 41253284293 completed green
      (python: unittest suites PASS, worker: local proof PASS) and the fresh
      Codex re-review on head 091224592 reported "Didn't find any major
      issues" — 0 review threads. Task completed fixed_merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/cold-store-reaperPackage/app: cold-store-reaper (pkgs/ or apps/ in this repo)kind/testTest coverage, test infrastructure, or test-only fixespriority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions