Repository navigation
fix(purchase): refuse two identical Redshift recs in one execution - #1895
Conversation
The go client adopts a node it already finds for the same offering and count, so the second of two identical-tuple recs bought nothing while both reported success. preExecutionRefusal now refuses the selection before submission with a fixed, allowlisted text. Closes #1809 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 31 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
APPROVE @ 67cea7c by claude-nibblets Cold review of #1895 (closes #1809, +163/-3, money path; 0 behind main): one execution that selects two Redshift recs with an identical tuple and account bought one node, because the go client adopts the node it finds for the same offering and count, so the second call reported success and bought nothing. Read: Scoped probes (go test -run RedshiftDuplicate|DuplicateTuple|ErrNote|ServerNote|PreExecution|Redshift|Sanitiz in internal/purchase, scratch worktree at this head, baseline ok), each killed: check not called (TestRedshiftDuplicateTuple_Detection, _RefusedBeforeSubmission, _UnscopedRecUsesTheExecutionAccount); account dropped from the key (TestExecuteAndFinalize_RedshiftFanOutAccountsShareRootStamp, _Detection, _UnscopedRecUsesTheExecutionAccount; my first version did not compile and was redone); count dropped from the key (_Detection); unselected recs counted (TestRedshiftDispatchGate_QueriesOnlySelectedRedshiftTuples, _Detection); execution-account fallback dropped (_UnscopedRecUsesTheExecutionAccount); allowlist entry dropped (TestSanitizeStoredError_AllowlistedNotesPassThroughVerbatim, _RedshiftGateRefusalsAreClosed); not a beforeSubmission error (_Detection, _RefusedBeforeSubmission). CI at this head: all 41 checks pass (Unit Tests, Lint Code, Integration Tests (purchase), CI Success); 1 skipping (CodeRabbit). |
Summary
One execution that selects two Redshift recs with an identical tuple (region, node type, term, payment, count) and account bought one node: the go client adopts the node found for the same offering and count, so the second call reported success and bought nothing.
preExecutionRefusalnow refuses such a selection before submission (no_submission) with a fixed, allowlisted text (redshiftDuplicateTupleRefusal). Count 1+1 versus a single count 2, different accounts, unselected recs and non-Redshift twins are not duplicates. A rec with no account of its own uses the execution account.Closes #1809
Verification
redshift_duplicate_tuple_test.goplus both sanitizer allowlist tests;go test ./internal/purchase/passes, golangci-lint 0 issues (none new vs base).known_issues/39_redshift_dedupe_window.mdupdated.A legacy parked plan row that already holds duplicates will now fail with no_submission; its plan then stalls like any other before-submission refusal (#1785).
🤖 Generated with Claude Code