Repository navigation
fix(web): keep a saved multi-select value in plugin settings forms - #4176
Conversation
formValueForField returned the field default for any saved value that was not a string, number, or boolean, so a saved MULTI_SELECT list loaded as "" and buildSchemaValues sent it back as []. Saving any other change on a plugin's settings form erased the saved selection. Return the saved list as is for a MULTI_SELECT field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 2 minutes. View limit details
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Since #4176 a saved multi-select list loads into the form as is, so an untouched nullable boolean list such as [null] reached coerceBoolean and saved as [false]. Leave null items unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…4179) * fix(web): keep string selections as strings in plugin settings saves The plugin settings form and the Sign-in page built the saved entry without the schema's declared field types, so buildSchemaValues fell back to the control heuristic and turned numeric-looking multi-select values such as "001" into numbers. Pass parseFieldTypes(json_schema), as the request-server and watch-provider forms already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): keep the control heuristic for arrays with no item type parseFieldTypes typed every array property as "array", which passes values through untouched. An array whose items carry no plain type (enum, $ref, a nullable type list) then saved numeric selections as strings, where the control heuristic used to make them numbers. Record "array" only for string items and leave the rest untyped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): read array item types from nullable lists and enums The previous commit left arrays with no plain item type untyped, which sent string enum and $ref items through the numeric control heuristic and changed the request-server and watch-provider forms. Read the item type from a nullable type list or a uniform enum instead, and keep any other array as a plain pass-through array, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): follow local $ref item schemas when typing array fields An array whose items are a local reference such as "#/$defs/id" typed as a plain array, so the plugin settings form saved integer selections as strings where main coerced them. Resolve one local $defs or definitions reference before reading the item type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): decode JSON Pointer escapes in local $ref names A local reference such as "#/$defs/a~1b" names the definition "a/b". Decode "~1" and "~0" before looking the name up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): keep null items when saving a boolean array Since #4176 a saved multi-select list loads into the form as is, so an untouched nullable boolean list such as [null] reached coerceBoolean and saved as [false]. Leave null items unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Problem
Related issue: N/A
Validation tasks: none
Other clients: N/A (plugin settings are edited only in web admin)
Saving a plugin's settings in web admin erases any saved value in a multi-select field. The form loads the saved list as an empty string and sends back
[], so changing any other field and saving clears the selection. Plugins that declare aMULTI_SELECTfield in a global or connection config schema are affected. No Silo-Server plugin declares one today, so this hits third-party plugins built on the SDK's multi-select control. The admin sign-in setup page loads saved values the same way.formValueForFieldinweb/src/components/admin/plugins/configSchemaAdminForm.tskept strings, numbers, and booleans and replaced anything else with the field default ("").buildSchemaValuesthen turns""into[]for a multi-select field.Once #3923 merges, the same untouched form would also make a connection test treat the entry as changed (
[]against the stored list) and run without the saved secret.Approach
formValueForFieldnow returns a saved list unchanged when the field is aMULTI_SELECT. Other controls behave as before. Web only.Follow-up: #4179 keeps numeric-looking string selections as strings on save, a separate bug that is already on
main.Validation
tags: ["a", "b"], rebuild the save payload): fails onmainwithexpected { tags: [] } to deeply equal { tags: [ 'a', 'b' ] }, passes on this branch.pnpm run lint,format:check,build,budget:check, andmake test-web: pass.make verify-local-paths,make verify-size-ratchet: pass.Evidence
Nothing changes on screen for the shipped plugins. The test runs on
mainand on this branch are on the evidence page.Evidence: https://evidence.siloserver.org/r/silo-server/plugin-form-multi-select/
Risks
None identified. Only a saved list on a multi-select field loads differently.
Checklist
AI Disclosure
mainand goes in a separate fix.🤖 Generated with Claude Code
Note
Fix saved multi-select values being dropped in plugin settings forms
Previously, opening a plugin settings form reset a saved MULTI_SELECT field to its default because
formValueForFielddid not handle arrays. It now returns the saved array for MULTI_SELECT fields, keeping the selection intact when converting config values to form values. Adds a regression test in configSchemaAdminForm.test.ts covering the round-trip throughformValuesFromConfigandbuildSchemaValues.Macroscope summarized 04a5128.