You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web): keep string selections as strings in plugin settings saves - #4179
Related issue: N/A
Validation tasks: none (reaches #1225 C1 and C2; first-party plugin saves are unchanged, see Validation)
Other clients: N/A (web admin only; no client shows plugin settings)
When an admin saves plugin settings in the web admin, a multi-select whose options are numeric-looking strings saves as numbers. Selecting "001" and "123" saves [1, 123]. That changes the value, and a plugin whose config schema declares a string array can reject it. The same happens on the Sign-in settings page. No first-party plugin has a multi-select in its global or connection settings, so this hits third-party plugins.
The plugin settings form and the Sign-in page built the saved entry without the schema's declared field types. Without them, buildSchemaValues falls back to a guess from the control, and for a multi-select that guess converts every all-digit string to a number. #4176, now merged, loads a saved multi-select list into the form as is, so on main even saving an untouched form re-sends a saved string list as numbers.
Approach
PluginConfigForm and stagedEntry now pass parseFieldTypes(json_schema) to buildSchemaValues for saves, connection tests, and draft reports, as the request-server and watch-provider forms already do. With a declared type, a field coerces by its schema. A field the schema doesn't type keeps the control-based guess. parseFieldTypes also reads an array's item type from a nullable type list (["integer", "null"]), a uniform enum, or a local #/$defs/ reference, so a numeric enum or $ref multi-select still saves numbers. An array whose item type it can't resolve (anyOf, a remote reference, no items) passes values through unchanged, as it already did for the forms that pass field types.
Validation
Two focused tests (the settings form's save and stagedEntry) fail on main with the reported coercion ([1, 123], [7]) and pass on this branch.
The parseFieldTypes test covers numeric and string enum items, a nullable item type, and resolved and unresolved $ref items. It fails on main and on this PR's earlier heads.
Not reproduced live: no first-party plugin can produce the state on a dev deployment.
First-party plugins: a throwaway check (not committed) loaded the current manifests of all 17 first-party plugins and saved each field of their 28 config forms with sample values, with and without declared types. All 612 field/value pairs saved the same value, so plugin-management cases Plugin management / marketplace — Web admin #1225 C1 and C2 are unaffected.
Web lint, format check, build, bundle budget, and the local-path, case-collision, size-ratchet, and bidi checks pass.
make test-web: one unrelated failure, a CuratedTitlesEditor timeout under full-suite load. That test passed 3 of 3 runs on its own. No Go files changed.
A third-party plugin whose admin control disagrees with its declared type now saves what the schema declares. For example, a numeric control on a string property now saves a string, and a text control on an integer property saves a number. One case gets worse: a field the schema declares as an array of strings but shows as a text box now saves an empty list where it used to save the typed text. The plugin's schema would already reject that text, and request-server forms already behave this way. In this form, an array whose item type can't be resolved (anyOf, a remote reference) now saves strings where main guessed numbers. The forms that already pass field types gain only the nullable, enum, and local $ref item cases.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
The Evidence section shows every change a user can see, or how I checked a change nobody sees.
AI Disclosure
Harness: Claude Code in T3 Code
Tool(s): Claude Code, T3 Code
Model(s): claude-opus-5-5
Involvement: Fully AI-generated, human verified
Adversarial review: the code review ran at low level, one pass over the diff, with no findings. The plan round was skipped because the fix is mechanical: the source shows the root cause, and the fix passes declared types the same way existing callers do. The simplify pass found nothing to change. The background adversarial review (gpt-6.1-sol, Codex, reviewed bd90c64) found nothing new. Review found that arrays with enum, $ref, or nullable item schemas lost their item type; 4254bd9 through 04affdc resolve item types from nullable lists, enums, and local references (with JSON Pointer escapes decoded), 38c6f70 keeps null items in boolean arrays, and keep unresolved arrays as pass-through.
Preserve string selections when saving plugin settings with schema types
Adds parseFieldTypes parsing of plugin JSON Schemas so buildSchemaValues coerces values according to declared field types. This keeps numeric-looking selections like "007" as strings when the schema declares string array items.
arrayItemType in schemaFormUtils.ts detects item types from nullable type lists, homogeneous enums, and local $defs/definitions references (with JSON Pointer escape decoding).
Applies the schema types in PluginConfigForm.tsx for draft staging, secret clearing, connection tests, and saves, and in the stagedEntry helper in signInSetup.ts.
Behavioral Change: null items in schema-declared boolean arrays now remain null instead of becoming false.
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>
Array item type inference now supports additional JSON Schema forms, including local references and homogeneous enums. Plugin configuration and sign-in staging pass parsed field types to value building.
Changes: Schema-aware configuration staging
Layer / File(s)
Summary
Array item type inference web/src/components/admin/plugins/schemaFormUtils.ts, web/src/components/admin/plugins/schemaFormUtils.test.ts
Array item types are inferred from scalar types, nullable type lists, homogeneous enums, and supported local references. Tests cover integer, nullable-integer, string-enum, and unresolved-reference cases.
Use parsed types when staging values web/src/components/admin/plugins/PluginConfigForm.tsx, web/src/components/admin/plugins/PluginConfigForm.test.tsx, web/src/pages/admin-settings/signInSetup.ts, web/src/pages/admin-settings/signInSetup.test.ts
Plugin draft notifications, connection tests, and saves use values built with parsed field types. Sign-in staged entries also use parsed field types. Tests check that numeric-looking string selections remain strings.
Numeric-looking strings in multi-select settings now stay strings when the schema declares string items. Two rare edge cases remain: a nullable boolean array item saved as false instead of null, and definition names containing "/" or "~" resolving to the wrong schema. Both are minor and can be fixed or accepted by the owner.
Security architecture risk: Minimal · up to 0f7ab
The change makes configuration values follow their declared schema types without introducing new endpoints or privileges. No introduced or worsened security, ownership or failure-containment risk was established in the inspected flows.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
observed — The affected values reach existing configuration and test requests for explicitly selected plugin installations, including sign-in providers. The impact is configuration serialization, not merely display formatting.
Security Findings and Attack Paths
observed — The new reference resolver accepts only same-document $defs or definitions references. It performs no external fetch or recursive reference traversal, so this addition does not create a schema-driven network request path.
Trust Boundaries and Controls
observed — The inspected mutation paths retain installation IDs and captured profile context, disable automatic mutation retries and authentication retries, and check profile authority after responses. The normal plugin mutation path also snapshots request bodies and checks authority before dispatch. These client controls are unchanged; server authorization was not independently assessed.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: string multi-select selections such as "001" are kept as strings in plugin settings saves. The changeset adds parseFieldTypes use in PluginConfigForm and stagedEntry, …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description is specific and on-topic. It names the bug (numeric-looking strings such as "001" and "123" saved as numbers in plugin settings and the Sign-in page), the affected files (PluginConfigF…
Full details: Title check
Explanation
The title names the main change: string multi-select selections such as "001" are kept as strings in plugin settings saves. The changeset adds parseFieldTypes use in PluginConfigForm and stagedEntry, plus array item type inference in schemaFormUtils.ts. The title's "fix(web)" prefix and "plugin settings" wording match the scope of the diff. The Sign-in settings page is also touched, but the title does not need to cover every detail.
Full details: Description check
Explanation
The description is specific and on-topic. It names the bug (numeric-looking strings such as "001" and "123" saved as numbers in plugin settings and the Sign-in page), the affected files (PluginConfigForm, stagedEntry, parseFieldTypes), the fix approach, validation, and risks. It matches the changeset in the raw summary, so the check passes.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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>
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
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>
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
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>
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugSomething isn't workingjavascriptPull requests that update javascript codepriority: P2Limited scope, workaround exists, or polishsize/M50–199 added + deleted lines (all files); change volume, not priority.
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: N/A
Validation tasks: none (reaches #1225 C1 and C2; first-party plugin saves are unchanged, see Validation)
Other clients: N/A (web admin only; no client shows plugin settings)
When an admin saves plugin settings in the web admin, a multi-select whose options are numeric-looking strings saves as numbers. Selecting
"001"and"123"saves[1, 123]. That changes the value, and a plugin whose config schema declares a string array can reject it. The same happens on the Sign-in settings page. No first-party plugin has a multi-select in its global or connection settings, so this hits third-party plugins.The plugin settings form and the Sign-in page built the saved entry without the schema's declared field types. Without them,
buildSchemaValuesfalls back to a guess from the control, and for a multi-select that guess converts every all-digit string to a number. #4176, now merged, loads a saved multi-select list into the form as is, so on main even saving an untouched form re-sends a saved string list as numbers.Approach
PluginConfigFormandstagedEntrynow passparseFieldTypes(json_schema)tobuildSchemaValuesfor saves, connection tests, and draft reports, as the request-server and watch-provider forms already do. With a declared type, a field coerces by its schema. A field the schema doesn't type keeps the control-based guess.parseFieldTypesalso reads an array's item type from a nullable type list (["integer", "null"]), a uniformenum, or a local#/$defs/reference, so a numericenumor$refmulti-select still saves numbers. An array whose item type it can't resolve (anyOf, a remote reference, noitems) passes values through unchanged, as it already did for the forms that pass field types.Validation
stagedEntry) fail on main with the reported coercion ([1, 123],[7]) and pass on this branch.nullitems, so an untouched saved[null]no longer saves as[false]. Its test fails on the previous head.parseFieldTypestest covers numeric and stringenumitems, a nullable item type, and resolved and unresolved$refitems. It fails on main and on this PR's earlier heads.make test-web: one unrelated failure, aCuratedTitlesEditortimeout under full-suite load. That test passed 3 of 3 runs on its own. No Go files changed.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/plugin-config-multiselect-string-types/
Risks
A third-party plugin whose admin control disagrees with its declared type now saves what the schema declares. For example, a numeric control on a string property now saves a string, and a text control on an integer property saves a number. One case gets worse: a field the schema declares as an array of strings but shows as a text box now saves an empty list where it used to save the typed text. The plugin's schema would already reject that text, and request-server forms already behave this way. In this form, an array whose item type can't be resolved (
anyOf, a remote reference) now saves strings where main guessed numbers. The forms that already pass field types gain only the nullable,enum, and local$refitem cases.Checklist
AI Disclosure
enum,$ref, or nullable item schemas lost their item type; 4254bd9 through 04affdc resolve item types from nullable lists, enums, and local references (with JSON Pointer escapes decoded), 38c6f70 keeps null items in boolean arrays, and keep unresolved arrays as pass-through.🤖 Generated with Claude Code
Note
Preserve string selections when saving plugin settings with schema types
parseFieldTypesparsing of plugin JSON Schemas sobuildSchemaValuescoerces values according to declared field types. This keeps numeric-looking selections like "007" as strings when the schema declares string array items.arrayItemTypein schemaFormUtils.ts detects item types from nullable type lists, homogeneous enums, and local$defs/definitionsreferences (with JSON Pointer escape decoding).stagedEntryhelper in signInSetup.ts.false.Macroscope summarized 38c6f70.