
Give temporary records a clear expiry
Some records serve a temporary purpose and should not accumulate indefinitely. Wildo lets a date field declare when its row expires, with shared semantics for an absolute deadline or an age-based window.
Scheduled cleanup turns that declaration into removal and reports bounded work for the operator to monitor.
Example — Expire a temporary job payload
A job stores a large payload with an expiry timestamp. Once it is due, the expiry mechanism can remove the row instead of leaving the sensitive payload as permanent operational history.
For engineers
The actual job payload schema uses an absolute deadline. expireAfterSeconds: 0 means the field itself is the expiry instant; a positive value measures a window from that field:
Source: jobs.shared.schemas.ts (selected excerpt).
// === Lifecycle ===
/** When the payload was stored */
createdAt: z.date().isDBIndexed(),
/**
* When the payload expires and can be cleaned up.
* MongoDB TTL index will automatically delete documents at this time.
*/
expiresAt: z.date().ttl({ expireAfterSeconds: 0 }),
MongoDB can enforce the TTL index. The shared retention sweep consumes the same .ttl() declaration and supports stores that do not remove rows natively. For an application resource, register a resource-anchored sweep manifest and its batch; a date annotation alone is not a scheduled PostgreSQL worker. Existing engine payload/execution sweeps are registered at startup.
collectResourceRetentionPolicies reads the declaration and resolveRetentionCutoff calculates the due boundary. The batch deletes bounded groups and reports when a run reaches its ceiling. Its schedule and backlog determine the actual cleanup time, so expiry is not a promise of deletion at the exact timestamp.
This is row expiry, not erasure retention’s keep/hide/freeze behavior and not a written retention-policy document. Choose a time field whose meaning matches the commitment, keep the worker operational and verify the stored result. File objects, backups and external services have their own retention paths; a row TTL does not remove every copy of its contents.