Repository navigation
Conversation
AdaAibaby
requested review from
ValentaTomas,
dobrac and
jakubno
as code owners
November 4, 2026 02:25
AdaAibaby
force-pushed
the
fix/snapshot-artifact-cleanup
branch
from
November 5, 2026 08:38
24c8645 to
caccd1a
Compare
AdaAibaby
force-pushed
the
fix/snapshot-artifact-cleanup
branch
from
November 6, 2026 06:13
caccd1a to
03babfa
Compare
AdaAibaby
force-pushed
the
fix/snapshot-artifact-cleanup
branch
from
November 6, 2026 06:26
03babfa to
886fbe2
Compare
AdaAibaby
force-pushed
the
fix/snapshot-artifact-cleanup
branch
2 times, most recently
from
November 25, 2026 14:12
c847d87 to
0e838b0
Compare
…nciliation metrics (bounded, panic-safe) Delete GCS/S3 build artifacts on template deletion, guarded by a header-reachability closure that protects still-referenced ancestor bases (checkpoint/snapshot), with an online grace window, fail-closed source union, and reconciliation metrics. Rebuilt onto latest main (db layer moved to packages/api/internal/db).
A snapshot is backed by its own template; on snapshot deletion, remove the build artifacts exclusively owned by that snapshot-template while protecting any base shared with a live template. Adds the exclusivity guard test (readmodel package, latest-main structure). Combines the two commits of e2b-dev#3798.
AdaAibaby
force-pushed
the
fix/snapshot-artifact-cleanup
branch
from
November 26, 2026 06:08
0e838b0 to
2536e80
Compare
This branch has not been deployed
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.
Summary
Deletes the storage artifacts of a snapshot's exclusively-owned builds when the snapshot is deleted (
DELETE /sandboxes/{id}), instead of orphaning them in GCS/S3.A snapshot is backed by its own template, and
deleteSnapshotalready soft-deletes that template. This reuses the exact template-deletion cleanup for the snapshot's template, so the same guarantees apply.Inherits the reachability guard
Because it reuses #3797's
startTemplateArtifactCleanup, the snapshot path inherits the reachability guard, reconciliation metrics, and panic-safe/bounded/best-effort background behavior. The guard is what makes the base-deleted direction safe: if another live build reaches a base layer now DB-exclusive to this snapshot-template, it is kept, not orphaned.teamIDis threaded through to scope the live-root set.Test
DB-backed
TestSnapshotArtifactExclusivity: the snapshot's own build and an extra exclusive build are returned for cleanup; a build shared with another template is excluded; the query resolves after soft-delete; every returned build carries thecluster_node_idneeded to routeDeleteBuild.Update — rebased on #3797's checkpoint guard; snapshot-path test added
Rebased onto the updated #3797, so this PR inherits the checkpoint/snapshot live-root fix, the online grace window (
TemplateArtifactMinAgeSeconds), and the pluggable fail-closed live-root sources.Adds a DB-backed test on the snapshot path proving both halves of the checkpoint protection:
GetExclusiveBuildsForTemplateDeletionfor the snapshot's template excludes it), andTogether with #3797's live-root source, deleting a checkpoint-derived snapshot removes only the snapshot's own COW diff layer and never the base it stacks on.
/cc @ryan-sana Looking forward to your code review.