fix(rules): Sanitize legacy Rule dynamic_form_fields choice labels#116081
fix(rules): Sanitize legacy Rule dynamic_form_fields choice labels#116081priscilawebdev wants to merge 4 commits into
Conversation
#115855 backfilled `workflow_engine_action.data.dynamic_form_fields[*].choices` to recover or coerce labels left as JSON-stripped React elements (`{key, ref, props}`) by the old AbstractExternalIssueForm. The same corruption exists in `Rule.data["actions"][*]["dynamic_form_fields"][*]["choices"]` for legacy issue-alert rules — those use the same TicketRuleModal under the hood and crash the same way. Walk the Rule table, restrict to known ticket-creation action ids, and apply the same `_extract_choice_label` strategy: pull readable text from `props.children` when present, otherwise replace the broken label with the choice value so the row at least renders. Post-deploy migration; runs manually after the backend code deploys. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
This PR has a migration; here is the generated SQL for for --
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL |
One assert per test gives clearer failure output than the single multi-block test_migration. Also drops a stale `self.apps_before` reference that would have AttributeError'd if the class were ever unskipped — use the live Rule model in setup, matching #115855's style. Co-Authored-By: Claude Opus 4.7 <[email protected]>
…ule-choice-labels
|
@priscilawebdev we are no longer using the old Rule models, all users are now on the new UI (aside from just a couple exceptions). The old models will be deleted soon, so I don't think this is necessary. The linked Sentry error shows an example that was fixed by #115855 |
…oices.py Co-authored-by: Mark Story <[email protected]>
Backend Test FailuresFailures on
|
Oh nice! I was not aware of that. Will close this PR. Thank you! |
Companion to #115855, which backfilled
workflow_engine_action.data.dynamic_form_fields. The same corruption (React element labels serialized into{key, ref, props}shells) exists on the legacyRulemodel atRule.data["actions"][*]["dynamic_form_fields"][*]["choices"], and the sameTicketRuleModalcrashes on it.Post-deploy migration that walks
Rule, restricts to known ticket-creation action ids, and applies the same_extract_choice_labelstrategy: pull readable text fromprops.childrenwhen present, fall back to the choice value otherwise.Redash query: https://redash.getsentry.net/queries/11297/source
Refs JAVASCRIPT-3921