-
Notifications
You must be signed in to change notification settings - Fork 764
FEAT: Better Scenario Tracking #1758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rlundeen2
merged 11 commits into
microsoft:main
from
rlundeen2:users/rlundeen/2026_05_18_scenario_resume
May 20, 2026
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5e858ad
Stamp scenario_result_id FK on AttackResultEntry for granular resume
rlundeen2 3e844c5
Address review: cleanup, rename to ScenarioExecutionAttribution, simp…
rlundeen2 752d082
Add AtomicAttack tests for resume-path filter and attribution factory
rlundeen2 ddaa42c
Rename ScenarioExecutionAttribution to generic AttackResultAttribution
rlundeen2 547dff6
FEAT: hash-based scenario resume keys
rlundeen2 ead1d1c
MAINT: address PR review nits
rlundeen2 36e4af3
Merge remote-tracking branch 'origin/main' into users/rlundeen/2026_0…
rlundeen2 452a383
Rename _hydrate_scenario_attack_results, drop deprecated objective fi…
rlundeen2 5d907b6
scope scenario resume by technique eval hash
rlundeen2 a0a5b71
restore filter_seed_groups_by_objectives as deprecated shim
rlundeen2 e75bc0c
add tests for resume hash filter, eval-hash disambiguation, and depre…
rlundeen2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
43 changes: 43 additions & 0 deletions
43
pyrit/executor/attack/core/scenario_execution_attribution.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT license. | ||
|
|
||
| """ | ||
| Typed attribution metadata used to link a persisted ``AttackResult`` to the | ||
| ``Scenario`` that produced it. | ||
|
|
||
| Lives in the ``executor`` layer (rather than ``scenario``) so the attack | ||
| persistence path — the consumer — does not introduce a dependency on | ||
| ``pyrit.scenario``. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from dataclasses import dataclass | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class ScenarioExecutionAttribution: | ||
| """ | ||
| Scenario-linkage metadata stamped onto an ``AttackContext`` by the | ||
| ``AttackExecutor`` and copied onto the resulting ``AttackResult`` by the | ||
| attack persistence path so the row carries the scenario FK + scenario_data. | ||
|
|
||
| Attributes: | ||
| scenario_result_id (str): The ID of the scenario result that produced | ||
| this attack execution. Persisted to | ||
| ``AttackResultEntry.scenario_result_id`` so per-scenario hydration | ||
| and resume can locate the row directly without relying on a JSON | ||
| manifest written at the end of an atomic attack. | ||
| atomic_attack_name (str): The unique key of the atomic attack within | ||
| the scenario (matches ``AtomicAttack.atomic_attack_name``). | ||
| Persisted into ``AttackResultEntry.scenario_data``. | ||
| objective_index (int): The 0-based original seed-group index (the | ||
| ``input_indices`` value from ``AttackExecutorResult``). Assigned | ||
| **before** task execution so it is deterministic and parallel-safe. | ||
| Persisted into ``AttackResultEntry.scenario_data`` and used as the | ||
| stable resume key (instead of the easily-duplicated objective text). | ||
| """ | ||
|
|
||
| scenario_result_id: str | ||
| atomic_attack_name: str | ||
| objective_index: int |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.