Extend deletion guards to all non-archived versions and add bulk-archive action#3198
Extend deletion guards to all non-archived versions and add bulk-archive action#3198claude[bot] wants to merge 1 commit into
Conversation
… action Working and published experiment versions already blocked deletion of referenced service providers, assistants, pipelines, and collections. Non-published snapshot versions (not working, not published, not archived) were silently ignored, letting deletions corrupt those references. Changes: - Add `is_blocking_object` / `is_bulk_archiveable` helpers in `apps/utils/deletion.py` - Update `get_related_experiments_queryset` methods in assistants, documents, and service-provider views to return ALL non-archived versions, not just working/published - Categorise blocking references in every delete view into "manual-only" (working + published) and "bulk-archiveable" (non-working, non-published, non-archived) - Add `bulk_archive_experiment_versions` endpoint (`experiments:bulk_archive_versions`) that archives a supplied list of non-working, non-published versions atomically - Update `templates/generic/referenced_objects.html` to show the bulk-archive section with a form button when bulk-archiveable versions exist - Add comprehensive tests for deletion blocking and bulk-archive endpoint Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@claude update this branch to resovle the conflicts |
|
Claude finished @SmittieC's task in 7m 49s —— View job Update branch to resolve conflicts
|
| Operation I need | Result |
|---|---|
git fetch --unshallow / git fetch origin |
❌ requires approval (blocked) |
git merge origin/main |
❌ requires approval (blocked) |
git rebase, git merge-tree, git merge-file, git read-tree, git write-tree, git commit-tree |
❌ requires approval (blocked) |
On top of that, the checkout is a shallow clone (origin/main is fetched at depth 1), so git merge-base can't even find the common ancestor locally, and I can't git fetch to unshallow it.
I also can't do this server‑side: GitHub's Update branch endpoint and POST /merges both refuse when there are real conflicts, and simply editing the branch files without a merge/rebase commit can't clear a genuine overlapping‑hunk conflict while preserving this PR's intent.
Only git add / git commit / git push (and read‑only git) are available to me here, which isn't enough to construct the merge commit.
Files that changed on both main and this branch (the conflict candidates)
apps/assistants/views.py
apps/documents/models.py
apps/documents/views.py
apps/experiments/urls.py
apps/experiments/views/__init__.py
apps/experiments/views/experiment.py
apps/pipelines/views.py
apps/service_providers/tests/test_views.py
apps/service_providers/views.py
apps/utils/deletion.py
templates/generic/referenced_objects.html
(apps/assistants/models.py changed only on this branch, so it should merge cleanly.)
How to resolve
Option A — locally (recommended):
git checkout claude/issue-3197-20260422-0552
git fetch origin
git merge origin/main
# resolve conflicts in the files above, then:
uv run pytest apps/service_providers/tests/test_views.py -v
git add -A && git commit && git push origin claude/issue-3197-20260422-0552Option B — let me do it: re‑trigger me in an environment where git fetch and git merge are allowed and the repo is checked out with full history (not shallow), e.g. actions/checkout with fetch-depth: 0. I'll then perform and push the merge.
Sorry I couldn't push a fix directly this time — the restriction is on my available git tools, not on the code itself.
· branch claude/issue-3197-20260422-0552
|
Redid it here |
Product Description
When a service provider, assistant, pipeline, or collection is deleted, the UI now correctly blocks deletion if any non-archived experiment version references the object — including non-working, non-published snapshot versions that were previously silently ignored.
The "Cannot delete" modal now also shows a "Archive All Non-published Versions" button for non-working, non-published versions, so users can bulk-archive those references in one click instead of navigating to each version manually. Working and published versions still require manual cleanup.
Technical Description
Added
is_blocking_object(obj)andis_bulk_archiveable(obj)helpers inapps/utils/deletion.pyis_blocking_object: any non-archived object blocks deletionis_bulk_archiveable: non-working (working_version_idis set), non-published (is_default_version=False), non-archived — eligible for the bulk actionUpdated
get_related_experiments_queryset/get_related_experiments_with_pipeline_querysetinapps/assistants/models.pyandapps/documents/models.pyto return all non-archived versions (not only working/published)Updated every delete view (
apps/service_providers/views.py,apps/assistants/views.py,apps/documents/views.py,apps/pipelines/views.py) to:bulk_archiveable_experiments/bulk_archiveable_ids/bulk_archive_urlto the modal templateAdded
bulk_archive_experiment_versionsview (POST experiments/versions/bulk-archive/) that atomically archives a list of non-working, non-published versions scoped to the teamUpdated
templates/generic/referenced_objects.htmlto render a "Non-published versions" section with the bulk-archive form when applicableMigrations
No migrations — only logic changes.
Demo
Docs and Changelog
Closes #3197
🤖 Generated with Claude Code