Repository navigation
FEAT: Group the Scanner's Launch tab by scenario module - #4616
Richard Lundeen (richlundeen) merged 24 commits into
Conversation
The Scanner gets Launch | Presets | History tabs. Presets (backend scenario suites) leave the Launch table and get their own tab, where each launchable preset is a card with its scenarios, run sizes, an exact total when every estimate is exact, and Launch with a reason tooltip when unavailable. The Registry's Scenario presets page lists the same presets as cards and manages them at the preset level: New preset with its first scenario, Add scenario, Edit description, Delete, and per-scenario Edit and Remove on the existing suite and preset endpoints. Two-write actions say plainly when the scenario was saved but not added, with Retry. Presets that need attention sort first behind a banner and stay out of the Scanner; editing a scenario other presets share warns first. The preset editor becomes the scenario editor. The old suite and preset libraries, suite editor, scanner visibility switch, and ScannerSuiteSection are removed; /scanner redirects to Launch and old suite routes redirect to the Registry page. GUI copy no longer says "suite". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add scenario and Edit description read the preset from the latest load, and an Add scenario retry re-reads the preset, so a retry after a 409 sends the current version and scenarios instead of failing again. - Scenario issue hints follow the issue: edit or remove for settings the editor can fix, remove for an unregistered scenario, and only the server message for a scenario that is missing or unreadable. - Focus moves to the card's Add scenario after Remove, and in-flight row and card buttons stay focusable. - Edit and Remove share one line; the scenario picker's list opens under the field; Registry cards are h2 under the page's h1. - ScenarioCatalogTable, SuiteCard, ScannerPresetsPage, and ScenarioPicker use their own co-located styles. Drop the unused testId prop, the unused ScannerTab export, and the seeded Playwright storage change no test needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Registry dialog triggers (New preset, Add scenario, Edit, Delete, and each scenario's Edit) are focus restore targets, so closing a dialog returns focus to the button that opened it. Deleting the last preset focuses the New preset button the reload renders. - New preset rejects a name another loaded preset has, as a field error, before saving anything. A conflict that still happens (another user) says so without "suite", and the saved-but-not-added notice reads as full sentences. - When presets exist but none can launch, the Presets tab says none is ready and links to the Registry instead of "No presets yet". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Launch groups scenarios into collapsible module cards (AI Red Team, Garak, ...)
so operators find a scenario quickly and come back to the same view.
- Library: ScenarioRegistry.list_modules() describes each built-in scenario
package from its DISPLAY_NAME and docstring (ScenarioModuleSummary in
pyrit.models), and RegisteredScenario carries its module. The six package
docstrings are rewritten as one-line descriptions.
- Backend: thin GET /api/scenarios/modules.
- Frontend: module cards sorted by display name with Other scenarios last,
collapsed by default, Expand all / Collapse all, search that opens matching
modules ("2 of 10 scenarios"), lists a whole module by name, ignores module
descriptions, and clears on Escape. Open modules live in the URL so Back
restores them; rows open the scenario anywhere in the row; names drop the
module prefix; plain-language load error with details and Retry; the
configure page says "Back to Launch".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Catalog navigation loses search and module expansion state, including across the scan-launch round trip, so returning to Launch incorrectly restores a fully collapsed catalog.
2 open issues
What changed in this PR
Groups the Scanner’s Launch catalog by scenario module, building on the preset-management changes in #4615. Module metadata comes from the registry, keeping the GUI aligned with Python scenario packages.
Changes:
- Adds module summaries, scenario module identifiers, and
GET /api/scenarios/modules. - Introduces collapsible module cards, module-aware search, clickable rows, and URL-backed expansion state.
- Updates navigation, documentation, and tests; the branch also includes the stacked preset-management changes.
| File | Description |
|---|---|
tests/unit/registry/test_scenario_registry.py |
Tests module identification and summaries. |
tests/unit/backend/test_scenario_service.py |
Tests module metadata and endpoint responses. |
pyrit/scenario/scenarios/technique/__init__.py |
Defines Technique display metadata. |
pyrit/scenario/scenarios/garak/__init__.py |
Defines Garak display metadata. |
pyrit/scenario/scenarios/foundry/__init__.py |
Defines Foundry display metadata. |
pyrit/scenario/scenarios/benchmark/__init__.py |
Defines Benchmark display metadata. |
pyrit/scenario/scenarios/airt/__init__.py |
Defines AI Red Team display metadata. |
pyrit/scenario/scenarios/adaptive/__init__.py |
Defines Adaptive display metadata. |
pyrit/registry/registry_metadata.py |
Supports summaries from module docstrings. |
pyrit/registry/components/scenario_registry.py |
Identifies and lists scenario modules. |
pyrit/models/catalog/scenario.py |
Adds canonical module summary fields. |
pyrit/models/catalog/__init__.py |
Exports the module summary model. |
pyrit/models/__init__.py |
Exposes the module summary publicly. |
pyrit/backend/services/scenario_service.py |
Maps and serves module metadata. |
pyrit/backend/routes/scenarios.py |
Adds the module-list endpoint. |
pyrit/backend/models/scenarios.py |
Defines the module-list response. |
pyrit/backend/models/__init__.py |
Exports the response model. |
frontend/src/types/index.ts |
Adds module types and clarifies preset terminology. |
frontend/src/test-utils/scenarioSuiteFixtures.ts |
Adds shared preset test fixtures. |
frontend/src/services/api.ts |
Adds the module-list API client. |
frontend/src/hooks/useScenarioSuiteLibrary.ts |
Loads presets, members, and estimates. |
frontend/src/hooks/useScenarioSuiteLibrary.test.tsx |
Tests preset loading and refresh behavior. |
frontend/src/hooks/useScenarioSuiteExecution.ts |
Updates preset-run error wording. |
frontend/src/hooks/useScenarioCatalog.ts |
Loads modules, scenarios, and estimates. |
frontend/src/hooks/useLaunchModuleState.ts |
Stores expanded modules in the URL. |
frontend/src/hooks/useLaunchModuleState.test.tsx |
Tests module URL-state handling. |
frontend/src/components/ScenarioSuites/suiteRoutes.ts |
Defines preset navigation routes. |
frontend/src/components/ScenarioSuites/suiteRoutes.test.ts |
Updates route coverage. |
frontend/src/components/ScenarioSuites/suiteMembers.ts |
Derives member details and totals. |
frontend/src/components/ScenarioSuites/suiteMembers.test.ts |
Tests member summaries and counts. |
frontend/src/components/ScenarioSuites/SuiteCard.tsx |
Displays launchable preset cards. |
frontend/src/components/ScenarioSuites/SuiteCard.test.tsx |
Tests preset cards and launch controls. |
frontend/src/components/ScenarioSuites/SuiteCard.styles.ts |
Styles preset cards. |
frontend/src/components/ScenarioSuites/ScenarioSuiteLibrary.styles.ts |
Removes obsolete library styles. |
frontend/src/components/ScenarioSuites/ScenarioSuiteExecutionPage.tsx |
Updates preset-run wording and return links. |
frontend/src/components/ScenarioSuites/ScenarioSuiteExecutionPage.test.tsx |
Updates preset-run page assertions. |
frontend/src/components/ScenarioSuites/ScenarioSuiteEditor.styles.ts |
Removes obsolete editor styles. |
frontend/src/components/ScenarioSuites/LaunchSuiteDialog.tsx |
Updates launch-dialog terminology. |
frontend/src/components/ScenarioSuites/LaunchSuiteDialog.test.tsx |
Updates launch-button assertions. |
frontend/src/components/Scenarios/scenarioRunNavigation.ts |
Adds Launch return-state helpers. |
frontend/src/components/Scenarios/scenarioRunNavigation.test.ts |
Tests return paths and labels. |
frontend/src/components/Scenarios/ScenarioPicker.tsx |
Adds a reusable scenario picker. |
frontend/src/components/Scenarios/ScenarioPicker.styles.ts |
Constrains picker dropdown height. |
frontend/src/components/Scenarios/scenarioModules.ts |
Groups, searches, and shortens scenario names. |
frontend/src/components/Scenarios/scenarioModules.test.ts |
Tests module grouping and search. |
frontend/src/components/Scenarios/ScenarioModuleCard.tsx |
Renders collapsible scenario module cards. |
frontend/src/components/Scenarios/ScenarioModuleCard.styles.ts |
Styles descriptions and embedded links. |
frontend/src/components/Scenarios/ScenarioFlow.test.tsx |
Adapts launch-flow tests to module cards. |
frontend/src/components/Scenarios/ScenarioDetail.tsx |
Restores module queries on return links. |
frontend/src/components/Scenarios/ScenarioDetail.test.tsx |
Tests module-aware return navigation. |
frontend/src/components/Scenarios/scenarioConfigForm.ts |
Makes an internal helper private. |
frontend/src/components/Scenarios/ScenarioCatalogTable.styles.ts |
Adds shared responsive table and row-link styles. |
frontend/src/components/Scenarios/ScannerSuiteSection.tsx |
Removes the old Launch suite section. |
frontend/src/components/Scenarios/ScannerSuiteSection.styles.ts |
Removes obsolete suite-section styles. |
frontend/src/components/Scenarios/ScannerPresetsPage.styles.ts |
Styles the dedicated Presets page. |
frontend/src/components/ScenarioPresets/scenarioPresetForm.ts |
Preserves stored visibility without editing it. |
frontend/src/components/ScenarioPresets/scenarioPresetForm.test.ts |
Tests stored visibility preservation. |
frontend/src/components/ScenarioPresets/ScannerVisibilityLabel.tsx |
Removes the visibility control label. |
frontend/src/components/ScenarioPresets/presetRoutes.ts |
Aligns routes with preset-management terminology. |
frontend/src/components/ScenarioPresets/presetRoutes.test.ts |
Removes outdated redirect assertions. |
frontend/src/components/Registry/SuiteDialogs.styles.ts |
Adds shared preset-dialog styles. |
frontend/src/components/Registry/ScenarioPresetRegistry.styles.ts |
Styles the card-based preset registry. |
frontend/src/components/Registry/RegistrySuiteMemberTable.tsx |
Displays members, issues, and editing actions. |
frontend/src/components/Registry/RegistrySuiteMemberTable.styles.ts |
Styles responsive member tables. |
frontend/src/components/Registry/RegistrySuiteCard.tsx |
Adds editable registry preset cards. |
frontend/src/components/Registry/RegistrySuiteCard.styles.ts |
Sizes registry card controls. |
frontend/src/components/Registry/RegistryLayout.tsx |
Updates preset tab wording and selection. |
frontend/src/components/Registry/RegistryLayout.test.tsx |
Updates nested-route tab tests. |
frontend/src/components/Registry/PartialSaveNotice.tsx |
Explains partial saves and retry recovery. |
frontend/src/components/Registry/NewSuiteDialog.tsx |
Creates presets with an initial scenario. |
frontend/src/components/Registry/EditSuiteDialog.tsx |
Edits preset descriptions. |
frontend/src/components/Registry/AddSuiteScenarioDialog.tsx |
Adds scenarios with partial-save recovery. |
frontend/src/components/Layout/FeatureNavigation.tsx |
Adds the Scanner Presets tab. |
frontend/src/components/CollapsibleCard.tsx |
Adds a shared collapsible card component. |
frontend/src/components/CollapsibleCard.test.tsx |
Tests card controls and accessible structure. |
frontend/src/components/CollapsibleCard.styles.ts |
Adds shared responsive card styles. |
frontend/src/App.tsx |
Wires preset pages and legacy redirects. |
frontend/src/App.labels.test.tsx |
Adapts shared-label tests to module navigation. |
frontend/e2e/touch-targets.spec.ts |
Covers preset control touch targets. |
frontend/e2e/themes.spec.ts |
Adds module mocks and preset-page coverage. |
frontend/e2e/scenario-history.spec.ts |
Exercises module-based scenario navigation. |
frontend/e2e/scenario-datasets.spec.ts |
Adapts dataset workflows to preset creation. |
frontend/e2e/scan-launch.seeded.spec.ts |
Covers module returns and preset launches. |
frontend/e2e/onboarding-tour.spec.ts |
Adapts onboarding to collapsed modules. |
frontend/e2e/fixtures/scenario_techniques_backend.py |
Isolates suite storage in the fixture. |
frontend/e2e/fixtures/scenario_dataset_backend.py |
Adds fixture-owned suite storage. |
frontend/e2e/accessibility.spec.ts |
Checks preset-page heading structure. |
doc/gui/0_gui.md |
Documents module grouping and preset workflows. |
Review effort: Balanced
- Keep the Launch search and the cards closed during it in the URL (?q=, ?closed=) next to ?open=, so Back to Launch and browser Back restore the same view. Escape still restores the pre-search modules. - Carry the Launch view through the launched scan: onLaunched forwards launchSearch and the run page's Back to scenario link passes it on. - Report a scenario whose module is missing from the module list as a catalog load error instead of showing a degraded card. - Raise TypeError for a scenario package without DISPLAY_NAME, so the API returns a logged server error, and test every real package. - Describe the Foundry package by what its scenarios do. - Restore tests for searching techniques and datasets, and for hiding the expand control when a description fits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Both issues are fixed in e4a967e. The Launch search and its card state now stay in the URL. A launched scan carries the Launch view back through Back to scenario. A regression test covers each round trip. Verified on published commit |
The Launch search box was controlled by ?q=. Inside the app's nested
routes the router drops flushSync and commits the URL in a transition,
so keys typed before it committed were lost ('prompt_inject' became
'prmpt_inject').
The search box now shows what was typed while the location is one the
hook wrote (marked in location state) or the one typing started from,
and writes ?q= with replace navigation. Any other location, such as
Back or a link, shows its own ?q=. Escape, ?closed= and the return
paths are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The marker on locations the search box wrote was a plain flag, so after typing, opening the Launch tab again, typing, and going Back, the box kept the newer text instead of the earlier entry's ?q=. The marker now holds the key of the location the typing session started from, and the box shows typed text only on locations from that session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Both Launch round-trip issues remain fixed after merging main: the search and module state stay in the URL, and a launched scan carries the Launch view back through Back to scenario. Verified on published commit |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The Launch tab's module listing requires every built-in scenario package to name itself. Main added the promptfoo package without one, so listing modules raised a TypeError. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Main's new ScenarioFlow test clicked the scenario link on the flat catalog. Launch now groups scenarios by module, so the test opens the Other scenarios card first, like the flow test beside it. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Both Launch round-trip issues remain fixed after merging the latest main: the search and module state stay in the URL, and a launched scan carries the Launch view back through Back to scenario. Verified on published commit |
Scenario presets saved by PyRIT 1.2, before presets could hold several scenarios, were stored but shown nowhere in the GUI. The Scenario presets page now lists them under Not in any preset with Edit, Add to preset, and Delete, and the GUI guide tells upgrading users where to find them. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… test The row's link stretches over the whole row and only the description toggle sits above it. The seeded offline scenario now has a description long enough to collapse, and the scan-launch browser test clicks its toggle at both widths, checking that the description expands and the page stays on Launch. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…use before delete - Not in any preset now uses its own wrapping list and styles instead of the member table's, so it stays legible at 390 and 640 px. - Add to preset is disabled with a reason for a scenario with issues, and points to New preset when no stored preset exists. - Delete reads the presets again first and refuses a scenario that a preset now uses; an open confirmation follows reloads. - Tests pin the stored-only filter, the disabled states, and both delete checks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… version
The delete confirmation for a scenario no preset uses now deletes the version
the user confirmed. A reload that brings in another administrator's edit
disables Delete and says the scenario changed, instead of deleting the edit.
Focus moves to New preset when a refused delete or a stale dialog leaves the
opening row gone.
DELETE /api/scenario-presets/{name} now refuses with 409, naming the scenario
suites, while a stored suite references the preset, unless a registered preset
of the same name backs it. The client keeps its own check and explains a 409
from a preset that started using the scenario in between.
A saved scenario this deployment does not register now says it can't be edited
or added to a preset, since the editor cannot edit it.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move the in-use check from the backend service into ScenarioPresetRegistry.delete_preset, so notebook and CLI callers are refused too. ScenarioPresetInUseError is defined next to the other registry errors and exported from pyrit.registry; the service is a plain delegate again and the route keeps its 409 mapping. A stored preset that a registered preset of the same name backs may still be deleted. The GUI no longer lists presets before deleting a scenario. It calls DELETE and, on a 409, re-reads the presets to name the one that uses it. The unavailable-scenario hint now matches the enabled Edit, and ConfirmDialog keeps its opener-gone callback in a ref. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The registry delete-in-use tests imported ScenarioSuite and ScenarioSuiteEntry from pyrit.models.catalog; check_public_imports requires the public package. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- The library refuses to delete a scenario preset while any saved preset can't be read, and the 409 carries the referencing and unreadable preset names as a typed problem; the client shows those names without re-listing presets. - Registry message bars no longer shrink and clip on narrow screens. - Pin that a refused delete keeps focus on the scenario's row. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- A refused delete of a saved scenario shows its reason in that scenario's row, where focus stays, after the reload the delete starts. When the reload moves the row out of the section, the reason shows at the top of the page. - The refusal for unreadable presets names their files and says how to recover; the GUI guide adds the remedy (fix or remove the file, or DELETE the suite). - Long underscore names in the page and row message bars wrap instead of overflowing at narrow widths. - The suite store returns a typed ScenarioSuiteListing and the suite registry a typed ScenarioSuitePresetUsage, sharing one parse loop and one registered-suite merge. A new test pins that a suite registered in code that uses a preset blocks its delete. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…e buttons A refused delete waited for a successful reload before showing its reason, so a failed reload left the reason nowhere. The library now counts finished loads, failed ones included, and the registry settles on that count. A failed load hides the unused section, so the reason then shows at the top. The in-row reason now sits under the row's buttons and scrolls into view without taking focus. The unreadable-preset remedy leads with the newer-PyRIT case, names the store, and matches the GUI doc. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve conflicts with main's Scanner regrouping (microsoft#4616), dataset preparation history fields (microsoft#4228), and strict ESLint rules (microsoft#4779): - Keep the objective scorer picker, unsupported-scorer warning, and scorer-aware leave guard in the edit-only scenario editor; route its scorer props from App. - Drop ScannerSuiteSection with main and pass scorer props through the new ScannerPresetsPage to LaunchSuiteDialog; take main's ScenarioCatalog. - Keep both objective_scorer_identifier and dataset_preparation fields on ScenarioHistoryRunRecord, and both test imports. - Drop showInScanner from PresetIdentity with main; keep objectiveScorer. - Remove an assertion the new no-unnecessary-type-assertion rule rejects. - Describe per-scenario scorers in the GUI guide with main's preset terms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After main's Scanner regrouping (microsoft#4616), the UI calls a suite a preset and a scenario preset a scenario. The scorer strings this PR added to the launch dialog still used the old terms, so "from preset" pointed at the preset being launched instead of the scenario that stores the scorer. - LaunchSuiteDialog: "from scenario", "Use each scenario's scorer", help text and readiness error in preset/scenario terms, and the bars' accessible names "Preset configuration issues" / "Preset readiness error"; update the unit and seeded e2e assertions. - ScenarioPresetEditor: put the component doc comment back on the component and list the objective scorer among the fields it edits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Description
Group the Scanner's Launch tab by scenario module, so finding a scenario means opening one module instead of scanning one long table.
Stacked on #4615. This branch contains that PR's commits. Review only the commits after
d58aacf8; this PR becomes small once #4615 merges.GET /api/scenarios/modulesreturns each built-in module's name, display name, and one-line description. The scenario registry owns this asScenarioRegistry.list_modules(), which returns aScenarioModuleSummarymodel:DISPLAY_NAME.DISPLAY_NAMEconstant in each package.module.DELETE /api/scenario-presets/{name}now answers 409 naming those presets. The rule is in the library:ScenarioPresetRegistry.delete_presetraisesScenarioPresetInUseError(frompyrit.registry) unless a code-defined preset of the same name backs it.doc/gui/0_gui.mddescribes the module grouping and tells upgrading users where those saved scenarios are listed.This is step 2 of 2, after #4615.
Screenshots