fix(cli): use purchaseSucceeded in the interrupt summary and run stats by cristim · Pull Request #2253 · LeanerCloud/cloud-commitments-cli · GitHub
Skip to content

fix(cli): use purchaseSucceeded in the interrupt summary and run stats - #2253

Merged
cristim merged 1 commit into
mainfrom
fix/purchase-succeeded-summaries
Oct 17, 2026
Merged

cristim merged 1 commit into
mainfrom
fix/purchase-succeeded-summaries

Conversation

@cristim

@cristim cristim commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Closes #2205

Summary

#2204 added purchaseSucceeded(result) (Success && Error == nil) and used it for the audit status and the purchase diagnostics. Some summary sites still read the raw result.Success. For a provider result of {Success: true, Error: non-nil}, those sites disagreed with the audit record for the same purchase. They now go through purchaseSucceeded:

The CSV Success column keeps the raw provider flag, as the issue allows. docs/cli/README.md now says to read the Error column, and that an errored row counts as failed in the summary and the exit code. cmd/multi_service_csv.go is unchanged; the open #2247 and #2250 touch it. CHANGELOG.md has a Fixed entry.

Evidence (local, macOS, GOTOOLCHAIN=go1.26.9, unit tests)

  • Fail before / pass after: cmd/purchase_succeeded_summaries_2205_test.go covers the interrupt summary, the audit-stop message, the stats and the exit-code check, plus ordinary success, Success=false and a separate Go error. With the two source files stashed, all four test functions fail. With the fix, they pass.
  • Mutation probes (reviewer): reverting calculateServiceStats, purchaseFailureError or interrupt.go:43 to .Success each fails a test.
  • Checks:
    • make build: passes.
    • go vet ./...: passes.
    • go test -race ./cmd/...: passes.
    • golangci-lint v2.10.1: 0 issues.
    • scripts/test-git-secrets-allowlist.sh: 44/44.
  • Review: two passes by an independent non-author reviewer (sonnet, high) found no actionable findings at 441761f. The reviewer confirmed:
    • no other .Success reads remain;
    • the summary count and the exit code share one predicate;
    • successful + failed still equals attempted;
    • dry runs are unchanged.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Purchase results that include an error are now counted as failures in interrupted summaries, audit-stop messages, service statistics, and exit status—even when the provider reports success.
  • Documentation
    • Clarified that the CSV Success column shows the provider’s raw result. Check the Error column for error details; results with errors count as failures in the run summary.

A result with Success=true and a non-nil Error is a failure. Route the
Ctrl-C summary, the audit-stop message, the per-service counts and the
non-zero exit check through purchaseSucceeded so they agree with the
audit status. The CSV Success column stays the raw provider flag and is
documented as such; the Error column carries the error.

Closes #2205

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cristim cristim added priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-quarter Within the quarter impact/few Limited audience effort/s Hours type/bug Defect triaged Item has been triaged labels Oct 17, 2026
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

@cristim

cristim commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

@cristim
cristim merged commit 7e885a2 into main Oct 17, 2026
12 checks passed
@cristim
cristim deleted the fix/purchase-succeeded-summaries branch October 17, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/few Limited audience priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/bug Defect urgency/this-quarter Within the quarter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): use purchaseSucceeded in interrupt summary, stats and CSV success column

1 participant