Skip to content

refactor(aws): use common.ErrOutcomeUnknown and drop the internal sentinel - #335

Merged
cristim merged 3 commits into
mainfrom
feat/301-switch-aws-sentinel
Oct 10, 2026
Merged

cristim merged 3 commits into
mainfrom
feat/301-switch-aws-sentinel

Conversation

@cristim

@cristim cristim commented Oct 10, 2026

Copy link
Copy Markdown
Member

Closes #301 (PR 2 of 2; PR 1 is #329).

What

Verification (unit tests with fake AWS errors, no live AWS)

  • GOWORK=off go build -mod=readonly ./... for all four modules; tests for purchasecfg, ec2, redshift pass; golangci-lint on those packages: 0 issues.
  • TestClassifyPurchaseError asserts errors.Is(got, common.ErrOutcomeUnknown) true for 500, transport, 200-undeserializable and false for 4xx/throttle cases.
  • Mutation: reintroducing a local sentinel in ClassifyPurchaseError makes TestClassifyPurchaseError fail (run, then reverted).

Consumer follow-ups (need pkg and aws pins bumped to this PR's merge)

  • cloud-commitments-mcp#49: errors.Is(err, common.ErrOutcomeUnknown) for the audit status.
  • platform #778: persist an outcome-unknown flag and relax the redrive refusal for definite failures.
    CLI has no users. Out of scope: pkg/exchange and other services (go#297).

🤖 Generated with Claude Code

…tinel

Pin pkg to 30bf383 in providers/aws, azure, gcp and ci_cd_sanity_tests, point ClassifyPurchaseError, the EC2 and Redshift clients and their tests at the exported sentinel, and delete purchasecfg.ErrOutcomeUnknown. One sentinel, no alias (#301).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline impact/few Limited audience effort/s Hours type/bug Defect labels Oct 10, 2026
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 10 billable files and costs up to $2.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 33 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 88 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-go/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 0f344500-86ca-43fb-a997-979c5c49d660

📥 Commits

Reviewing files that changed from the base of the PR and between 7e217b1 and 9788bd7.


⛔ Files ignored due to path filters (4)
  • ci_cd_sanity_tests/go.sum is excluded by !**/*.sum
  • providers/aws/go.sum is excluded by !**/*.sum
  • providers/azure/go.sum is excluded by !**/*.sum
  • providers/gcp/go.sum is excluded by !**/*.sum

📒 Files selected for processing (10)
  • ci_cd_sanity_tests/go.mod
  • providers/aws/go.mod
  • providers/aws/internal/purchasecfg/outcome.go
  • providers/aws/internal/purchasecfg/outcome_test.go
  • providers/aws/services/ec2/client.go
  • providers/aws/services/ec2/purchase_retry_test.go
  • providers/aws/services/redshift/client.go
  • providers/aws/services/redshift/purchase_retry_test.go
  • providers/azure/go.mod
  • providers/gcp/go.mod


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@cristim

cristim commented Oct 10, 2026

Copy link
Copy Markdown
Member Author

Gate review (independent, adversarial) of #335. Verdict: CLEAN, not merged yet (BEHIND main again; queue ruling: #334 merges first).

Reviewed SHA b20c420; after one update-branch the head is 35978de (only d9ead42 from main added; PR's own files diff-empty vs b20c420).

  • Pin block: all four modules (providers/aws, azure, gcp, ci_cd_sanity_tests) go.mod and go.sum use pkg v0.0.0-20261009181525-30bf383795db (30bf383, PR 1 merge commit); only go.mod/go.sum changed for them.
  • No remaining use of the old sentinel: grep for purchasecfg.ErrOutcomeUnknown / local ErrOutcomeUnknown in providers/ is empty; ClassifyPurchaseError, ec2/client.go:190 and redshift/client.go:215 now use common.ErrOutcomeUnknown. Wrap chain unchanged (%w at ec2 :174, redshift :201; ladder/purchase.go wraps with %w). Message text unchanged ("purchase outcome unknown", pinned by pkg/common/types_test.go:553). 4xx/throttle cases still false in TestClassifyPurchaseError.
  • Mutation (local sentinel errLocal in ClassifyPurchaseError, real run): TestClassifyPurchaseError FAILS (500 internal error, 503, 500 over MaxAttemptsError, 200 undeserializable, transport error subtests). Reverted; tree clean.
  • Local, GOTOOLCHAIN=go1.26.9 GOWORK=off -mod=readonly: build+vet OK for all four modules; tests ok for purchasecfg, ec2, redshift, ladder, recommendations; golangci-lint 0 issues on touched packages.
  • CI at 35978de: all checks pass (Unit, Integration, Lint x4, gosec, Trivy, Snyk, CR); mergeState BEHIND.
    Remaining: after feat(insurance): export the supported contract-term list #334 merges, update-branch once more, CLEAN + CI green, re-check pin block, merge with --match-head-commit.

@cristim
cristim merged commit 16b5795 into main Oct 10, 2026
15 checks passed
@cristim

cristim commented Oct 10, 2026

Copy link
Copy Markdown
Member Author

Final gate: after #334 merged, update-branch to 9788bd7. Diff of the PR's files (go.mod/go.sum x4, purchasecfg, ec2, redshift) between 35978de and the new head is empty. Pin block: all four modules on pkg v0.0.0-20261009181525-30bf383795db. CI 15/15 pass, mergeState CLEAN. Review verdict CLEAN (earlier comment: mutation fails TestClassifyPurchaseError, local builds/tests/lint ok). Squash-merged with --match-head-commit under the go merge lock.

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/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/bug Defect urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(aws): export the outcome-unknown error so the platform can retry definite failures

1 participant