Skip to content

fix(BA-2764): Prevent artifact deletion when download and archive storage are identical#6330

Merged
HyeockJinKim merged 1 commit into
mainfrom
fix/BA-2764
Oct 23, 2025
Merged

fix(BA-2764): Prevent artifact deletion when download and archive storage are identical#6330
HyeockJinKim merged 1 commit into
mainfrom
fix/BA-2764

Conversation

@jopemachine

@jopemachine jopemachine commented Oct 23, 2025

Copy link
Copy Markdown
Member

resolves #6329 (BA-2764)

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version
  • Mention to the original issue

@github-actions github-actions Bot added size:L 100~500 LoC comp:manager Related to Manager component comp:common Related to Common component comp:storage-proxy Related to Storage proxy component labels Oct 23, 2025
@jopemachine jopemachine changed the title fix: prevent artifact deletion when download and archive storage are identical fix(BA-2764): Prevent artifact deletion when download and archive storage are identical Oct 23, 2025
@jopemachine jopemachine added this to the 25.15 milestone Oct 23, 2025
@jopemachine jopemachine marked this pull request as ready for review October 23, 2025 01:40
Copilot AI review requested due to automatic review settings October 23, 2025 01:40

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.

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_storage property instead of generic storage_name
  • Removed redundant storage_name parameter from request models since storage selection is now fully handled by storage_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.

Comment thread changes/6330.fix.md
@@ -0,0 +1 @@
Prevent artifact deletion when download and archive storage are identical

Copilot AI Oct 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue number in the filename (6330) doesn't match the issue referenced in the PR title and description (6329/BA-2764). This appears to be a typo in the changelog filename.

Copilot uses AI. Check for mistakes.
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

Suspicious comment
@github-actions github-actions Bot added size:M 30~100 LoC and removed size:L 100~500 LoC labels Oct 23, 2025
Comment thread src/ai/backend/manager/config/unified.py Outdated
Comment thread src/ai/backend/manager/config/unified.py Outdated
@github-actions github-actions Bot added size:L 100~500 LoC and removed size:M 30~100 LoC labels Oct 23, 2025
@HyeockJinKim HyeockJinKim added this pull request to the merge queue Oct 23, 2025
Merged via the queue into main with commit 68daf7e Oct 23, 2025
31 checks passed
@HyeockJinKim HyeockJinKim deleted the fix/BA-2764 branch October 23, 2025 08:41
@github-actions

Copy link
Copy Markdown

Backport to 25.15 is failed. Please backport manually.

@jopemachine jopemachine modified the milestones: 25.15, 25.16 Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:common Related to Common component comp:manager Related to Manager component comp:storage-proxy Related to Storage proxy component size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Downloaded artifacts get deleted when the download, archive storage are the same in the import process

4 participants