Skip to content

sweepScreenshotContent

sweepScreenshotContent(deps, projectId, options?): Promise<SweepResult>

Defined in: packages/core/src/retention/screenshot-sweep.ts:61

Delete content-addressed screenshots that no snapshot or baseline points at any more.

An object is deleted only after it has been unreferenced across two sweeps at least graceMs apart (first-seen times live in a marker object, so no schema is needed and the storage adapter needs no modification times). A capture writes its screenshot before the rows that reference it, so a single look is never enough; each candidate is also re-checked against the database immediately before it is deleted.

Reusing an object that already exists writes nothing, so the sweep cannot see it by looking at storage. Deletion is therefore deferred (objects stay pending, first-seen times kept) while the project has reuse in flight: a build still capturing, or a reuse claim from a baseline import or approval (withContentClaim). Both checks are bounded by the grace period, so a build stuck in capturing or a claim left by a crash delays reclaiming storage, never forever.

SweepDeps

string

number

number

Promise<SweepResult>