Skip to content

MAINT: declare LatentInjection ingredients as required data - #3547

Merged
Roman Lutz (romanlutz) merged 36 commits into
microsoft:mainfrom
u7k4rs6:feat/required-data-latent-injection
Nov 11, 2026
Merged

Roman Lutz (romanlutz) merged 36 commits into
microsoft:mainfrom
u7k4rs6:feat/required-data-latent-injection

Conversation

@u7k4rs6

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

Copy link
Copy Markdown
Contributor

Third scenario for #3336, following PromptInject in #3546. The five LatentInjection ingredient datasets move to get_required_data, and the reserved boundary marker check becomes a required data validator so refreshed data gets checked too. LatentInjectionDatasetConfiguration keeps the families, max_total and the family/trigger coverage sampling, and its own uncapped and exact-datasets checks are gone. Filters and fetch settings on the config still reach the ingredients, and passing the ingredients as sources still works with a deprecation warning.

Part of #3336

…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.
Comment thread pyrit/scenario/core/scenario.py Resolved
Comment thread pyrit/scenario/core/scenario.py Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…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.
…on test

The configuration no longer accepts its ingredients as dataset sources, so the
population test assembles them through the required-data path instead of the old resolver.
…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.
… 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.
Copilot AI balanced review requested due to automatic review settings November 9, 2026 11:10

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.

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

# Conflicts:
#	tests/unit/scenario/test_default_run_size_estimates.py
@u7k4rs6
Utkarsh Bahuguna (u7k4rs6) marked this pull request as ready for review November 10, 2026 08:59
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Nov 11, 2026
Merged via the queue into microsoft:main with commit a3ce96c Nov 11, 2026
60 of 61 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.

3 participants