Skip to content

MAINT: Type dataset cleanup and mutation results - #4837

Open
biefan (biefan) wants to merge 2 commits into
microsoft:mainfrom
biefan:maint/type-dataset-operation-results
Open

biefan (biefan) wants to merge 2 commits into
microsoft:mainfrom
biefan:maint/type-dataset-operation-results

Conversation

@biefan

Copy link
Copy Markdown
Contributor

Description

Relates to #4505 (dataset lifecycle and mutation results).

The dataset upload service reads committed counts, seed IDs and cleanup status from the memory layer. This change gives those dictionaries explicit return types so a type checker can catch missing keys and callers that overlook a nullable field.

  • Carry the result types from the transaction helpers through MemoryInterface to the upload service. A committed mutation always includes version, which is null when the last seed is deleted. Cleanup always includes error, which can also be null.
  • Check the typed keys against the dictionaries returned by SQLite when media cleanup is interrupted and when cleanup completes after a restart.

Copilot AI balanced review requested due to automatic review settings December 4, 2026 16:51

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.

🟢 Approval recommended

No active review issues remain for the typed dataset cleanup and mutation result changes.

No open issues 🎉

What changed in this PR

Adds explicit typed contracts for dataset cleanup and mutation results, addressing the dataset lifecycle portion of #4505.

Changes:

  • Defines required result keys, including nullable version and error fields.
  • Carries result types through memory APIs to the upload service.
  • Extends SQLite tests to check result keys and cleanup outcomes.
File Description
tests/​unit/​memory/​test_dataset_lifecycle.py Checks typed keys, seed results, and cleanup outcomes.
tests/​unit/​backend/​test_dataset_lifecycle.py Types the mutation commit test wrapper.
pyrit/​memory/​memory_interface.py Exposes typed cleanup and mutation returns.
pyrit/​memory/​dataset_mutation.py Defines mutation result types and returns persisted seed IDs.
pyrit/​memory/​dataset_lifecycle.py Defines and applies the cleanup result type.
pyrit/​backend/​services/​dataset_upload_service.py Uses the typed mutation result.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

2 participants