Repository navigation
feat(exchange): flag an exchange whose accept outcome is unknown - #497
Conversation
|
@coderabbitai review |
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 24 minutes for your next included review. View limit details
Comment |
|
Independent review verdict: CLEAN at b230869 (part 1 of 2 for #443)Reviewer: fresh Claude agent (Sonnet, high effort), not the author, cold brief, focused on the money path. The PR body was treated as a claim. Coordinator: claude-cc-reviewer. Blocking findings: none. The flag (
Consumers that still treat an unknown outcome as a plain failure, which part 2 must fix:
What was attacked and how (pkg,
Gate: p2. Merge once CI is green, in its turn in the go merge order. |
When the accept response is lost, ErrOutcomeUnknown means the exchange may have executed. RunAutoExchange kept the ledger record processing and halted the run, but the outcome in Failed carried only an error string, so a reader could not tell it from an ordinary failure. Add ExchangeOutcome.OutcomeUnknown, set where ErrOutcomeUnknown is handled. The outcome stays in Failed, so existing readers of Failed still see it. Behavior is otherwise unchanged. The manual approve and interactive paths call ExecuteExchange from the platform and cannot receive this flag from pkg; they are tracked in LeanerCloud/cloud-commitments-platform#1050. Refs #443 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b230869 to
790c2ba
Compare
Summary
Part 1 of 2 for #443. When an RI exchange accept returns an ambiguous result (
common.ErrOutcomeUnknown, from the single-shot accept added in #299), the exchange may already have executed.RunAutoExchangehalted the run and left the reservation record processing, but the outcome reached consumers indistinguishable from a definite failure.pkg/exchange/auto.go:ExchangeOutcome.OutcomeUnknown bool, documented: the accept result was ambiguous, the exchange may have executed, reconcile before any retry, the outcome stays inAutoExchangeResult.Failed, and it halts the run.ErrOutcomeUnknownbranch. No other behavior changes.Why a flag instead of a separate
Unknownbucket: consumers that only readFailed(the platform's scheduled email, the ladder summary) keep seeing the outcome, including while their pkg pin lags. A new bucket would make it disappear for them.Additive, so it compiles under both
go.workand theGOWORK=offstandalone provider build.ExchangeOutcomehas no JSON tags and is not persisted; the scheduled task's result gains one key.Out of scope here:
providers/awspin and render "outcome unknown, reconcile before retrying" inproviders/aws/ladder/reshape.go.ExecuteExchangedirectly and get the wrapped error, so no pkg flag reaches them. They currently mark such an exchange failed and retryable; tracked in fix(ri-exchange): an unknown accept outcome is marked failed and retryable cloud-commitments-platform#1050, with a re-reserve guard.Refs #443
Tests
TestRunAutoExchange_OutcomeUnknownFlagdrivesRunAutoExchange:Executereturningfmt.Errorf("x: %w", common.ErrOutcomeUnknown): flag true, one outcome inFailed, no fail-ledger call,Executecalled once.Failed, one fail-ledger call.The existing
TestRunAutoExchange_UnknownAcceptLeavesRecordProcessingAndHaltskeeps covering the processing record and the halt.Mutation probe (scratch copy): deleting the
OutcomeUnknown = trueassignment fails the wrapped-error case. Reproduced independently by the reviewer.Verification
make build,make vet,(cd pkg && GOWORK=off go test -race -short ./exchange/...),(cd providers/aws && GOWORK=off go build ./...), pinned golangci-lint v2.10.1 onpkg(0 issues), gofmt, and the commit/pre-push hooks pass. Unit-level evidence only.Local review: the plan had two adversarial passes by a non-author reviewer (which found the platform manual-path gap, now platform#1050); the diff had two more by the same reviewer, no actionable findings.
🤖 Generated with Claude Code