Skip to content

fix(aws): report incomplete recommendation collections - #169

Open
cristim wants to merge 1 commit into
mainfrom
fix/aws-recommendation-completeness
Open

cristim wants to merge 1 commit into
mainfrom
fix/aws-recommendation-completeness

Conversation

@cristim

@cristim cristim commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Malformed AWS RI offers were logged and dropped while callers received success. That let interactive searches present an incomplete offer menu as complete.

Return surviving recommendations with IncompleteRecommendationsError, carrying separate failed-detail and failed-scope counts plus contextual causes. Preserve those diagnostics through combo/service aggregation and the SDK adapter. Total ordinary failures and cancellation remain fatal; successful account/region filtering remains intact.

Refs #54

Independent Astra review approved exact commit 8d4be0d with no actionable findings. Fresh independent race tests cover the actual SDK adapter, completeness matrix, nested counts, filters and cancellation. Actual registered MCP protocol verification returns IsError with contextual diagnostics; the unchanged parent and a diagnostic-drop mutation instead return a successful six-row menu and fail the assertion. Full AWS module race tests, build, vet, pinned lint and normal hooks pass.

Verification uses synthetic HTTP responses through the real SDK and registered protocol, with no cloud purchases. The MCP check currently selects the producer through an isolated workspace; it is not evidence of a published consumer upgrade.

#54 remains open until platform, CLI and MCP select the published AWS module and pass standalone GOWORK=off verification. Scheduler preservation of partial results without stale-row eviction and CLI partial-result warnings are subsequent rollout steps. Existing Savings Plans parsing gaps are not covered by this RI diagnostic change.

The AWS module retains its already published shared-pkg dependency v0.0.0-20260929105827-b3b4cb5e3d80; no module files change. The bounded 435-line diff is one concern, including real-SDK regression tests and removal of obsolete error-handling comments.

Summary by CodeRabbit

  • New Features
    • AWS recommendation collection now returns valid recommendations even when some details or services fail, alongside an indication of incomplete results. Failure details remain available for troubleshooting, and account and region filters still apply to returned recommendations.
  • Bug Fixes
    • Cancellation and deadline errors now stop recommendation collection promptly. When all recommendation details or services fail, the operation returns an error rather than presenting the result as a partial success.

Return valid RI recommendations with typed detail and scope failures through
the parser, collection fan-out and filtered provider adapter. Keep total API
failures and cancellation fatal so consumers can choose their existing policy.

Verify mixed responses through the real AWS SDK, exact nested counts, empty
versus all-invalid results, filtering and cancellation during enrichment.

Refs #54
@cristim cristim added triaged Item has been triaged urgency/this-sprint Within the current sprint priority/p1 Next up; this sprint severity/high Significant harm impact/many Affects most users effort/m Days type/bug Defect labels Oct 1, 2026
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: LeanerCloud/cloud-commitments-go/.coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: 51be0a93-1a88-4cfe-a177-64ecee85167c

📥 Commits

Reviewing files that changed from the base of the PR and between f260c4c and 8d4be0d.

📒 Files selected for processing (8)
  • providers/aws/recommendations/client.go
  • providers/aws/recommendations/client_test.go
  • providers/aws/recommendations/collection_error.go
  • providers/aws/recommendations/collection_error_test.go
  • providers/aws/recommendations/parser_ri.go
  • providers/aws/recommendations/parser_ri_test.go
  • providers/aws/service_client.go
  • providers/aws/service_client_completeness_test.go

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


📝 Walkthrough

Walkthrough

AWS recommendation parsing and collection now retain surviving recommendations when some details or scopes fail, and return an incomplete-results diagnostic. Cancellation remains terminal, and the service client filters partial results before returning them.

Changes

Recommendation completeness

Layer / File(s) Summary
Incomplete error and detail parsing
providers/aws/recommendations/collection_error.go, providers/aws/recommendations/parser_ri.go, providers/aws/recommendations/collection_error_test.go, providers/aws/recommendations/parser_ri_test.go
Adds IncompleteRecommendationsError with failure counts and causes. Parsing returns valid recommendations with diagnostics for invalid details, and checks for cancellation.
Recommendation collection and aggregation
providers/aws/recommendations/client.go, providers/aws/recommendations/client_test.go, providers/aws/recommendations/collection_error_test.go
Combination and service aggregation retain partial results with an incomplete-results error. Cancellation returns immediately, while total failure remains an ordinary wrapped error. Tests cover failure counts, causes, and cancellation.
Adapter partial-result handling
providers/aws/service_client.go, providers/aws/service_client_completeness_test.go
The service client filters partial recommendations and returns them with the incomplete-results error. The test covers malformed and filtered details.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant Adapter as RecommendationsClientAdapter
  participant Collection as GetRecommendationsForService
  participant API as AWS recommendation API
  participant Parser as parseRecommendations
  Caller->>Adapter: Request recommendations
  Adapter->>Collection: Get recommendations
  Collection->>API: Fetch recommendation combinations
  API-->>Collection: Return recommendation details
  Collection->>Parser: Parse recommendation details
  Parser-->>Collection: Return recommendations and incomplete error
  Collection-->>Adapter: Return recommendations and error
  Adapter-->>Caller: Return filtered recommendations and error
Loading

Merge Risk: ⚪ Minimal · up to 8d4be

No concrete merge-blocking issue is established. Partial recommendation failures now retain diagnostics and surviving filtered results; downstream adoption remains a separate rollout step.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: AWS recommendation collections now report incomplete results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/m Days impact/many Affects most users priority/p1 Next up; this sprint severity/high Significant harm triaged Item has been triaged type/bug Defect urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant