fix(platform-config): send full config payload on update (FT-1941)#38
fix(platform-config): send full config payload on update (FT-1941)#38joalves wants to merge 6 commits into
Conversation
…FT-1941) Polish from final review of FT-1941: a one-line comment on the destructure explaining why id is dropped (it lives in the URL path), and an end-to-end CLI test that exercises a numeric --value to lock in the cast removal.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughThis pull request refactors the platform config update flow to adopt a read-before-write pattern. Previously, Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
Fixes FT-1941.
abs platform-config update <id> --value <json>was returning HTTP 500 (Cannot use 'in' operator to search for 'archived' in 30) because the CLI was sending{"data": <raw-value>}instead of the required{"data": {"name": "...", "value": "...", ...}}.src/core/platformconfig/platformconfig.ts): nowGETs the current config, merges the newvalueover it, dropsid(it's in the URL path), andPUTs the full object.UpdatePlatformConfigParams.valueis nowunknownso the CLI can pass any JSON value (string, number, object, array).src/commands/platformconfig/index.ts): dropped the misleadingas Record<string, unknown>cast onvalidateJSON(--value). Configvalues in the wild are often non-object JSON ("30",42, booleans).src/api-client/api-client.ts): unchanged. Investigation showed{ data: { data } }is JS shorthand producing the correct{ data: <param> }wire body; the original bug was upstream. Added a regression test that pins the wire shape so a future refactor can't reintroduce the symptom.Test plan
npx vitest run src/core/platformconfig src/commands/platformconfig src/api-client— 10/10 platform-config tests + the api-client regression guard passnpx vitest run(full suite) — 2382/2382 pass, 4 skippednpx tsc --noEmit— cleandev-1: GET→PUT round-trip on configs22(experiment_form_max_secondary_metrics) and23(experiment_form_max_guardrail_metrics); both returned 200,updated_atadvanced, all fields preserved--show-requestoutput confirms the wire body is{"data": {"name": "...", "value": "30", "default_value": ..., ...}}Summary by CodeRabbit
Release Notes
Bug Fixes