Feature Request / Improvement
Overview
Add richer snapshot expiration retention capabilities:
- retain_last_n(n): keep N most recent snapshots regardless of age.
- older_than_with_retention(...): combine max age filter with retain_last_n and a minimum snapshots floor.
- with_retention_policy(...): unified API that also consumes table property defaults:
- history.expire.max-snapshot-age-ms
- history.expire.min-snapshots-to-keep
- history.expire.max-ref-age-ms (plumbed for future ref expiration logic)
Internal helpers:
- _get_expiration_properties: parses table properties.
- _get_snapshots_to_expire_with_retention: core selection logic factoring protected refs (branches/tags), age, recency, and minimum keep guardrail.
Motivation: safer, configurable space reclamation while preventing accidental over‑expiration.
Related to #2369