Repository navigation
FIX: Share common scenario parameter names between launch form and preset editor - #4593
hannahwestra25 wants to merge 1 commit into
Conversation
…eset editor The preset editor kept a stale private copy of COMMON_SCENARIO_PARAMETER_NAMES, so scoring_target rendered as a raw text field there. Use the launch form's exported set, add operation_id to mirror the backend, and document why incompatible_technique_policy stays editable. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change unifying scenario parameters across the launch form and preset editor.
No open issues 🎉
What changed in this PR
Unifies the common scenario parameter names used by the launch form and preset editor, preventing drift and hiding the unintended scoring_target field in the editor.
Changes:
- Reuses one shared, read-only parameter set and adds
operation_id. - Clarifies why
incompatible_technique_policyremains editable. - Adds regression coverage confirming that stored scoring targets are preserved while the technique policy stays editable.
| File | Description |
|---|---|
frontend/src/components/Scenarios/scenarioLaunchRequest.ts |
Makes the shared set read-only, adds operation_id, and clarifies its documentation. |
frontend/src/components/Scenarios/scenarioConfigForm.ts |
Imports the shared set instead of maintaining a separate copy. |
frontend/src/components/ScenarioPresets/scenarioPresetForm.test.ts |
Tests scoring-target preservation and technique-policy editability. |
Review effort: Balanced
| getInitialFormValues, | ||
| type ParameterFormValue, | ||
| } from '@/components/Parameters/parameterForm' | ||
| import { COMMON_SCENARIO_PARAMETER_NAMES } from '@/components/Scenarios/scenarioLaunchRequest' |
There was a problem hiding this comment.
[P3] Share the filter, not only the name set. This PR shares the name set, but the two forms still filter with two functions: dynamicScenarioParameters here (lines 91-95, used by the preset editor) and scenarioDynamicParameters in scenarioLaunchRequest.ts (lines 88-93, used by the launch form). If a later change adds a hiding rule to only one function, the preset editor again shows a field that the launch form hides. This happened before: #4132 added isScorerOwnedParameter to the launch filter only. The two functions return the same list today only because supported_parameters is a subset of supported_parameter_names. To fix, import scenarioDynamicParameters from ./scenarioLaunchRequest, delete dynamicScenarioParameters, and change its call sites (this file line 112; scenarioPresetForm.ts lines 43, 70, 82, 131; ScenarioPresetEditor.tsx line 216). Then COMMON_SCENARIO_PARAMETER_NAMES can be private to its module again. This is non-blocking; a follow-up PR is also fine.
| getInitialFormValues, | ||
| type ParameterFormValue, | ||
| } from '@/components/Parameters/parameterForm' | ||
| import { COMMON_SCENARIO_PARAMETER_NAMES } from '@/components/Scenarios/scenarioLaunchRequest' |
There was a problem hiding this comment.
[P3] Use a relative import for this same-folder module. The frontend style guide says to use relative imports (./foo) for files in the same feature directory, in a local group after the @/ imports. This file and scenarioLaunchRequest.ts are both in components/Scenarios, and ScenarioDetail.tsx and scenarioLaunchForm.ts already import ./scenarioLaunchRequest. Change this line to import { COMMON_SCENARIO_PARAMETER_NAMES } from './scenarioLaunchRequest' and move it to its own group after the @/types import.
Richard Lundeen (richlundeen)
left a comment
There was a problem hiding this comment.
Automated review completed. No blocking concerns remain. This review records source coverage; merging is handled separately.
[P3] inline:4690662488: Finding C1 (posted by this run). Supported, not fixed at head: the preset editor's dynamicScenarioParameters (scenarioConfigForm.ts:91-95; call sites scenarioConfigForm.ts:112, scenarioPresetForm.ts:43/70/82/131, ScenarioPresetEditor.tsx:216) and the launch form's scenarioDynamicParameters (scenarioLaunchRequest.ts:88-93) remain two filters for one concept; #4132 previously added a hiding rule to only the launch filter. They return the same list today because supported_parameters is a subset of supported_parameter_names, so there is no wrong runtime behavior. The duplication predates the PR and the PR does not extend it (it removed the duplicated data that actually diverged), so P3 non-blocking hardening; fix is to use scenarioDynamicParameters from './scenarioLaunchRequest' and delete dynamicScenarioParameters. Verified in code_review\4593-20261124-2029\feedback\feedback.json and should_approve_pr\4593-20261124-2029\feedback.json.
[P3] inline:4690662495: Finding C2 (posted by this run). Supported, not fixed at head: scenarioConfigForm.ts:6 imports COMMON_SCENARIO_PARAMETER_NAMES from '@/components/Scenarios/scenarioLaunchRequest' inside components/Scenarios; the frontend style guide requires './' imports within a feature directory, and sibling files (scenarioLaunchForm.ts:13, ScenarioDetail.tsx:106) use './scenarioLaunchRequest'. Added by this PR; convention-only with no runtime effect, so P3. Subsumed if C1's fix is adopted. Verified in code_review\4593-20261124-2029\feedback\feedback.json and should_approve_pr\4593-20261124-2029\feedback.json.
Description
The preset editor and the launch form each had their own copy of
COMMON_SCENARIO_PARAMETER_NAMES, and they had drifted apart. As a result, the preset editor showedscoring_targetas a raw text field even though the launch form hides it. This PR removes the editor's private copy so both forms use one shared set.scenarioConfigForm.tsnow imports the exported set fromscenarioLaunchRequest.tsinstead of keeping its own.operation_idto the shared set so it matches the backend's common parameters. The launch form already has its own operation control for it.incompatible_technique_policyis still shown as a field on purpose. It has no dedicated control, and the backend reads it fromscenario_params, so this field is the only way to set it. The set's JSDoc now explains this.scoring_targetis carried through unchanged byuneditableScenarioParamswhen the preset is edited, and bycarriedPresetScenarioParamswhen it is launched.Correction to the original report:
dataset_overrides,local_technique_factory, andoperation_idare declaredopaque.scenario_service.pyonly sends parameters whereis_external_inputis true, so these three never reach the UI and never showed up as fields in the preset editor. They stay in the set to mirror the backend.scoring_targetwas the only one that actually appeared.