MAINT Breaking: Convert ScenarioResult to Pydantic#1908
Merged
ValbuenaVC merged 6 commits intoJun 3, 2026
Merged
Conversation
Relocate get_scorer_evaluation_metrics to pyrit.score.scenario_metrics.get_scenario_metrics, make display_group_map a public field, and keep to_dict/from_dict as deprecated shims preserving the legacy wire shape. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The helper had no production callers (the original ScenarioResult method also had none), so relocating it in Phase 7 just moved dead code. Remove the module, its test, and the pyrit.score export. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nario-result-pydantic # Conflicts: # pyrit/models/scenario_result.py # tests/unit/models/test_import_boundary.py
romanlutz
reviewed
Jun 3, 2026
romanlutz
reviewed
Jun 3, 2026
romanlutz
approved these changes
Jun 3, 2026
- Convert ScenarioRunState from a Literal alias to a str-backed Enum (matches house style; backward-compatible at all string call sites). - Move ScenarioResult.normalize_scenario_name to the end (static methods last). - Guard ScoreEntry.__init__ against a None scorer_class_identifier and drop a now-unused type: ignore, fixing ty errors surfaced after merging origin/main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…efault - Move inline imports in test_scenario_result.py to the top of the file - Simplify pyrit_version from default_factory to a plain default in ScenarioIdentifier and ComponentIdentifier (sibling identifiers) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
This converts ScenarioResult to a Pydantic BaseModel. It is phase 7 of the pyrit.models refactor (and the last model move remaining!):
https://gist.github.com/rlundeen2/3e8daa8e12a11b4b6e52587b3c9b1dca
This one is breaking. I want to remove
get_scorer_evaluation_metrics. There were no callers in our code, and it relies on scorer, so it's something we need to get rid of to make our dependency footprint small. Check out phase 9 where we'd want to evict this from pyrit.models to understand some of the annoying things about deprecation. But not a huge deal if we do want to keep as is.