fix(BA-2764): Prevent artifact deletion when download and archive storage are identical#6330
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a critical bug where artifacts were being incorrectly deleted when the download and archive storage locations were configured to be identical. The fix introduces a check to skip cleanup of non-archive steps when they share the same storage backend as the archive step, preventing unintended data loss.
Key changes:
- Added storage comparison logic to prevent cleanup when download and archive use the same storage
- Refactored configuration to use
archive_storageproperty instead of genericstorage_name - Removed redundant
storage_nameparameter from request models since storage selection is now fully handled bystorage_step_mappings
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/ai/backend/storage/services/artifacts/types.py | Added check to skip cleanup when step storage matches archive storage |
| src/ai/backend/manager/services/object_storage/service.py | Updated to use archive_storage property for presigned URL generation |
| src/ai/backend/manager/services/artifact_revision/service.py | Updated storage name references to use archive_storage property and removed unused storage_name parameter |
| src/ai/backend/manager/services/artifact/service.py | Updated all storage client initialization to use archive_storage property |
| src/ai/backend/manager/event_dispatcher/handlers/artifact_registry.py | Updated to use archive_storage property and removed storage_name from request |
| src/ai/backend/manager/config/unified.py | Made storage_name optional, added archive_storage property, and enhanced validation logic |
| src/ai/backend/common/dto/storage/request.py | Removed storage_name field from request models as it's now redundant |
| changes/6330.fix.md | Added changelog entry |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @@ -0,0 +1 @@ | |||
| Prevent artifact deletion when download and archive storage are identical | |||
| reservoir_config = self._config_provider.config.reservoir | ||
| storage = await self._resolve_storage_data(reservoir_config.storage_name) | ||
| storage = await self._resolve_storage_data(reservoir_config.archive_storage) | ||
| # TODO: Current structure does not cover cases where different storages have different hosts. |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
1ea8c1d to
dedf11d
Compare
|
Backport to 25.15 is failed. Please backport manually. |
resolves #6329 (BA-2764)
Checklist: (if applicable)