Repository navigation
fix(frontend): save Azure/GCP settings under recommendation ids - #1354
Conversation
…dations carry Recommendations store the provider's common.ServiceType slug (compute, relational-db, nosql, cache, search), and the scheduler (config.ResolveAccountConfigsForRecs) and the purchase modal look up service configs and per-account overrides by that exact (provider, service) pair. Settings wrote Azure and GCP rows under per-product ids (vm, sql, cosmosdb, redis, memorystore) that no recommendation carries, so those defaults and overrides never applied. The service cards, the override service list and the display names now use the current ids (card DOM ids are unchanged). Service configs stored under an old id are shown on their card and re-saved under the current id on the next Save; a row already stored under the current id wins. Overrides stored under an old id stay listed, with a note naming the id to re-create them under. A new test checks every Azure/GCP id the cards save and the override list offers against mapServiceSlug in internal/purchase/execution.go, with Cosmos DB's nosql as the one documented exception. Refs LeanerCloud#613 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 8 billable files and costs up to $2.00. Or wait 59 minutes for your next included review. View limit details
Comment |
Conflicts: - frontend/src/settings.ts (imports): kept both, this branch's lib/settings-service-ids import and main's lib/last-updated (LeanerCloud#8). - frontend/src/settings.ts (loadOverridesPanel service cell): kept both appends. Main's "Updated <when>" stamp (LeanerCloud#8) stays directly under the service name; this branch's old-service-id warning (LeanerCloud#613) follows it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent review (IAmJSD's agent, fresh context, given only the diff, the issue and the PR text): APPROVE Blocking:
|
|
Local verification at
|
|
Marked ready and merged by IAmJSD's agent, at IAmJSD's request (IAmJSD reviewed the before/after screenshots; cristim is traveling), after the independent review and local verification above, all at |
Settings saved Azure and GCP service configs and per-account overrides under per-product ids (
azure/vm,azure/sql,azure/cosmosdb,azure/redis,gcp/sql,gcp/memorystore) that no recommendation carries, so those defaults, filters and overrides never applied. This PR switches Settings to the ids recommendations use, migrates stored service configs on the next save, and flags overrides stored under an old id.Refs #613
Partial: overrides stored under an old id are flagged but not migrated (they need a manual re-create, or a backend SQL migration), and Cosmos DB's
azure/nosqlis not inmapServiceSlug, so the new slug test allows it as one named exception.What changed
common.ServiceTypeslug (compute,relational-db,nosql,cache,search; seeinternal/scheduler/scheduler.goand the cloud-commitments-go Azure/GCP clients). The scheduler (config.ResolveAccountConfigsForRecs->applyAccountOverrides) and the purchase modal's override seeding look up configs by that exact (provider, service) pair. Onlyazure/searchandgcp/computehappened to match, so this was a live break, not just an inconsistency.frontend/src/lib/settings-service-ids.ts: the current Azure/GCP ids, a legacy map (azure/vm->compute,azure/sql->relational-db,azure/cosmosdb->nosql,azure/redis->cache,gcp/sql->relational-db,gcp/memorystore->cache) andcanonicalizeServiceConfigs(), which re-keys stored legacy rows onto the current id (a row already stored under the current id wins).frontend/src/settings.ts:SERVICE_FIELDS,AZURE_OVERRIDE_SERVICES,GCP_OVERRIDE_SERVICESandSERVICE_DISPLAY_NAMESuse the current ids. Card DOM ids such asazure-vm-termare unchanged.loadGlobalSettingscanonicalizes theGET /configservices list and fills the cards throughSERVICE_FIELDSinstead of building DOM ids from the row's service id. A legacyazure/vmrow still fills the VM card, and the next Save PUTs it asazure/compute, keeping itsramp_scheduleand filters.frontend/src/styles/settings.css.settings-accounts,settings-gcp-storage-removed,settings-service-payment,settings); newfrontend/src/__tests__/settings-service-ids.test.ts.Why this approach
index.htmland the filter/term/payment wiring.Screenshots
Screenshots were taken before this branch was merged with main; before = main at a14dc8f. After is this branch. Both are headless Chromium at 1440x900 against the repo's mocked e2e API.
Azure account overrides modal with an
azure/vmoverride. Before: theazure/vmrow looks like any other, although no recommendation ever matches it. After: it carries an amber note saying it is never applied and namingazure/computeas the id to re-create it under; theazure/relational-dbrow (current id) has no note. On current main the service cell also shows the "Updated " stamp from #8, so the shipped cell has that stamp under the service name and the warning below it.Verification
Run on this branch's head
a2583a31:frontend/src/settings.tsresolved, see the merge commit.settings-service-ids.test.ts(11 tests). Before the merge it passed with--randomize, and 4 of its tests failed against main'ssettings.ts. It readsmapServiceSlugfrominternal/purchase/execution.goand checks that every Azure/GCP id the cards PUT and the override modal offers is in it (withazure/nosqlas the only allowed exception), and covers legacy load and save, the current-id-wins rule and the override warning.--randomizerun of all settings suites hit "Settings Module > saveGlobalSettings > shows error alert on failure" with seed-680793092; the same seed fails that test on main too (pre-existing order dependence).e2e-local.sh): 200 passed. No new spec; the logic is covered by jest.scripts/test-git-secrets-allowlist.sh: 137 PASS, 0 FAIL.Notes for review
lib/plan-service-ids.ts(and its copy inplans.ts) has a second legacy-id table for plans. The two differ on purpose (for examplegcp/sqlvsgcp/cloudsql, andazure/nosqlis not a plan service), so they are not shared here.azure/nosqlbecause that is what Cosmos recommendations carry (common.ServiceNoSQL).mapServiceSlugdoes not listnosql, so Cosmos cannot go through the plan/purchase slug path. That is a separate backend gap.service_configsrows under old ids are effectively replaced on the next Settings save but not deleted (there is no DELETE endpoint for service configs), and old overrides need a manual re-create and delete. A backend SQL migration (UPDATE service_configs/account_service_overrides SET service = <new id>where the row is legacy and none exists under the new id) would clean this up for good; that is out of scope for a frontend-only branch.--cudly-warn-fg) need design sign-off.SERVICE_DISPLAY_NAMESlabels are unchanged; only their keys moved.Overlaps
settings.ts(trivial textual conflict).settings.ts,settings.cssor the settings tests (feat(frontend): Admin Purchasing policies page is very long with a mid-page partial load #190, fix(frontend): low-severity copy, toast, confirm and stale-state fixes #728, fix(frontend): dialogs bypassing openModal lack focus handling, Escape and alert roles #731, fix(frontend): status badges use four shapes and conflicting colors per status #737, chore(frontend): add typography foundation (line-height, heading scale, font inherit) #741, chore(frontend): unify four modal systems and five card styles, reuse kpi-tile #743, fix(frontend): raw transport and developer errors reach users instead of friendly messages #748, chore(frontend): replace mixed Unicode glyphs with one SVG icon set #751).compute/relational-db/cache.Note for the UI owner
This changes UI code that @cristim owns. IAmJSD reviewed the before/after screenshots and asked for it to be merged; any design point you disagree with can be a follow-up.
🤖 Generated with Claude Code