Repository navigation
test(config): fail instead of skipping when no pending execution exists - #984
Conversation
GetExecutionByID success depended on a value captured by the earlier GetPendingExecutions subtest and t.Skip'd when it was empty. If GetPendingExecutions regressed to return nothing, the dependent test skipped and the suite stayed green. GetPendingExecutions now requires a non-empty result and ID, and GetExecutionByID success saves its own execution so it no longer depends on subtest ordering. Also drop the redundant idx_purchase_executions_execution_id_unique DDL (A04-020). Its comment was wrong: migration 000008 already adds the unique_execution_id constraint that ON CONFLICT (execution_id) uses. Refs #202 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai review |
|
Warning Review limit reached
This review includes 1 billable file and costs up to $0.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 34 minutes for your next included review. View limit details
Comment |
|
Independent review verdict: CLEAN at 853bafeReviewer: fresh Claude agent (Sonnet, high effort), not the author, cold brief. The PR body was treated as a claim. Coordinator: claude-cc-reviewer. Blocking findings: none. Non-blocking notes:
The DDL removal is truly redundant:
What was attacked and how (local macOS, Docker Postgres via testcontainers):
Gate: labels are mirrored from #202. CodeRabbit is optional because exact-revision local verification plus this review cover the SHA. Merge waits on CI being green at this SHA. |
Summary
Part of #202: part 2 plus A04-020. Part 1 (the container-flake retry) stays open in #202, alongside the env-guarded skips noted there.
internal/config/store_postgres_db_test.gohad a false green.GetExecutionByID successreadgeneratedExecID, a variable thatGetPendingExecutionssets only insideif len(pending) > 0, and calledt.Skip("no execution ID available from prior test")when it was empty. IfGetPendingExecutionsregressed to return nothing, the dependent test skipped and the suite stayed green.GetPendingExecutionsnow callsrequire.NotEmptyon the result and onpending[0].ExecutionID.GetExecutionByID successsaves its own pending execution and then looks it up. The cross-subtestgeneratedExecIDvariable and thet.Skipare gone. The file now has not.Skip. The existing Docker-unavailable skip inRequirePostgresContaineris unchanged.idx_purchase_executions_execution_id_uniqueDDL and its inaccurate comment. Migration 000008 already addsunique_execution_id UNIQUE (execution_id), and no later migration drops it. The test DB runs the real migrations (migrations.RunMigrations). TheON CONFLICT (execution_id)upsert (store_postgres.go:1048) and its subtests pass without the extra index.This is a test-only change in one file, +13/-20.
Evidence
GetPendingExecutions's WHERE clause to match nothing now fails the test ("Should NOT be empty") instead of skipping.GetExecutionByID's WHERE clause toAND 1=0failsGetExecutionByID success.-race -shuffle=on -run TestPostgresStoreDB_PurchaseExecutions$passes all 9 subtests../internal/config/...with CI's flags (-race -tags=integration) passes with 0 failures and 622 results, in 904.7s on this change and 882.0s on its parent. The difference is noise. The package's roughly 15-minute runtime against CI's 20-minute timeout is pre-existing and tracked in ci: internal/config integration tests take ~15 min against a 20 min job timeout #982.go vet -tags integrationis clean. golangci-lint v2.10.1 reports 0 issues.Review
An independent non-author ran two passes and found no blocking findings at 853bafe.
Non-blocking:
GetPendingExecutionsstill relies on earlier subtests having saved pending rows. Shuffle reorders only top-level tests, and the test now fails loudly if those rows are missing.🤖 Generated with Claude Code