Skip to content

FIX: Keep stored scenario preset list params intact on unrelated edits - #3781

Draft
Mr.X (MRX-72) wants to merge 1 commit into
microsoft:mainfrom
MRX-72:fix-preset-list-params-commas
Draft

Mr.X (MRX-72) wants to merge 1 commit into
microsoft:mainfrom
MRX-72:fix-preset-list-params-commas

Conversation

@MRX-72

Copy link
Copy Markdown
Contributor

Description

Editing only the description of a scenario preset could change its list parameters. The editor shows a stored list as comma-joined text and splits it on commas when it saves. So goals ['Hello, world!', 'Second goal'] were saved as ['Hello', 'world!', 'Second goal']. That changes the preset's behavior, and the backend validators accept both versions, so nothing catches it.

In presetScenarioParams, for a param the preset already stores, I now compare the built value with what the form produces from the stored value with no edits. If they match, the user didn't touch the field and the stored value is kept as-is. If the user edits the field, it is parsed as before.

I did not change the shared comma parsing in parameterForm.ts. The text input is comma-separated, so a comma inside an element is ambiguous once someone edits that field. Handling it there would need a different input, which seemed out of scope here.

Fixes #3754

Tests and Documentation

Added a case to scenarioPresetForm.test.ts. A description-only edit keeps ['Hello, world!', 'Second goal'], and typing a, b into the field still gives ['a', 'b']. The test fails without the change.

Ran jest on ScenarioPresets and Parameters (184 passing), plus tsc --noEmit and eslint on ScenarioPresets. I haven't run the full jest suite.

No docs changed. No notebook or JupyText changes.

The preset editor renders a stored list as comma-joined text and splits it on save, so an element containing a comma became several. Keep the stored value for params the user didn't edit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Description-only preset edits split comma-containing exact goals into separate goals

1 participant