Repository navigation
FEAT: Scenario-aware dataset compatibility (-8) - #4180
Richard Lundeen (richlundeen) merged 91 commits into
Conversation
Adds ASSERT judge dimension/preset models, ships ASSERT's 11 judge presets, judges custom boolean and ordinal dimensions (with not-applicable) through build_assert_policy_scorer, aggregates repeated judge samples as ASSERT does, and exposes judge_presets, disabled_judge_dimensions, judge_samples, and objective_dimension on foundry.assert_policy. Default identities are unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ge presets to built-in names - objective_dimension and other non-default judge settings are recorded in scenario identity params, so resume detects changes and saved GUI/API launches restore them. Default identities are unchanged. - Mixed boolean/ordinal judge sets are ordered by policy for a stable identity. - judge_presets accepts only shipped preset names; preset files move to the Python-only judge_preset_files (list[Path]) parameter, which the API guard rejects. Preset load errors no longer echo file contents. - Adds a Scenario._get_identity_params hook. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…converters - Custom judge dimensions are boolean bad-event flags judged by SelfAskTrueFalseScorer with an ASSERT dimension template; ASSERT's ordinal scale and allow_not_applicable options are rejected. - Repeated samples use TrueFalseCompositeScorer over the repeated judge with an ASSERT vote (ties count as failures, undetermined samples excluded, category re-vote with override warning), replacing the bespoke sampled scorers. - Public exports trimmed to AssertJudgeDimension, AssertJudgePreset, AssertSampleMetadata, and the preset list/load functions. - foundry.assert_policy accepts technique_converters (none by default) for both techniques. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- AssertTechnique is removed. The technique class is built from the AttackTechniqueRegistry, with red_teaming as the default (ASSERT's scenario case). - The baseline, now on by default, sends each group's stored system and user prompts (ASSERT's prompt case). - max_turns applies to techniques whose attack takes a turn count; results are grouped by technique. - AssertPolicy.VERSION is 2, so runs from version 1 do not resume. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- allow_not_applicable: a not-applicable answer is undetermined with assert_not_applicable metadata; repeated samples exclude it and keep the marker only when every sample is not applicable. - ASSERT's ordinal scale is accepted with a PyRIT violation_at grade. The judge's grade position is thresholded by FloatScaleThresholdScorer, so every dimension still yields a true/false verdict, and the grade is kept in assert_grade metadata. Graded dimensions can be the objective. - AssertDimensionMetadata is exported from pyrit.score. Default identities are unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds a scenario-local assert_package technique to foundry.assert_policy: PyRIT's RedTeamingAttack whose tester uses ASSERT's own tester system prompt (pinned 04b713fe) filled with each group's stored tester instructions. It is the default technique alongside the baseline; red_teaming stays selectable. Groups without tester instructions are skipped or rejected per incompatible_technique_policy. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve judge presets in a worker thread instead of the synchronous validator. Drop a judge sample whose judgment stays invalid after retries (scoring fails only when every sample does), as ASSERT does. Require native multi-turn targets for turn-taking techniques in foundry.assert_policy, keep turn settings a registered technique sets itself, pass the adversarial chat only to techniques that use one, and warn once per even sample count. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add AssertDimensionResult, AssertCategoryJudgment (with AssertNodeJudgment) and AssertSampleVotes in pyrit.models as the only readers and writers of the ASSERT score metadata keys, keeping the stored key format. Missing keys are unset and malformed present data raises ValueError. The scenario judge wrapper now records the assert_dimension marker on judged and skipped scores. The custom-dimension judge renders its request from a YAML SeedPrompt, and both ASSERT response handlers validate and convert the decoded response through a new JsonSchemaResponseHandler._convert_response hook instead of parsing twice. AssertDimensionMetadata and AssertSampleMetadata are removed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ence ASSERT judges can read what the application did, not only what it said: tool calls with arguments and results, model calls, and agent steps captured with OpenTelemetry, rendered after the turns they produced with citable step IDs. - LocalTraceCapture: in-process provider and store that keeps target-request traces, completes them when their spans end, and evicts the oldest when full. - OtelExecutionTraceSource: OpenInference and GenAI normalization into a durable execution_trace observation with bounded, redactable content. - ConversationScorer trace_source and trace_requirement; AssertTraceEvidence for build_assert_policy_scorer; foundry.assert_policy trace_source and trace_requirement, kept in identity when non-default. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Withdraw completion when a span starts after it; export and completion share the capture lock; evict any trace when full with explicit loss markers and bounded bookkeeping; render steps in parent cycles; remove the unreachable unattributed block; require a trace source for trace_requirement; document strict snapshot matching and citation behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…mplate additional_instructions is an explicit dimension_system_prompt.yaml parameter rendered in the sandbox instead of appended after rendering; the prompt is unchanged when it is empty. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Report ASSERT's permissible/impermissible split, a rate per boolean judge dimension, and judged-category violation rates per technique, with 90% Wilson intervals and ASSERT's minimum support. Expose them through a backend route and the GUI run page. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Match results to their stored group by full seed identity, so groups sharing an objective but not their prompts resolve; keep the objective seed ID suffix only for exact duplicates and match it without parsing technique names. - Read judge dimensions independently: an undetermined objective no longer drops the policy split or other verdicts; count blocked/failed judges per dimension as no verdict, separate from not applicable. - Order tied score timestamps by score ID. - Return 409 only for unfinished runs and a sanitized 500 for unreadable saved results. - Rename BinaryRate to AssertBinaryRate and show 90% intervals in the run-page panel. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ASSERT metrics now read the dimension, skip reason, not-applicable answer, grade and scale through AssertDimensionResult, and per-category judgments through AssertCategoryJudgment, instead of decoding the metadata keys locally. Missing judgment metadata stays unset, as on older scores, and malformed metadata now raises instead of being dropped. The scenario's judge wrapper in the layer below writes the dimension marker on judged and skipped scores, so this layer no longer edits it. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…RT behavior library AssertGenerator gains a checkpointed staged API (advance_async, build_result, estimate, validate_config): stop after a stage, apply a reviewed taxonomy and dimensions (recorded in each group's provenance), and resume after interruption without repeating model calls. TargetObjectiveGenerator.estimate and the provider-free PromptGenerationEstimate report remaining calls and a token range. The ASSERT v0.3.0 behavior (52) and suite (3) presets are vendored with loaders, and StorageIO gains list_files_async. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Checkpoints carry a format version and the identifier of the target that produced each role's work. Resuming with a different target is rejected before any model call, build_result attributes work to the recorded producers, and stored seed-group assignments must match the planned batches. Estimates count the dimensions and target system prompt sent with every seed-group call. Objective datasets record the request that generated them, the objective estimate reads its prompt once, and Azure Blob listings percent-encode names so they round-trip. AssertGenerationStage is a StrEnum. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
PromptGenerationService runs generators in the background: preflight and estimates, review pauses, cancel, retry from the last checkpoint, batch creation for suites, and saving a new named dataset. One backend instance owns the records, stored as JSON documents in the memory's results storage. Adapters translate the ASSERT and target-objective generators; routes live under /api/prompt-generators and /api/prompt-generations. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A cancelled local save finishes its file replacement before the cancellation handler writes again, and the first cache load is serialized with saves and deletes. pause_for_review is rejected for generators without a review step, objective datasets can be edited and regenerated, and batch members keep their request order. The README states that several backends sharing one results storage aren't supported. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Datasets > Generate dataset estimates, runs, reviews, and retries generations, with an ASSERT form (bundled behavior and suite templates), a taxonomy review editor, and a target-objective form. Suites run as a batch, grouped in the generation list. Completed ASSERT datasets open foundry.assert_policy with repeatable ?dataset= preselection, and the Datasets catalog gains an Origins facet (for example, Generated). Includes Jest tests, an isolated Playwright journey over an offline generation target, CI wiring, and GUI docs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The launch page's dataset table hid the dataset picker until a source was selected, so a scenario with no default datasets (foundry.assert_policy) said it had no named datasets and could never select one. Selection now follows the scenario's dataset options alone: with overrides allowed and nothing selected, the table says No dataset selected and offers Add dataset. Scenarios that don't take datasets, or that fix them, are unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
New generations preselect the default adversarial target for every role, including the research target, and apply it once a slow target registry loads, without replacing a user's or source's choices. Polling waits for the runtime and never shows another record's or runtime's data, a failed preflight can be checked again, generator metadata refreshes keep unsaved input, and regenerated names keep their version suffix at the maximum length. Suite dataset names follow the label, batch members list in request order, and the regenerate link retries transient failures. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an in-process agent example to the custom targets guide and replace the HTTPTarget + MockTransport workaround in the tool-call scorer guide with a local custom target. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ss agents Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Share scenario requirements and technique preparation across read-only assessment, selected-data validation, and launch. Add scanner coverage and incompatibility reasons, and recommend tester inputs for new ASSERT GUI generations while preserving SDK defaults. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use existing JSON key iteration with pre-aggregate projections for literal scalar/null metadata keys on SQLite and SQL Server. Require named keys before schema parsing, and leave filtered/custom populations unverified until resolved validation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the scenario-local ASSERT package factory and tester-instruction check, preserve native multi-turn requirements and existing target diagnostics, and validate trace references before input selection. Preserve the final lower-layer picker and research-target changes during rebase. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep dataset option names stable with accessible compatibility descriptions. Exercise generation, filtering, first selection, and a completed default ASSERT scan using deterministic schema-aware offline targets for every role. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Integrate checked compatibility infrastructure and conservative facts onto exact refreshed layer7 5431c38. Preserve relocated scorer/default and grouped-action ownership, add final native prompt/conversation dispatch and Spanish request conversion, and retain generic manual loading, fetch policies, Reset and metadata refresh. Keep category grouping and automatic provider preparation out of this layer. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Address the full pre-commit public-import gate without changing compatibility behavior or GUI source. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Integration-only publication merge. Keep the reconstructed layer8 tree exactly identical to 19f9684; original c58 publication and the preserved 3e demo history remain ancestors. Superseded category/autoload prototype hunks stay deferred to their ledger owners rather than reappearing in source. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ataset compatibility (-8) Merged against the old -7 head this layer was built on (5431c38), so only the overlap with the lower layers' late review changes conflicted. - assert_policy: main's -6 review moved ASSERT scoring to scorer conditions and dropped the per-policy judges. Re-applied this layer's dataset contract, native prompt cases, and the Spanish package on main's version; the trace-evidence and judge configuration calls the layer used no longer exist. - Readiness: main checks assert_package against RedTeamingAttack's multi-turn requirement, but its prompt cases are sent directly. Readiness accepts the package when prompt sending fits the target; conversation cases are still checked per group as they are built. - Scenario: launch and resume both validate the stored population after main's planned-population resume. Listings and assessments skip main's new minimum-selection check, since they run before a selection exists. - Frontend: main removed usesDefaultAssertScoring, so the compatible-only picker uses a narrowly named usesCompatibleDatasetPicker. Kept main's required/selection-error picker and Reset rules, and dropped the removed catalog link. - Tests: ported to main's harness (scoring_target, descriptor discovery, "Local files" origin labels, Reset only after edits), mocked the compatible listing in App.labels, and made the Spanish test independent of tester turn interleaving. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ess API Scenario.get_compatible_dataset_names_async now decides which stored catalog datasets a scenario can run; the GET listing route only builds the scenario, fetches the catalog, and maps the returned names. The unconsumed POST /datasets/assess endpoint, its service method, frontend client and types, README text, and tests are removed. Also: - run launch-time assessment and sampling off the event loop; - translate assert_package_spanish requests before user technique converters; - skip duplicate metadata and ASSERT case validation on launch; - document why the dataset listing cleanup ignores instead of aborting; - update the numeric-controls and prompt-generation e2e specs for the listing route and the tester-instructions checkbox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the pyrit.models import list in scenario.py by keeping main's ScorerSelectionReport and this branch's SeedDatasetGroupProfile and SeedGroupRequirements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Group the SQL Server profile query by plain columns: compute each group's structural flags in the per-group subquery, so no bound parameter repeats in SELECT and GROUP BY. - Give the base Scenario one requirement-aware population path: _check_dataset_population validates, runs the assessment hook, then assesses techniques for launch, refresh and estimates. AssertPolicy no longer overrides seed resolution. - Route readiness and dataset checks through one _get_technique_target_errors hook; AssertPolicy checks its packages as prompt cases there, so readiness keeps the missing-target issue. - Keep compatibility results private: drop pyrit.models.dataset_compatibility, Scenario.get_dataset_compatibility_async and the unused required_adversarial_prompt requirement. - Name each technique's reasons when no selected technique can run, and the failing group and validator detail for scenario requirements. - Expose ScenarioDatasetOptions.compatible_only so the GUI picker no longer branches on the scenario name; the preset editor uses it too. - Compatible picker: keep the required field when empty, put Retry in the error, hide loading rules, one loading status, truthful labels. - Trim framework.md and the backend README to their scope. - Add tests for estimate branches, refresh validation, profile hints, identity flags, route errors and the hook's enabled gate. 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>
A stored dataset whose seeds fail AttackSeedGroup construction now raises a DatasetConstraintError naming it, so the compatible listing leaves out only that dataset with a warning and launch and estimate errors name it. Also draw one divider in compatible mode, align the tester-instructions hint with its checkbox label, document the compatible listing's hint condition and its route's 400/404 responses, and test the estimate's no-selection return and the baseline-only no-usable-inputs failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Roman Lutz (romanlutz)
left a comment
There was a problem hiding this comment.
Re-reviewed the layer at a45eccb: every actionable finding from my earlier review is fixed — converter ordering, event-loop blocking, the duplicate validation passes, and the unused assess API (withdrawn along with the public compatibility models until a consumer exists, which I think is the right call). The resume question was resolved by the restructure (resume rebuilds the planned population from the run), and the two declined perf items come with sound reasons and a designated future cache point. Verified the reworked assessment/SQL changes preserve the earlier semantics; all touched suites pass locally and CI is green.
One optional thread remains (whether the optional baseline should abort a run under the raise policy) — fine to settle in conversation; not blocking.
…t of RAISE - On a compatible-only scenario, once the compatible listing succeeds, linked dataset names it omits are no longer preselected. One warning names them, instead of a "Not in the compatible list" row that only fails at launch. Nothing is dropped while the listing loads or fails; Retry reconciles. - The incompatible technique policy now covers selected techniques only. The optional comparison baseline skips groups without a stored user prompt under either policy, so a selection with tester-only conversation cases no longer aborts under RAISE because of the baseline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Render the warning beside the selection it changed, like the compatible listing's loading, error and empty states, so a row removed after Retry is explained in view. - Name only omitted datasets still selected, and correct the comment about edits made while the listing has failed. - Test that an all-compatible link keeps every dataset without a warning. - Note the compatible-only behavior in the GUI guide's dataset-link section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…compatible test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three-way merge against the published layer -8 head fa20157 (this layer's first parent), not the auto merge base, because layer -8 was later revised and squash-merged into main as 59510be (microsoft#4180). Main wins for lower-layer behavior; this layer's category grouping is re-applied on top of it. - Frontend: main split the run page into AtomicAttackGroupsSection and an options-based AttackExecutionTable. The ASSERT hint, the hidden technical subtitle and the readable technique labels moved there. Labels now replace the attack name in each row's hint and accessible name. - Main makes resume without a stored plan an error, so the layer's planless-resume display-map plumbing (ScenarioContext.stored_display_group_map) and its test are dropped. No-plan legacy progress reads still use the recorded display map. - Tests: the category test now checks main's row accessible name, and main's new incompatible-scoring test asserts technique_name instead of display_group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…set listing Merging main brought in microsoft#4180, which rewired useScenarioDatasets to read scenariosApi.listCompatibleDatasets instead of datasetsApi.listDatasets, so the two filter click-order regressions' listing overrides no longer reached the editor and their harm-category chips never rendered on the merged tree. The overrides now stub the compatible listing the editor reads. The guard itself compares request shapes, not listings, and is unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Part -8 of a 10-layer ASSERT stack. Design and how to use it: ASSERT in PyRIT.
Each PR targets
mainand contains the lower layers. Review the layer-only Files changed comparison, not only the commit list: retained prototype ancestry includes superseded category/loading commits, but their changes are absent from this layer's final tree.Publication note: Older references below to layers -9/-10 as "Planned" predate publication; #4226 and #4228 are now open draft PRs.
Description
Show datasets that satisfy a scenario's input contract without fetching providers while browsing. ASSERT uses one validated policy/case contract and its native prompt/conversation execution, including an explicit Spanish request variant.
raiserun because of the baseline.PromptSendingAttackand conversation cases with ASSERT-framedRedTeamingAttack.assert_package_spanishcomposes the existingTranslationConverterwith the configured adversarial chat; it does not strip case inputs or adapt objective-only techniques.Own GUI changes
assert_packagesends stored prompt cases directly, including with comparison baseline off, or follows stored tester instructions for conversation cases.assert_package_spanishis separately selectable and translates target-bound user requests, including later turns. It requires a supplied/configured adversarial chat; baseline, policy/system context, tester controls and judges are not translated.Shared/non-ASSERT impact
The shared picker/preset metadata path now uses the read-only compatible-list API. The compatible-only picker is chosen by the scenario's
dataset_options.compatible_only, which any scenario that declares dataset requirements reports, not by scenario name. Scenarios with no structural requirements retain their valid general catalog forANY;SUBSET/FIXEDrestrictions and mandatory ingredient metadata are honored. Ingredients are not certified as standalone attack populations.Other scanners retain their existing manual Load datasets action, loading-policy choices, Reset, configured-default fallback choices, final-source guard, source restrictions, metadata refresh triggers, limits and filters. Browsing or selecting an unloaded provider does not fetch it automatically. Preset editing remains read-only and retains its saved loading settings and Reset; no preset Load button is introduced. The general dataset catalog remains unfiltered.
Unchanged/deferred behavior
Default-only ASSERT scoring and hidden judge/trace controls are inherited from #4132/#4130; grouped Browse/Generate actions and explicit linked-source handoff are inherited from #4135. This layer does not change judge models, add the deferred Judge target picker, alter operation gating/preferences, numeric limits or target setup, or rewrite existing run identities.
Planned -9 (category-first result groups) and Planned -10 (nonblocking automatic dataset loading) are separate follow-up layers, not present in this PR's net source; they remain Planned until their PRs exist. Native conversion does not relax compatibility for
role_play_movie_script, TAP or other objective-only techniques. Import/export, ACS export, bootstrap/macros, run comparison and archive/evidence-retention work remain future scope.Ancestry disclosure: earlier published head
fa20157a6a1fdd484bea1a5dc41d957bfc2cfad3has the exact tree of checked reconstruction19f96845b7c6e594477336f7f1dc22faf2178209. Its integration merge also retains second-parent prototype history from3e76d6e40aeea0cbfaab4fadc2c48454b0ac485e, including superseded category/loading commits. Their category-grouping and automatic-loading changes are absent from this tree. Review the layer-only Files changed comparison, not only the commit list: merged prototype commit titles do not describe the final net scope.Own-source demonstration
All images below are real UI rendered at exact published
a45eccb1470ed65bacaf27da39205e7d422576a1(the linked-dataset warning images at8c246deaa1991b1bc47a48d171437dfef9711a85, whose UI source is unchanged at the published head), with cumulative lower layers present, against the repository's offlineprompt_generation_backendfixture: two synthetic ASSERT datasets made by its deterministic offline generation target, plus browser-side overrides of the compatible-listing request for the failure and loading states. No user configuration/data, provider download, model generation or scan was used. Desktop images use a 1440 x 1000 viewport, light theme. The former c58/7b images and URLs are archived as historical evidence, not relabeled as the reconstructed source.Compatible listing failure: the error message carries its own Retry action, and the required picker is disabled until the listing succeeds.
After Retry, the picker offers only the stored datasets that pass ASSERT's checks: one generated with tester instructions (conversation cases) and one without (prompt cases).
Native default technique and the separately selectable Spanish variant.
A selected compatible dataset: no Load, Reset or Dataset loading policy control, because compatible choices are already stored and checked. Browse/Generate layout is inherited from #4135.
While the compatible listing loads, one status is shown and a linked dataset's Size reads "Loading...".
A link that names a dataset the compatible listing omits leaves that dataset out and says so once in the Datasets section, beside the selection it changed, instead of keeping a row that only fails at launch. Here the link names one dataset generated offline and one that isn't a compatible stored dataset; the generated one stays selected.
When every linked dataset is left out, the warning sits above the required dataset picker.
With no compatible datasets, the required picker stays in place and the empty text becomes its hint.
Fresh ASSERT GUI generation includes tester instructions, now labeled "Include tester instructions" with a short hint; SDK defaults do not change.
Narrow layout and preset editor
Narrow (480 x 900) compatible selection: the selected-datasets table scrolls horizontally and no loading-policy control appears. Grouped actions are inherited from #4135.
The scenario preset editor for
foundry.assert_policyuses the same compatible picker, chosen bydataset_options.compatible_only, with no loading-policy control.