Skip to content

fix(recommendations): parseMemoryDBDetails uses rec fields, errors loudly on empty (closes #378)#539

Open
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
fix/378-memorydb-parse
Open

fix(recommendations): parseMemoryDBDetails uses rec fields, errors loudly on empty (closes #378)#539
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
fix/378-memorydb-parse

Conversation

@cristim
Copy link
Copy Markdown
Member

@cristim cristim commented May 20, 2026

Hand-off PR for partially-completed work from a sub-agent that hit a usage cap. parseMemoryDBDetails previously hardcoded db.r6gd.xlarge / redis, silently failing every non-default MemoryDB RI purchase. Single commit makes it read rec.ResourceType and error loudly when empty. \n\nCloses #378.

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved validation and data population for AWS MemoryDB resource recommendations to ensure accuracy of cost optimization recommendation details.

Review Change Stack

…ors loudly on empty

Previously, the function either hardcoded db.r6gd.xlarge (original) or
silently returned nil without populating Details (feat branch). Both
paths caused MemoryDB RI purchases to silently fail when the rec's
actual instance type was anything other than the hardcoded default.

Now the function errors loudly when rec.ResourceType is empty (so the
recommendation is logged as a warning by parseRecommendations and
skipped), and populates CacheDetails correctly when ResourceType is set.

Also removes the unused log import and updates TestParseMemoryDBDetails
to cover the empty-ResourceType error path and two valid instance types.

Closes #378
@cristim cristim added triaged Item has been triaged priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-sprint Within the current sprint impact/many Affects most users effort/s Hours type/bug Defect labels May 20, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 31e52677-5148-4bdb-9c9a-a96d10277803

📥 Commits

Reviewing files that changed from the base of the PR and between b1ea4b1 and 9bf91d0.

📒 Files selected for processing (2)
  • providers/aws/recommendations/parser_services.go
  • providers/aws/recommendations/parser_services_test.go

📝 Walkthrough

Walkthrough

parseMemoryDBDetails is refactored to validate rec.ResourceType presence and populate cache details from the recommendation object instead of relying on hardcoded defaults. The log import is removed, and the test is expanded to cover error and success scenarios.

Changes

MemoryDB Detail Parsing

Layer / File(s) Summary
parseMemoryDBDetails validation and details extraction
providers/aws/recommendations/parser_services.go, providers/aws/recommendations/parser_services_test.go
parseMemoryDBDetails removes the log import, validates rec.ResourceType is non-empty (returning error if absent), and sets rec.Details to common.CacheDetails with Engine: "redis" and NodeType from rec.ResourceType. Test is rewritten with three subtests covering empty ResourceType error case and successful detail extraction for db.r6g.large and db.r6gd.xlarge instance types.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

🐰 A MemoryDB hopper once chose,
One hardcoded node, heaven knows—
Now validation rings true,
ResourceType guides what to do,
No more silent fails in the prose! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. 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 accurately reflects the main change: fixing parseMemoryDBDetails to use rec fields and error when empty, addressing issue #378.
Linked Issues check ✅ Passed The changes fully satisfy #378 requirements: parseMemoryDBDetails now validates rec.ResourceType is non-empty, returns an error when missing, and populates CacheDetails with correct Engine and NodeType values.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing parseMemoryDBDetails and its test; no unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/378-memorydb-parse

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

@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Labels

effort/s Hours impact/many Affects most users priority/p2 Backlog-worthy severity/medium Moderate 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