Repository navigation
Description
Is your feature request related to a problem? Please describe.
frontend/src/components/Scenarios/ScenarioDetail.tsx owns scenario/target loading, retry and error states, technique and aggregate-tag selection, dataset overrides and filters, dynamic parameter values, run-request validation, debounced estimates, stale-estimate suppression, launch confirmation, duplicate-submit prevention, and the complete form UI.
The request builders are already mostly pure, but the surrounding estimate and launch state spans many independent useState, useMemo, useEffect, and ref guards. This makes it difficult to verify that preview, estimate, validation, and launch all use the same effective configuration and that asynchronous results cannot overwrite newer input.
Describe the solution you'd like
Extract cohesive data and workflow boundaries while retaining ScenarioDetail as the page-level composition component. Candidate boundaries include:
- a data-loading hook for scenario and target loading, retry, not-found, and error states;
- a typed launch-form reducer or hook for target, techniques, baseline, datasets, filters, concurrency, retries, and dynamic parameters;
- an estimate hook responsible for debounce, request identity, cancellation/stale-response suppression, and estimate state;
- a launch hook responsible for confirmation, request submission, duplicate-submit prevention, and API errors;
- smaller presentational sections for target, technique, dataset, dynamic-parameter, estimate, and confirmation UI.
Keep buildEstimateRequest and buildRunRequest pure and ensure both consume the same typed effective form state. Do not duplicate normalization or validation across hooks and components.
Reuse the shipped useScenarioDatasets/ScenarioDatasetTable and datasetPresentation, scenarioPresetSeed, useRunTechniqueEditor/TechniqueEditor, ChatScorerPicker, and shared parameter controls. Named dataset settings, preset seeding, configured-scorer selection, and single-technique/converter editing are already present. This issue extracts their surrounding state ownership; it does not add another launch form or rebuild those controls.
Preserve route behavior, request payloads, defaults, baseline constraints, technique-tag semantics, dataset parsing, dynamic parameter handling, estimate debounce timing, stale-request protection, confirmation flow, duplicate-submit protection, accessibility, and user-visible errors.
Describe alternatives you've considered, if relevant
Extracting only the form sections would shorten the JSX but leave asynchronous estimate and launch ownership coupled. Moving every state variable into one large hook would move the complexity without making transitions explicit. A reducer is most useful for related form fields; loading, estimation, and submission should remain separate workflows.
Additional context
This was identified during the September 14, 2026 maintainability audit. Scope refreshed against main 791e12c6e5e4302e7c1211af6af8973aa6fe1f37 on October 31, 2026.
Existing work: assigned to u7k4rs6 and covered by open #3526. The earlier requested waits for #3206, #3030, and #2931 are satisfied: all three are merged. Continue the existing PR rather than start a competing decomposition. At this check #3526 still has an unresolved estimate-request thread; its author's request-key fix is not independently validated by this issue audit.
This is behavior-preserving maintenance, not proof that all Scenario GUI scopes 5-6 are complete. Their remaining compatibility explanations, effective-selection/preset/launch consistency, and current interaction acceptance must be assessed separately. A mandatory separate named-set/Custom mode is no longer part of that roadmap.
Suggested regression coverage:
- scenario/target load success, retry, not-found, and failure;
- technique, aggregate-tag, and baseline selection rules;
- dataset overrides, filters, dynamic parameters, and default maximum size;
- estimate debounce and stale-response suppression after rapid changes;
- parity between preview/estimate input and final run request;
- invalid request states and user-visible errors;
- confirmation cancellation and successful launch;
- two launch attempts in the same tick creating only one request;
- effect cleanup during navigation/unmount.
Definition of done:
- loading, form state, estimation, and submission have explicit typed ownership and focused tests;
- estimate and launch use one canonical effective form state;
ScenarioDetailprimarily composes the page and presentational sections;- no route, backend API, accessibility, or user-visible behavior changes;
- frontend unit tests, type-check, lint, and formatting pass.
Activity
Beautyl0ve commentedon Sep 14, 2026
I'd like to take this. I will keep
ScenarioDetailas the page-level composition boundary and extract cohesive ownership for data loading, typed effective form state, debounced/stale-safe estimation, and duplicate-safe launch submission. The estimate and launch paths will consume the same canonical effective state, with focused tests for request parity, stale responses, cleanup, and duplicate submission. I will preserve the existing route, payload, accessibility, and user-visible behavior, and will open a focused PR after the frontend unit tests, type-check, lint, and build pass.romanlutz commentedon Oct 14, 2026
Making this available again!
u7k4rs6 commentedon Oct 17, 2026
Can I take this? Plan is to pull the loading, estimate and launch state into hooks with one form state both request builders use, and leave the UI and payloads alone.
#3206, #3030 and #2931 touch ScenarioDetail too though. Should I wait for those or just start and keep merging main?
romanlutz commentedon Oct 18, 2026
Yes! I would probably wait for those to merge, good point.