Repository navigation
Fixes 30612: render every custom-property type correctly in intake forms #30614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
eff568c
fix(intake-forms): render every custom-property type correctly in cre…
harshach 15be278
Update generated TypeScript types
github-actions[bot] 3d7d2b4
Merge branch 'main' into harshach/intake-form-property-bug
harshach c96a4af
fix(intake-forms): version the custom-property prune via EntityUpdater
harshach 50a1f68
fix(intake-forms): guard non-finite numbers, empty tables, markdown v…
harshach 41ee01a
fix(intake-forms): render glossary intake fields with UntitledUI, not…
harshach 80719e4
style(intake-forms): apply prettier formatting
harshach 3f39edb
fix(migrations): survive a non-array requiredFields when backfilling …
harshach 1802f04
style(intake-forms): satisfy the src ESLint + organize-imports checks…
harshach 3aae80c
fix(intake-forms): emit a change event for the custom-property prune
harshach aa215c4
Removed alert based helperText and nit picks
anuj-kumary 3a4b624
Merge branch 'harshach/intake-form-property-bug' of https://github.co…
anuj-kumary 910c84f
nit
anuj-kumary 0054185
fix ui checkstyles
anuj-kumary b98ccc0
fix route glossary import/export spec to the ImportExport lane
anuj-kumary 7de0565
ci(playwright): let impact-map select specs moved to the ImportExport…
harshach 6fd0af9
fix(e2e): stabilize multi-enum Autocomplete selection in IntakeForm spec
anuj-kumary 48de6c3
Merge branch 'main' into harshach/intake-form-property-bug
anuj-kumary 5ded29b
Removed custom properties label
anuj-kumary 1a36e80
fix lint issue
anuj-kumary 4cd0bc3
fix unit test
anuj-kumary 1551000
fix(e2e): drop stale Custom Properties heading assertions in IntakeFo…
anuj-kumary da0745c
fix(e2e): fix two more flaky interactions in IntakeForm custom-proper…
anuj-kumary 2c575af
nit
anuj-kumary 7e8e9eb
fix lint checks
anuj-kumary fe71f40
fix playwright nit and lint checks
anuj-kumary d42382b
Merge branch 'main' into harshach/intake-form-property-bug
anuj-kumary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| -- Backfill IntakeForm formFields from the legacy requiredFields representation. | ||
| -- requiredFields is only trusted when it is actually an array, and only object | ||
| -- entries are carried over, so a JSON null or scalar left by an older write can | ||
| -- never turn into a malformed formFields array. | ||
| UPDATE intake_form_entity AS intake_form | ||
| SET json = JSON_SET( | ||
| json, | ||
| '$.formFields', | ||
| COALESCE( | ||
| ( | ||
| SELECT JSON_ARRAYAGG( | ||
| JSON_SET(required_field.field_json, '$.required', CAST('true' AS JSON)) | ||
| ) | ||
| FROM JSON_TABLE( | ||
| CASE | ||
| WHEN JSON_TYPE(JSON_EXTRACT(intake_form.json, '$.requiredFields')) = 'ARRAY' | ||
| THEN JSON_EXTRACT(intake_form.json, '$.requiredFields') | ||
| ELSE JSON_ARRAY() | ||
| END, | ||
| '$[*]' COLUMNS (field_json JSON PATH '$') | ||
| ) AS required_field | ||
| WHERE JSON_TYPE(required_field.field_json) = 'OBJECT' | ||
| ), | ||
| JSON_ARRAY() | ||
| ) | ||
| ) | ||
| WHERE JSON_CONTAINS_PATH(json, 'one', '$.requiredFields') | ||
| AND NOT JSON_CONTAINS_PATH(json, 'one', '$.formFields'); | ||
|
Copilot marked this conversation as resolved.
Resolved
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| -- Backfill IntakeForm formFields from the legacy requiredFields representation. | ||
| -- requiredFields is only trusted when it is actually an array: jsonb_array_elements | ||
| -- raises "cannot extract elements from a scalar" on a JSON null or scalar value, | ||
| -- which would abort the whole upgrade for one malformed row. Non-object entries | ||
| -- are skipped for the same reason. | ||
| UPDATE intake_form_entity | ||
| SET json = jsonb_set( | ||
| json, | ||
| '{formFields}', | ||
| COALESCE( | ||
| ( | ||
| SELECT jsonb_agg(required_field.field_json || '{"required": true}'::jsonb) | ||
| FROM jsonb_array_elements( | ||
| CASE | ||
| WHEN jsonb_typeof(json -> 'requiredFields') = 'array' | ||
| THEN json -> 'requiredFields' | ||
| ELSE '[]'::jsonb | ||
| END | ||
| ) AS required_field(field_json) | ||
| WHERE jsonb_typeof(required_field.field_json) = 'object' | ||
| ), | ||
| '[]'::jsonb | ||
| ) | ||
| ) | ||
| WHERE jsonb_exists(json, 'requiredFields') | ||
| AND NOT jsonb_exists(json, 'formFields'); |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we need this migration to 2.0 as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed here, 1.13.3 will be executed for 2.0 as well.
Any migration in lower versions not executed will be executed in higher versions, so its fine