Skip to content

MAINT: split ScenarioDetail state into hooks and sections - #3526

Merged
Roman Lutz (romanlutz) merged 9 commits into
microsoft:mainfrom
u7k4rs6:refactor/scenario-detail-state
Nov 6, 2026
Merged

Roman Lutz (romanlutz) merged 9 commits into
microsoft:mainfrom
u7k4rs6:refactor/scenario-detail-state

Conversation

@u7k4rs6

@u7k4rs6 Utkarsh Bahuguna (u7k4rs6) commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

ScenarioDetail owned loading, the launch form, debounced estimates and launch confirmation all in one 1700 line component.
This moves loading into useScenarioDetail, the related form fields into a reducer, estimates into useScenarioRunEstimate (debounce and stale answers) and the confirm/launch flow into useScenarioLaunch (one run per double click).
The estimate and the run request are now built from the same launch input, and the technique list, estimate summary and run preview are their own components.
Nothing changes for the user: the existing ScenarioDetail tests pass untouched, and there are new focused tests for each piece.

Fixes #2653

Changing max concurrency or max retries rebuilt an identical estimate request
object, which re-triggered the estimate effect and re-POSTed the same estimate
after the debounce. Drive the effect off the request key instead.
@u7k4rs6

Utkarsh Bahuguna (u7k4rs6) commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Good catch. Fixed in b2d8057, the estimate effect now keys off the request key instead of the request object, so changing max concurrency or max retries no longer re-POSTs the same estimate. Added a test for it.

Resolves the ScenarioDetail.tsx conflict against the preset one-click launch (microsoft#3490) and the objective-scorer and prompt support (microsoft#3584) that landed on main. Both features touched the monolithic launch form that this branch split into hooks and sections, so the feature logic is folded into the extracted pieces: the preset scenario-param merge, objective scorer, and supportsPrompt handling go into scenarioLaunchRequest, the preset technique and param seeding into scenarioLaunchForm with preset tokens preserved across reselection, the pinned-token tags into ScenarioTechniqueSection, and the objective-scorer and carried-param rows into ScenarioRunPreviewDialog. The preset fetch moves into a useScenarioPreset hook mirroring useScenarioDetail.
Copilot AI balanced review requested due to automatic review settings November 2, 2026 07:52

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Main landed four more feature PRs in the old monolithic ScenarioDetail.tsx (consolidated
history, last-used defaults, scan results routes, contextual help). They are folded into the
split modules instead: saved-run seeding goes to the form initializer, help labels and the
unavailable-estimate message to ScenarioEstimateSection, the identity toggle to
ScenarioTechniqueSection, and the saved-run guards, routes, remembered scan targets and help
fields to ScenarioDetail.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Restore initial carried-parameter ownership and cover preset and saved-run refresh transitions. Replace ineffective unmount assertions with mounted stale-response regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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; it does not authorize merge.

@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Nov 6, 2026
Merged via the queue into microsoft:main with commit 0f5f658 Nov 6, 2026
53 checks passed
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.

MAINT Decompose ScenarioDetail launch and estimate state

4 participants