test(integration): purge orphan datasets in annotation cleanup fixtures#165
Draft
henrycgbaker wants to merge 2 commits intomainfrom
Draft
test(integration): purge orphan datasets in annotation cleanup fixtures#165henrycgbaker wants to merge 2 commits intomainfrom
henrycgbaker wants to merge 2 commits intomainfrom
Conversation
bc12ab9 to
681db9c
Compare
681db9c to
cb9af28
Compare
Collaborator
Author
|
open question (@saschagobel let me know if you have thoughts otherwise I'll return to this this evening): better in tests just to remove ALL datasets cleanly (global, non-scoped) rather than scope to AnnotationSettings.workspace_dataset_map ? NB pending this decision -> update #166 workflow accordingly |
Base automatically changed from
test/dev-stack-integration-slim
to
test/annotation-stack-preflight
April 30, 2026 09:48
493f0ab to
8e4e535
Compare
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.
Goal
Tests that exercise full teardown (empty
dataset_id) can accumulate orphan datasets across runs (if dataset uses non-canonical name and teardown does not specify. it, or if exits midway). Argilla refuses to delete a workspace while any dataset is linked, so the nextteardown_resourcescall hits409 ConflictErrorand the suite fails.This PR targets orphaned datasets in test fixtures, but not production.
Scope
Test fixtures only - no production code changes. Production callers own their
dataset_idand don't accumulate orphans, soteardown_resourceskeeps its current targeted behaviour.Implementation
New helper
tests/integration/_argilla_cleanup.purge_workspace_datasets(client, ws_base)deletes every dataset in a workspace.clean_slate(test_annotation_setup.py) andclean_environment(test_annotation_import.py) call the purge for each configured workspace beforeteardown_resources. This keeps the fix at the right layer - test-induced state pollution is handled by test fixtures, not by widening the production teardown contract.Earlier draft of this PR pushed the orphan-purge into
core/annotation/setup.pyso a full teardown would delete every dataset in each workspace before deleting the workspace. Rejected because:If a production-side purge is wanted later, the right shape is an explicit
purge_workspace(ws_base, *, confirm=True)function, not an implicit branch inteardown_resources.Testing
pytest tests/integration/test_annotation_setup.py tests/integration/test_annotation_import.py -m "integration and annotation"-> 14 passed (with the test user pre-purged; the user-leak failure is the separate test isolation bug fixed in test(integration): function-scoped fixtures for order-independent annotation tests #166).References