Skip to content

Operations: configurable retention and safe pruning for run state, logs, cache, previews, rejects, and temporary artifacts #303

Description

@LouisDeconinck

Problem

A low-cost local-first platform must bound its operational metadata and intermediate storage.

Long-running Duckle servers can accumulate:

run history
run-scoped logs
async run records
preview/sample data
temporary/spill files left after abnormal termination
content-addressed stage cache
queued-work ledgers
reject/dead-letter data
compiled/built releases
local artifact copies

DuckLake table maintenance solves a different problem; it does not bound Duckle’s own control-plane and cache storage.

Proposed solution

Add explicit retention policies per category.

Example:

retention:
  runs:
    keepDays: 180
    keepLastPerPipeline: 50

  logs
## Scheduling

Allow retention as a normal low-priority maintenance task using resource pools.

## Policy

An authoritative server policy can enforce:

```text
minimum audit retention
maximum cache size
whether reject data may be deleted

Observability

Expose:

bytes by category
oldest retained item
last prune result
prune failures

Scope

This is not object-storage lifecycle management or DuckLake snapshot expiration.

It is bounded housekeeping for data Duckle itself owns.

Acceptance criteria

  1. --dry-run accurately lists what would be deleted;
  2. active/referenced data is protected;
  3. cache/log/history growth can be bounded by age and/or size;
  4. interrupted temporary files can be reclaimed safely;
  5. pruning is auditable.:
    keepDays: 30

cache:
maxBytes: 500GB
keepDays: 45

previews:
keepHours: 24

interruptedTemp:
keepHours: 24

releases:
keepLast: 10


Reject/dead-letter and audit data should have conservative separate defaults.

## Commands

```bash
duckle retention status --json
duckle retention prune --dry-run
duckle retention prune

The dry run should report item counts and reclaimable bytes per category.

Safety

Never remove:

active-run files
queued-run state
artifacts referenced by retained manifests/releases
the active release
a cache entry currently being read/written
audit records unless an explicit policy permits it
user-owned source/raw/output data

Distinguish Duckle-managed files from arbitrary paths referenced by a pipeline.

Crash recovery

On startup or maintenance, detect abandoned run-scoped temp directories and incomplete cache writes using ownership metadata/leases rather than deleting files solely by name.

Scheduling

Allow retention as a normal low-priority maintenance task using resource pools.

Policy

An authoritative server policy can enforce:

minimum audit retention
maximum cache size
whether reject data may be deleted

Observability

Expose:

bytes by category
oldest retained item
last prune result
prune failures

Scope

This is not object-storage lifecycle management or DuckLake snapshot expiration.

It is bounded housekeeping for data Duckle itself owns.

Acceptance criteria

  1. --dry-run accurately lists what would be deleted;
  2. active/referenced data is protected;
  3. cache/log/history growth can be bounded by age and/or size;
  4. interrupted temporary files can be reclaimed safely;
  5. pruning is auditable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions