Skip to content

fix(settings): expose Azure payment default + correct misleading help text#27

Merged
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/azure-payment-defaults
Apr 24, 2026
Merged

fix(settings): expose Azure payment default + correct misleading help text#27
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/azure-payment-defaults

Conversation

@cristim
Copy link
Copy Markdown
Member

@cristim cristim commented Apr 24, 2026

Summary

  • Azure service-defaults cards (VM / SQL / CosmosDB / Redis) now expose a Payment selector with values that map to backend-validated storage: Upfront → all-upfront, Monthly → no-upfront
  • SERVICE_FIELDS entries for the four Azure services flipped from paymentId: null to the new element IDs, so load/save pick up the per-service payment instead of silently falling back to the global default
  • Corrected the Global Purchase Defaults help text which wrongly claimed Azure was always upfront; now describes per-provider payment semantics accurately
  • Tests cover load-applies-persisted-value, save-sends-per-service-payment, and a regression check on the help-text copy

Why AWS-style values on the Azure card

Backend validation at internal/config/validation.go:14 only accepts no-upfront, partial-upfront, all-upfront for ServiceConfig.Payment. normalizePaymentValue in commitmentOptions.ts already bridges the storage values back to Azure-native "Upfront"/"Monthly" at display time, keeping the plan-form rendering consistent.

Closes #12.

Test plan

  • npx jest — 1220 tests pass (33 suites)
  • npx tsc --noEmit — clean
  • Frontend build via pre-commit hook — clean
  • Manual: open Settings → Purchasing with Azure enabled → set VM Payment to Monthly → Save → reload → confirm persisted (PR review)

… text

Issue #12 reported two linked gaps in Settings → Purchasing:

1. The four Azure service-defaults cards (VM / SQL / CosmosDB /
   Redis) had no Payment selector; `SERVICE_FIELDS` flagged the
   rows with `paymentId: null`, so the save path fell back to the
   global default_payment silently. Users who preferred Monthly
   Azure payments couldn't persist the preference.
2. The "Global Purchase Defaults" help text falsely stated
   *"Payment options only apply to AWS services; Azure and GCP
   reservations are always paid upfront."* — Azure reservations
   actually support upfront + monthly (already reflected in the
   plan form via AZURE_PAYMENTS in commitmentOptions.ts).

Backend validation only accepts the AWS-style values
`[no-upfront, partial-upfront, all-upfront]` for
`ServiceConfig.Payment` (internal/config/validation.go:14), so
the Azure cards store AWS-style values with user-visible labels:

- "Upfront"  → `all-upfront`
- "Monthly"  → `no-upfront`

`normalizePaymentValue` in commitmentOptions.ts already bridges
these back to Azure-native rendering at display time, so the
round-trip stays consistent.

- Add `<label>Payment: <select id="azure-{vm,sql,cosmosdb,redis}-
  payment">…</select></label>` to each of the four Azure cards.
- Flip the four Azure rows in `SERVICE_FIELDS` from
  `paymentId: null` to the new element IDs.
- Correct the help text to describe per-provider payment
  semantics (AWS: three upfront variants; Azure: upfront or
  monthly; GCP: monthly only).
- New `describe('Azure payment defaults (issue #12)')` test block
  covers load → value applied, save → per-service payment (not
  global default) sent via `api.updateServiceConfig`, and a
  regression check on the help-text copy.

Closes #12.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Warning

Rate limit exceeded

@cristim has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 36 minutes and 43 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 36 minutes and 43 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f06ee6d6-d97b-4dbb-acb3-4a98014c96bb

📥 Commits

Reviewing files that changed from the base of the PR and between 1d461c3 and 0ed8975.

📒 Files selected for processing (3)
  • frontend/src/__tests__/settings.test.ts
  • frontend/src/index.html
  • frontend/src/settings.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/azure-payment-defaults

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.

❤️ Share

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

@cristim
Copy link
Copy Markdown
Member Author

cristim commented Apr 24, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 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 cristim merged commit 8cedfde into feat/multicloud-web-frontend Apr 24, 2026
3 checks passed
@cristim cristim added type/bug Defect severity/low Minor harm urgency/this-sprint Within the current sprint impact/few Limited audience effort/s Hours priority/p3 Polish / idea / may never ship triaged Item has been triaged labels Apr 28, 2026
@cristim cristim deleted the fix/azure-payment-defaults branch April 29, 2026 10:07
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/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant