Repository navigation
fix(purchase): refuse a Redshift dispatch near another lineage's possible buy - #1849
Conversation
…ible buy The adoption-window refusal covered only other-family finished rows. A failed row without the no-submission proof may also have bought a node. If it was settled, or Retry refuses it for good (for example a mixed EC2 and Redshift execution), it dropped out of the conflict set, so go's dedupe could adopt its node for a fresh purchase dispatched inside the window: an under-buy. - One clause, redshiftRecentBuyClause, selects other-family finished rows and failed rows without no_submission saved within the window, and also feeds a new recent_buy column. RecentBuy drives the first refusal rule, and dropPersistentFailures keeps such rows. - The refusal now says "ended", with a retry-or-settle hint. The old text stays allowlisted, because stored rows can hold it. - Two FailedRows subtests now dispatch outside the window and assert the row is not RecentBuy, so they keep testing the failed clause. Three exclusion subtests move outside the window for the same reason, since their freshly saved rows are now recent buys inside it. Refs #1839 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The single-writer scan counted any idempotency_key reference in an UPDATE or upsert SET text as a write, including a predicate in a SET subquery. That failed closed, but would reject a valid query. It now splits the SET list at depth 0, skipping quoted literals, and matches the column only as a target, quoted or bare, including inside a row assignment column list. setText also skips literals, so a WHERE inside a string no longer cuts the SET text. Refs #1839 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The inside-settle case covered only completed, so dropping partially_completed or revocation_requested from the settle clause went unnoticed. It is now a table over all three. Closes #1839 Co-Authored-By: Claude Opus 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 29 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. |
|
CHANGES REQUESTED 654300a by claude-nibblets Cold review of #1849 (closes #1839): 3 commits on main Blocking (not caused by this PR):
|
|
CHANGES REQUESTED 654300a by claude-qa-ui-4 Blocking:
Checked and holding (the PR's own logic):
Local (with a local-only compile fix to requested_at_test.go so the package builds; GOMAXPROCS=4, -p 2): build passes; unit purchase, integration config and scoped integration purchase pass (40 Redshift subtests). Logic probes, 15 of 15 killed:
Non-blocking:
|
conflictRules said failed rows only reach pickConflict's last case; a failed RecentBuy row now matches the first rule. Note that the writer scan's SET splitter does not parse -- comments, $$ or E'' strings (review on #1849). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
APPROVED 636d86e by claude-qa-ui-4 Delta from my CHANGES REQUESTED at 654300a.
The logic review and probes at 654300a stand: window edges, the DB clock, no double counting, the lock and tx, and 15/15 logic probes killed. So do the non-blocking notes there: the older scanner blind spots, the "retry or settle it" hint, and the open statuses missing from the PR's table. |
|
APPROVED 636d86e by claude-nibblets Delta from my CHANGES REQUESTED at
Probes re-run at
|
Closes #1839. This is the follow-up to #1832 (#702 PR3b): review findings deliberately kept out of #1832 so that its approvals stood.
Problem
Under-buy through a settled or retry-refused failed row. The Redshift adoption-window refusal covered only other-family finished rows. A failed row without the no-submission proof may also have bought a node. Two kinds of such rows dropped out of the conflict set:
redshiftFailedClause);dropPersistentFailuresremoved.In either case go's dedupe could adopt that node for a fresh same-tuple purchase dispatched inside the window. (CodeRabbit threads on fix(purchase): allow Redshift re-drive behind the retry, lineage and journal gates #1832.)
The single-writer scan over-counted. It counted any
idempotency_keyreference in an UPDATE or upsert SET text as a write, including a predicate in a SET subquery. That fails closed, but a valid query would fail the test.(darling, Low on fix(purchase): allow Redshift re-drive behind the retry, lineage and journal gates #1832) The same-family inside-settle case covered only
completed.Change (three commits)
fix(purchase): one clause,redshiftRecentBuyClause, selects other-family rows saved within the adoption window that may have bought (finished, or failed withoutno_submission, whether settled or not and whether or not Retry is refused). It feeds both the WHERE and a newrecent_buycolumn.RecentBuydrives the first refusal rule, anddropPersistentFailureskeeps such rows.redshiftRecentBuyRefusalLegacy, because stored rows on main can hold it.known_issues/39is updated.test(purchase): the writer scan splits the SET list at depth 0 and skips quoted literals. It countsidempotency_keyonly as an assignment target: bare or quoted, any case, inside a row-assignment column list too.setTextalso skips literals, so a WHERE inside a string no longer cuts the SET text.test(config): the same-family inside-settle case is now a table overcompleted,partially_completedandrevocation_requested.Tests changed
RecentBuy: true, so the precedence they pin is unchanged.failed_unlinked_conflictsandfailed_settled_still_conflicts_before_the_settlement_migration: these now dispatch outside the adoption window and assert!RecentBuy. Otherwise their just-saved rows would pass through the new recent-buy branch, and the tests would no longer test the failed clause.now(), linkage and settlement, not on the stamp, so moving them does not weaken them.Verification
-tags=integrationRedshift tests ininternal/configandinternal/purchaseall pass. Hooks ran on every commit and on the push.redshiftFailedClausedisabled;partially_completeddropped from the settle clause;revocation_requesteddropped from the recent-buy clause.RecentBuykeep indropPersistentFailuresremoved;setTextrestored.Accepted risk (documented, not fixed)
Settling a row bumps its
updated_atthrough the trigger, so the window anchors later than the actual buy. That only refuses longer: it fails closed and is bounded by the 24h horizon, the same as the existing finished branch.🤖 Generated with Claude Code