feat(testutil): internal/testutil/ with 5 race-safe helpers (issue #161, race-flake hardening v2)#205
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🏆 CEO Audit — A+ (100.0/100)
📥 Download full report (Markdown)
|
🏆 CEO Audit — A+ (100.0/100)
📥 Download full report (Markdown) Run ID:
|
…, race-flake hardening v2)
What ships:
- cmd/sin-code/internal/testutil/testutil.go (175 LOC, stdlib-only)
- IsolatedSQLite(t) - t.TempDir() + modernc/sqlite, auto-close
- CleanEnv(t, kv) - set/restore env vars via t.Cleanup
- WithTimeout(t, d, fn) - context-bounded fn, 50ms grace
- GoroutineLeakCheck(t, fn) - stack-snapshot diff (best-effort)
- MustGo(t, fn) - synchronous go func, panic->t.Errorf
- testutil_test.go - 13 unit tests, all race-clean
- example_test.go - 6 composition examples (HTTP, env, ctx, leaks)
- testutil.doc.md - design doc, acceptance checkboxes, caveats
Diagnosis pass (informational):
- The slowest test in the affected packages is
TestGenerateIDUniqueness (todo) at 3.36s, well below the
5-minute acceptance threshold from issue #161.
- No per-test fixup is needed for this issue; the helpers are
the high-value reusable part for new tests.
Hard mandates honored:
- M2 (single binary, no CGO): stdlib only, modernc/sqlite is
already in go.sum (no new dep).
- M7 (race-free): 21/21 tests pass under go test -race -count=1
on three consecutive runs.
Refs: #161
Delqhi
force-pushed
the
feat/issue-161-race-flake-v2
branch
from
June 16, 2026 17:55
8f75d5e to
9d55de6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the second of the 5 issues on your list. Scope-bounded to the helpers + a diagnosis pass; per-test fixups are intentionally not in this PR (the slowest test in the affected packages is 3.36 s, well below the 5-minute acceptance threshold).
What ships
cmd/sin-code/internal/testutil/testutil.go(175 LOC, stdlib-only)IsolatedSQLite(t)— fresht.TempDir()+ modernc/sqlite, auto-closeCleanEnv(t, kv)— set/restore env vars viat.CleanupWithTimeout(t, d, fn)— context-bounded fn, 50ms graceGoroutineLeakCheck(t, fn)— stack-snapshot diff, best-effortMustGo(t, fn)— synchronousgo func(), panic→t.Errorftestutil_test.go— 13 unit tests, all race-cleanexample_test.go— 6 composition examples (HTTP, env, ctx, leaks)testutil.doc.md— design doc, acceptance checkboxes, caveatsDiagnosis pass (informational)
TestGenerateIDUniqueness(todo) at 3.36 sHard mandates honored
go.sum(no new dep)go test -race -count=1on three consecutive runsDiffstat
Closes