Skip to content

FIX: Share common scenario parameter names between launch form and preset editor - #4593

Open
hannahwestra25 wants to merge 1 commit into
microsoft:mainfrom
hannahwestra25:hannahwestra25-unify-common-scenario-param-names
Open

hannahwestra25 wants to merge 1 commit into
microsoft:mainfrom
hannahwestra25:hannahwestra25-unify-common-scenario-param-names

Conversation

@hannahwestra25

Copy link
Copy Markdown
Collaborator

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 showed scoring_target as 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.ts now imports the exported set from scenarioLaunchRequest.ts instead of keeping its own.
  • Added operation_id to the shared set so it matches the backend's common parameters. The launch form already has its own operation control for it.
  • incompatible_technique_policy is still shown as a field on purpose. It has no dedicated control, and the backend reads it from scenario_params, so this field is the only way to set it. The set's JSDoc now explains this.
  • Saved presets keep working. A stored scoring_target is carried through unchanged by uneditableScenarioParams when the preset is edited, and by carriedPresetScenarioParams when it is launched.

Correction to the original report: dataset_overrides, local_technique_factory, and operation_id are declared opaque. scenario_service.py only sends parameters where is_external_input is 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_target was the only one that actually appeared.

…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>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 18:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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_policy remains 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'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

3 participants