Repository navigation
feat(console): clear the value saved beneath an env pin in Setup - #31039
Conversation
A settings field an OS_* variable pins now offers, when a value is stored beneath the pin at the scope the page writes, a confirmed control that clears that saved value; the environment value stays in force. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzzesuj1TsQQD4hQjM
… pin Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzzesuj1TsQQD4hQjM
|
domain:ui#3 · os-tesla · session_01L9qibxW6qraU2Z3mwupUGp Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flagsNone. No server field was needed (the claim's stop did not trigger); no ④ Design judgmentFits the card's Expected item by item: control only on a locked field with a value stored beneath the pin, none otherwise; the line says the environment value stays in force. Writing at once behind a confirm, rather than through the draft, matches a row that cannot be edited. Implemented-by: VERDICT: PASS |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzzesuj1TsQQD4hQjM
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzzesuj1TsQQD4hQjM
|
domain:ui#3 · os-tesla · session_01L9qibxW6qraU2Z3mwupUGp 维护者速读
席位核对 — ACCEPT · head fb666f8
|
Requested by Tesla · project thread
Fixes #30665
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
null。OS_AUTH_ALLOWED_IP_RANGES)来自救后,以前在 Setup 里删不掉锁下面的旧值,一旦移除变量旧值就回来;服务端的清除(fix(service-settings): a clear goes through an env pin, so the allowed-IP lockout recovery survives removing the variable #30448)和"锁下是否有存值"的读数(Settings read: an env-pinned key does not say whether a value is stored beneath the pin, so Setup cannot offer to clear it #30823)都已落地,这里补上界面。ui/apps/console/src/pages/settings/SettingsField.tsx(storedBeneathPin与ClearSavedBeneathPin)、SettingsView.tsx(onClearSaved)、__tests__/SettingsView.clearBeneathPin-30665.test.tsx。pnpm --dir ui exec vitest run apps/console/src/pages/settings/__tests__/SettingsView.clearBeneathPin-30665.test.tsx,预期 7/7 通过。What changes
SettingsField.tsx:storedBeneathPin(resolved, writeScope)reads the server'scascadeChainalone: true when the row is env-pinned (locked,source: 'env') and an entry beneath theenventry at the scope this page writes carries a non-null value (a secret's entry is the read mask, which counts). On such a row, and only when the host passesonClearSaved, the row draws one line ("A value is also saved here. The environment value stays in force; ...") and a "Clear the saved value" button. The button opens a confirm (title and action "Clear the saved value", body saying the saved value will not come back when the variable is removed and the environment value stays in force; Cancel is the sharedactionConfirm.cancel). Drawn under the control for every input row and under the help text for a toggle row.SettingsView.tsx:onClearSaved(key)writesPUT /api/settings/:namespacewith{ [key]: null }for that key alone, merges the read-back, toasts "Saved value cleared" and reads the namespace again. The page draft is not touched: the row is read-only, so the clear is not one of the page's edits. A refusal toasts the server's sentence (the pin never refuses a clear, solockedByEnvwould misname a row lock or a 403).@object-ui/i18n: fourconsole.settingsViewkeys (savedBeneathPin,clearSaved,clearSavedConfirm,savedCleared) in all eleven packs (since feat(i18n)!: the Console's language packs follow the platform locale table, keyed by its tags, and Traditional Chinese (zh-Hant) ships #30902 merged:zh-Hans,zh-Hantandpt-BRreplacezhandpt). Wording clears the saved value and never says delete..changeset/30665-clear-saved-beneath-env-pin.md:@object-ui/consoleand@object-ui/i18npatch.What the server serves, measured on
origin/main41dc302496before the first edit:getNamespace→resolveMany(..., beneathPins = true)) answers a pinned key{ source: 'env', locked: true, cascadeChain: [env entry (effective), ...stored cascade beneath] }viawithStoredBeneath; the entries beneath loseeffectiveand end with thedefaultentry. A pinned key whose env value is null keeps its oneenventry. A secret beneath the pin isstoredSecretPresenceon the service and masked entry by entry byredactSecretValueson the route, so the console sees the mask ornull.setMany, the[#30385]block):null/undefinedfor a key an in-force override pins passes theSettingsLockedErrorcheck and is judged by the row locks and write predicates like any clear; it writes at the key's registered scope (spec.scope ?? manifest.scope ?? 'tenant'), the same derivation the page passes aswriteScope. So the control is gated on an entry at that scope: a value stored only at another rung could not be removed by this clear, and no control is drawn for it.No new server field is needed; no file under
packages/**changes.Tests
ui/apps/console/src/pages/settings/__tests__/SettingsView.clearBeneathPin-30665.test.tsx(7 tests, whole page over a stubbedfetchand the real../api):{"allowed_ip_ranges":null}, toasts, and the row stays locked and read-only with no control left after the server's answer;{"webhook_secret":null};Verification
Local runs on head (see the report comment for the final sha)
pnpm --dir ui exec vitest run apps/console/src/pages/settings/→ Test Files 38 passed (38), Tests 304 passed (304).pnpm --dir ui exec vitest run packages/i18n/→ Test Files 97 passed (97), Tests 1521 passed, 13 skipped (key parity across all ten packs included; on head fb666f8 after merging main: settings + i18n 136/136 files, 1949 passed, 13 skipped, eleven-pack parity included).node scripts/ablation-replace.mjs, source is what the console project resolves): the write-scope condition instoredBeneathPinwidened to any stored rung → 2 failed / 5 passed (the offer test and the clear test, both seeing the extra control on the tenant row stored only at global); restored, blob equal to HEAD,git diff HEADempty.dispatch-gates.mjs --commands): every line run with stdin closed; exit codes in the report comment, reconciled with--ran.Acceptance notes
action_button'sconfirmText.i18n-locale-enchunk gains four strings; its per-chunk ceiling is unchanged. The eager-closure budget is weighed by CI'sBuild & E2E UIjob (pnpm --dir ui run check:eager-closure), not re-run locally.SettingsFieldwithoutonClearSaved, so it shows no control.Generated by Claude Code