Repository navigation
MAINT: declare scenario required data apart from dataset_config - #3464
Merged
Roman Lutz (romanlutz) merged 12 commits intoNov 10, 2026
Merged
Conversation
…d-data # Conflicts: # tests/unit/scenario/garak/test_api_key.py
…s to selected techniques A required-data refresh committed before the scenario assembled its population, so a refresh that the assembly or the population validators would reject had already replaced the stored datasets, breaking resume of earlier runs. The refresh now runs the scenario's full unsampled assembly against the candidates first, so a rejected refresh changes nothing. Legacy dataset_config validators wrote against the raw template seeds, so they move onto the required data when an old configuration migrates, instead of receiving the assembled objectives. ApiKey now requires a prompt template only for the techniques a run selects.
…work A validator can be any callable, including an unhashable instance such as a plain dataclass, so the migration can't collect them in a set. Remove the moved validators by object identity instead.
…ject empty population Required data and the population configuration are now fetched first and validated as one batch: when either half refreshes, each configuration and the scenario's full unsampled assembly run against all candidates before anything is written. A refresh of templates now sees records fetched in the same run, a valid joint refresh is accepted, and a records-only refresh that the assembly rejects leaves the stored rows and ids unchanged. A global fetch override now reaches required sources without their own policy even when the population has sources, and a source selection that names only required datasets is rejected instead of silently restoring the default population.
…ataset names A compound population names its datasets through its children, so its own sources are empty and its parent fetch is not the requested one. Required data now keeps its resolved fetch policy whenever the population names any dataset, so fetch=never and fetch=always reach the required sources for compound populations too. Preparing required data and the population together now rejects a dataset named by both before anything is fetched. Candidates are keyed by name, so a shared name validated one batch and then committed both.
Roman Lutz (romanlutz)
left a comment
Contributor
There was a problem hiding this comment.
The separation looks sensible and reuses the existing preparation machinery. Two things still need attention:
- The compound-selection issue remains unresolved: child validators and limits are skipped. Please reject unsupported compound configurations or honor their rules, with a regression test.
- The required-data filtering contract is contradictory. I left a new inline comment asking for consistent wording about which input rows are read.
… contract A compound configuration has no root sources even when its children name datasets, so it passed the source guard in select_assembled_groups and its children's validators and limits were skipped. It now raises a clear error instead; use a single source-free configuration. The docs said required data is read without filters, but its filters do narrow the input rows. The module, Scenario.get_required_data() and the scenario instructions now say every row that remains after filtering is read, without sampling or size caps.
Roman Lutz (romanlutz)
approved these changes
Nov 10, 2026
Julio César Suástegui (juliosuas)
added a commit
to juliosuas/PyRIT
that referenced
this pull request
Nov 10, 2026
…lection-backend-v2 Resolve import conflicts in dataset_configuration.py and scenario.py: keep ExactExampleDatasetConfiguration and Mapping alongside main's DatasetSource, DatasetSourceKind, and Awaitable (required data, microsoft#3464).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ApiKey listed its corpus as dataset_config sources and then had to check they were uncapped and exactly those four. This adds ScenarioRequiredData for datasets a scenario reads in full. ApiKey declares its corpus in get_required_data, and ApiKeyDatasetConfiguration now only limits the assembled requests through select_assembled_groups.
Required data uses the normal fetch and refresh path, only gets prepared on fresh runs and explicit loads, and can't be capped or deselected. When the config has no sources of its own, its fetch policy and filters apply to the required data, so those settings keep working.
Settings and the scenario identity still list the corpus, so the CLI, GUI and old resumes don't change, and passing the corpus as sources still works with a deprecation warning.
PromptInject (#3546) and LatentInjection (#3547) are up as drafts on top of this. ProPILE is the interesting next one since its record datasets stay user-selectable, so I'll wait for feedback here before doing that.
Part of #3336