go-test-fixture-expensive-per-test-builder
Wrote the verified solution to:
~/go-test-fixture-expensive-per-test-builder.md
Summary of what it contains:
NewIntegrationPool did DROP/CREATE SCHEMA + full migrations on every call (16 sites; 10 in one repo test file). Schema build cost is constant per test and dominates runtime; tests only needed empty-table isolation, not a fresh schema.NewIntegrationPool name/signature (zero call-site churn) but:sync.Once.TRUNCATE TABLE ... RESTART IDENTITY CASCADE before each test, excluding migration bookkeeping tables.resetMu (released in t.Cleanup) so existing t.Parallel() tests stay correct.1, -count=5 -shuffle=on isolation run, -race concurrency check, sentinel leak test, and grep checks proving all 16 call sites remain.>8 concurrent subprocess or subprocess-per-assertion issues; only the expensive per-test builder was present and is fixed.I also ran gofmt -e over the embedded Go snippets — the full helper file and all complete test snippets parse cleanly (the one remaining block is an intentional fragment).
# Evidence - Problem class: go-test-fixture-expensive-per-test-builder - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-20T07:46:18.571Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Load-hygiene audit pattern: suite rebuilt a migrated PG schema per test via helper (NewIntegrationPool x16 call sites; worst: 10 repo tests in one file). Fix = session-shared migrated pool fixture with truncate-before-each-test, preserving empty-schema isolation; measured focused run 72.3s -> 40.8s. Audit classes: >8 concurrent subprocess spawns (none), subprocess-per-assertion (none), expensive builder per test (fixed).", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "go-test-fixture-expensive-per-test-builder", "provider": "openrouter", "solved_at": "2026-09-20T07:46:18.572Z", "version": ""}Wrote the verified solution to:
~/go-test-fixture-expensive-per-test-builder.md
Summary of what it contains:
NewIntegrationPool did DROP/CREATE SCHEMA + full migrations on every call (16 sites; 10 in one repo test file). Schema build cost is constant per test and dominates runtime; tests only needed empty-table isolation, not a fresh schema.NewIntegrationPool name/signature (zero call-site churn) but:sync.Once.TRUNCATE TABLE ... RESTART IDENTITY CASCADE before each test, excluding migration bookkeeping tables.resetMu (released in t.Cleanup) so existing t.Parallel() tests stay correct.1, -count=5 -shuffle=on isolation run, -race concurrency check, sentinel leak test, and grep checks proving all 16 call sites remain.>8 concurrent subprocess or subprocess-per-assertion issues; only the expensive per-test builder was present and is fixed.I also ran gofmt -e over the embedded Go snippets — the full helper file and all complete test snippets parse cleanly (the one remaining block is an intentional fragment).
# Evidence - Problem class: go-test-fixture-expensive-per-test-builder - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-20T07:46:18.571Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Load-hygiene audit pattern: suite rebuilt a migrated PG schema per test via helper (NewIntegrationPool x16 call sites; worst: 10 repo tests in one file). Fix = session-shared migrated pool fixture with truncate-before-each-test, preserving empty-schema isolation; measured focused run 72.3s -> 40.8s. Audit classes: >8 concurrent subprocess spawns (none), subprocess-per-assertion (none), expensive builder per test (fixed).", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "go-test-fixture-expensive-per-test-builder", "provider": "openrouter", "solved_at": "2026-09-20T07:46:18.572Z", "version": ""}