feat(preprod): Delete snapshot objectstore data on artifact deletion#111972
Merged
NicoHinderling merged 6 commits intomasterfrom Apr 1, 2026
Merged
Conversation
Previously, delete_artifacts_and_eap_data only cleaned up DB records and EAP trace data. Snapshot images, manifests, comparison manifests, and diff masks stored in objectstore were left to expire via 30-day TTL. This adds objectstore cleanup to the deletion path: before the DB cascade, we read manifests to discover all associated keys (images, diff masks, comparison data) and delete them in parallel via a thread pool. Failures are logged but non-blocking since TTL is the fallback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Image keys are content-addressed and shared across snapshots in the same project. Eagerly deleting them when one artifact is removed breaks image display for other active snapshots referencing the same content_hash. Images already expire via 30-day objectstore TTL. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4f60d38 to
a078ad1
Compare
rbro112
approved these changes
Apr 1, 2026
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Move objectstore key collection before bulk_delete_artifacts so DB records are never left pointing at already-deleted objectstore data. Previously, objectstore data was deleted first — if the subsequent DB deletion failed, snapshots and comparisons would reference missing keys. Now the flow is: collect keys → delete DB records → delete objectstore keys. TTL expiry still serves as fallback if objectstore deletes fail. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
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.

Adds objectstore cleanup to the artifact deletion path in
delete_artifacts_and_eap_data.Previously, only DB records and EAP trace data were cleaned up when deleting preprod artifacts. Snapshot images, manifests, comparison manifests, and diff masks stored in objectstore were left to expire via 30-day TTL — meaning deleted snapshot data remained accessible for up to a month.
Now, before the DB cascade runs, we read each snapshot's manifest to discover all associated objectstore keys (individual images by content hash, the manifest itself, comparison manifests, and diff mask PNGs), deduplicate them, and delete them in parallel using
ContextPropagatingThreadPoolExecutor(max_workers=8). Individual key deletion failures are logged but non-blocking since TTL expiration serves as the fallback.The implementation is split into three module-level functions:
_collect_snapshot_objectstore_keys— queries snapshot metrics and comparisons, reads manifests to enumerate all keys_delete_objectstore_key— thread worker that deletes a single key_delete_snapshot_objectstore_data— orchestrator that deduplicates keys and dispatches parallel deletes