fix(commitmentOptions): align savingsplans key (CodeRabbit nitpick sweep)#63
Conversation
…opdown/DB CodeRabbit flagged a key mismatch on PR #30: `SERVICE_FIELDS` in `settings.ts` uses `service: 'savingsplans'`, while `commitmentConfigs` in `commitmentOptions.ts` registered the AWS entry under `'savings-plans'` (hyphenated). Any lookup via `isValidCombination`/`getCommitmentConfig` with the non-hyphenated identifier silently fell through to `_default` instead of hitting the Savings-Plans-specific config. Today both configs are identical so behaviour is unchanged, but any future restriction added to `'savings-plans'` would have been silently skipped. CodeRabbit's suggestion was to rewrite `SERVICE_FIELDS` to the hyphenated form, but `field.service` in `SERVICE_FIELDS` flows directly to `api.updateServiceConfig(provider, service, cfg)` (settings.ts:1443) which persists `service` as the primary key in the `service_configs` table — existing production rows are `('aws', 'savingsplans')`, and renaming SERVICE_FIELDS without a DB migration would have created duplicate rows and orphaned the old config. The dropdown at `index.html:112,703` (`<option value="savingsplans">`) and the backend CLI flag (`cmd/main.go:92`) also use the non-hyphenated form. Fix by renaming the `commitmentConfigs.aws` key from `'savings-plans'` to `savingsplans` so every frontend call site — the SERVICE_FIELDS path, the plan-form dropdown path, and any direct lookups — resolves to the Savings-Plans-specific config. Update the two test cases in `commitmentOptions.test.ts` to match. This addresses the only live CodeRabbit finding across all open/closed PRs (24-39, 52-54); PR #52's nitpicks were already resolved in db429fe, and the remaining PR #30 nitpicks (double `Promise.resolve()` in settings.test.ts:854, memorydb absent from SERVICE_FIELDS) apply only to code that lives on PR #30's branch and not the base.
|
@coderabbitai review |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe AWS Savings Plans service identifier is updated from Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Actions performedReview triggered.
|
Summary
Addresses the only live CodeRabbit finding across all open/closed PRs (24–39, 52–54).
SERVICE_FIELDSinsettings.ts:32usesservice: 'savingsplans'whilecommitmentConfigsincommitmentOptions.ts:58registered the AWS entry under'savings-plans'. Any lookup throughisValidCombination/getCommitmentConfigwith the non-hyphenated identifier silently fell through to_default.SERVICE_FIELDSto'savings-plans', but that value also flows intoapi.updateServiceConfig(provider, service, cfg)atsettings.ts:1443— theservicecolumn is the DB primary key in theservice_configstable, existing rows are('aws', 'savingsplans'), and renaming without a migration would silently create duplicate rows. The dropdown atindex.html:112,703(<option value="savingsplans">) and the backend CLI flag (cmd/main.go:92) also use the non-hyphenated form.commitmentConfigs.awskey tosavingsplansso every frontend call site — the SERVICE_FIELDS loop, the plan-form dropdown, and any direct lookup — resolves to the Savings-Plans-specific config. Update the two test cases.Scope of the PR
db429febtn.disabledvssetAttribute, drop dead?? 'Refresh'db429fesavingsplansvssavings-planskey mismatchPromise.resolve()in settings.test.ts:854Test plan
jest— 1244/1244 pass (all 35 suites)tsc --noEmit— clean'savings-plans'references in frontend code outside Go backend constants (pkg/common/types.go:49is the backend canonical — unchanged, andexecution.go:384already accepts both forms)🤖 Generated with claude-flow
Summary by CodeRabbit