Repository navigation
MAINT: Migrate SeedOrigin to StrEnum (P311-17) - #4126
Merged
Roman Lutz (romanlutz) merged 2 commits intoNov 10, 2026
Merged
Roman Lutz (romanlutz) merged 2 commits into
Roman Lutz (romanlutz) merged 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the SeedOrigin migration to StrEnum.
No open issues 🎉
What changed in this PR
Migrates SeedOrigin to Python 3.11’s StrEnum as part of #3166, following #3850. String conversion now returns values such as local, while preserving existing serialization and storage contracts without a database migration.
Changes:
- Replace
(str, Enum)withStrEnum, retaining all five origin values. - Add coverage for string behavior, equality, hashing, JSON serialization, and schemas.
- Extend SQLite round-trip tests to verify stored values and
SeedRecordreconstruction.
| File | Description |
|---|---|
tests/unit/models/test_seed_origin.py |
Adds string, serialization, and schema compatibility tests. |
tests/unit/memory/test_seed_origin.py |
Checks raw stored origins and reconstructed records. |
pyrit/models/seeds/seed_origin.py |
Changes SeedOrigin to inherit from StrEnum. |
Review effort: Balanced
Roman Lutz (romanlutz)
self-requested a review
November 10, 2026 04:36
19 of 25 tasks
Roman Lutz (romanlutz)
approved these changes
Nov 10, 2026
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.
Description
Part of #3166 (P311-17), following #3850. Reservation.
Use Python 3.11's
StrEnumforSeedOriginsostr(SeedOrigin.LOCAL)and formatting returnlocalinstead ofSeedOrigin.LOCAL, matching the values already used in storage and JSON. No repository consumer was found relying on the qualified form..valueand reads withSeedOrigin(raw_value), so no database migration is needed.SeedRecordreconstruction in the existing SQLite round-trip tests.