ref(plugins): migrate plugin config to BackendJsonSubmitForm#112340
Merged
priscilawebdev merged 23 commits intomasterfrom Apr 14, 2026
Merged
ref(plugins): migrate plugin config to BackendJsonSubmitForm#112340priscilawebdev merged 23 commits intomasterfrom
priscilawebdev merged 23 commits intomasterfrom
Conversation
Base automatically changed from
tkdodo/ref/de-1052-externalissues-to-backendformadapter
to
master
April 9, 2026 09:10
Replace the legacy PluginSettings class component and GenericField rendering with BackendJsonSubmitForm for plugin configuration forms. The plugin config now fetches field definitions via useApiQuery and maps backend field types to the new form adapter, eliminating the dependency on the client-side plugin module system for settings. Refs DE-1054 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
eec026a to
b11e9c3
Compare
Remove blanket `as JsonFormAdapterFieldConfig` casts by pulling default out of the base object so TypeScript can narrow each union member. Drop useMemo/useRef in favor of direct derivation from pluginData, use fetchMutation generic instead of cast, and inline one-liner handler. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a settings-style footer action row with a top divider for the migrated plugin configuration form, and provide a fallback placeholder for secret fields when the backend does not send one. This keeps the migrated UI usable while preserving the existing backend-driven form flow. Co-Authored-By: Codex <noreply@openai.com>
Improve migrated plugin configuration UX by restoring single-select clearability, normalizing legacy empty select options into placeholders, and refreshing plugin data after reset so stale values are not shown. Also simplify plugin config typing around nullable backend fields and enabled state fallback. Co-Authored-By: Codex <noreply@openai.com>
Replace type assertions in plugin config field mapping with runtime narrowing helpers, and parse test-plugin response detail with a runtime guard instead of a typed fetchMutation cast. This keeps mapper behavior explicit for nullable/unknown backend values and avoids unsafe assumptions about response shape. Co-Authored-By: Codex <noreply@openai.com>
Add a singleSelectClearable switch to BackendJsonSubmitForm and enable it only for PluginConfig so legacy plugin repo fields can be cleared without changing other adapter consumers. Also keep plugin config runtime narrowing and placeholder handling improvements. Co-Authored-By: Codex <noreply@openai.com>
Add a short inline comment explaining that reset refetches both plugin list and plugin details to keep toggle state and config values synchronized. Co-Authored-By: Codex <noreply@openai.com>
Avoid seeding plugin config initial values with empty strings when the backend has no saved value. This lets the form adapter fall back to field-specific defaults so booleans submit false and single selects submit null instead of empty strings. Inline the select change handlers in the backend form adapter now that the clearable branches are typed explicitly. Refs DE-1054 Co-Authored-By: OpenAI Codex <noreply@openai.com>
Treat null in initialValues as an intentional override instead of falling through to a field default. This keeps cleared select fields empty even when the backend field declares a default option. Add a regression test covering the submit path for a clearable select with a null initial value. Co-Authored-By: Codex <codex@openai.com>
Backend returns null (Python None) for unconfigured fields. Previously null bypassed typed defaults in computeDefaultValues, causing booleans to submit null instead of false.
Truthiness check treated false and 0 as unconfigured, causing duplicate analytics events on subsequent saves.
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6e3b834. Configure here.
getDetailMessage now JSON-stringifies array and object detail values instead of silently dropping them. Also removes the redundant JSON.stringify at the call site that was double-quoting string details. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
TkDodo
reviewed
Apr 13, 2026
static/app/components/backendJsonFormAdapter/backendJsonSubmitForm.tsx
Outdated
Show resolved
Hide resolved
Replace the form-level isClearable prop with per-field logic: optional select fields are clearable, required ones are not. This is a cleaner API since clearability is inherently tied to whether a field is required. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace manual fetchMutation + useState with useMutation hook. This eliminates the separate testResults state by using mutation.data directly. Also type the response and simplify getDetailMessage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The type is already inferred from fetchMutation's return type. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace manual fetchMutation + try/catch with useMutation hook for the plugin config save request, consistent with the test mutation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These attributes are not referenced in any test, backend code, or stylesheet. Remove dead code from both Panel elements. Co-Authored-By: Claude Opus 4.6 <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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Migrate the project-level plugin configuration forms from the legacy
PluginSettingsclass component +GenericFieldrendering to the newBackendJsonSubmitFormadapter.PluginConfignow fetches field definitions directly viauseApiQueryfrom
GET /projects/{org}/{project}/plugins/{id}/and maps the backendfield types (
bool→boolean,readonly→disabled, etc.) to theJsonFormAdapterFieldConfigshape. This removes the dependency on theclient-side plugin module system (
plugins.get(plugin).renderSettings())for rendering settings.
I considered preserving some plugin-specific legacy UX in the migrated
forms. Jira previously used a multi-step settings flow and SessionStack
used a collapsible advanced section. I did not carry those behaviors
forward here; the migrated form is intentionally flat because restoring
that legacy custom UI did not seem worth the extra complexity for these
hidden/deprecated plugin settings.
closes https://linear.app/getsentry/issue/DE-1054/endpoint-4-get-api0organizationsorgpluginsconfigs