Repository navigation
fix(aws/savingsplans): error on a plan with no start or end date - #620
Conversation
GetExistingCommitments left StartDate/EndDate at the zero time when the API returned a nil Start or End. The purchase dedupe never treats a zero StartDate as recent, so a plan with a nil Start could let a duplicate purchase through. A missing date now fails with an error naming the plan ID, like an unparseable one. The SDK documents both fields only as "The start time" / "The end time" (savingsplans@v1.31.0 types/types.go:49,80) with no absent-state exception. Refs #53 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Reject missing plan dates providers/aws/services/savingsplans/client.go, providers/aws/services/savingsplans/client_test.go, CHANGELOG.md |
toCommitment now rejects missing start and end dates. Tests cover missing dates and provide valid dates in existing fixtures. The changelog documents the error behavior. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- LeanerCloud/cloud-commitments-go#619: PR
#619added errors for invalid present dates in the sametoCommitmentconversion path; this PR extends the behavior to missing dates.
Merge Risk: 
Minimal · up to cf56b
-
The date validation change has no identified merge-blocking issue and is ready for normal checks.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title names the primary change: Savings Plans toCommitment now returns an error when a plan has no start or end date. The changeset matches this. The title is specific and follows the conventional-commit style. It does not cover the test additions, but that is expected.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Refs #53.
toCommitmentleftStartDate/EndDateat the zero time whenStartorEndwas nil.dedupe.gonever treats a zeroStartDateas recent, so a plan with a nilStartcould let a duplicate purchase through. A nilStartorEndnow returns an error naming the plan ID, matching the unparseable-date error from #619.The SDK documents
StartandEndonly as "The start time" / "The end time" (savingsplans@v1.31.0/types/types.go:49,80), with no state where they are legitimately absent. Existing test fixtures that omitted dates now set them.Tests: new
TestClient_GetExistingCommitments_MissingDateNamesPlanfails without the fix (mutation probe: revertingclient.gofails both subtests).go test -race -count=1 ./...passes inproviders/awswithGOWORK=offand with the workspace; golangci-lint v2.10.1 reports 0 issues.🤖 Generated with Claude Code
Summary by CodeRabbit