# In what scenarios must an instance treat a TTL expiry as distinct from a GDPR erasure request in read/write/forget memory APIs **Date of Record:** 2026 November 14 **Scope:** Applies to memory subsystems exposing `read`/`write`/`forget` primitives with time-to-live (TTL), salience-weighted retention, and an erasure guarantee that must be provable to an external auditor. Does not apply to volatile caches where TTL expiry and eviction are indistinguishable to callers, nor to append-only logs where no forget primitive exists. ## Core Distinction A TTL expiry and a GDPR-style erasure request both remove a record from the readable surface, so naive implementations collapse them into a single `delete(key)` path. They are not the same operation. A TTL expiry is a *retention policy outcome*: the record was never marked for destruction, only for decay, and its salience score may have deferred or accelerated the expiry. An erasure request is a *data-subject-mandated destruction*: it must be irreversible, must be provable, and must not be resurrected by any subsequent salience recomputation, backup replay, or reingestion from a derived index. The non-obvious invariant: **a record that expires by TTL is still eligible for resurrection; a record that is erased is not.** Any code path that treats "not currently readable" as equivalent to "erased" violates the erasure guarantee the moment a salience rescoring job reloads the record from a cold tier or a derived embedding index. ## What Was Observed In a production memory service, records carried a `ttl_at` timestamp and a `salience` float in `[0,1]`. A background compactor swept expired records into a cold archive tier, keeping them for 30 days for "possible resurrection if salience is rescored upward." Separately, the service honored erasure requests by deleting the hot-tier row and returning HTTP 200. The failure surfaced when an auditor queried for a specific subject's record after an erasure confirmation. The hot-tier read returned 404 as expected. But a salience rescoring job — triggered by a downstream agent writing a high-salience record that shared an embedding cluster — pulled the archived record back into the hot tier, because the archive tier had no erasure marker, only the absence of a hot-tier row. The record became readable again 11 days after erasure was confirmed. Root cause: erasure was implemented as `DELETE FROM hot`, not as a tombstone that the archive and derived-index layers also honor. TTL expiry and erasure shared the same physical removal primitive, so the archive tier could not distinguish "expired, resurrection-eligible" from "erased, never-return." ## Condition of Validity The distinction is valid only when all of the following hold: 1. Records have a monotonic `expires_at` and a separate, non-recomputable `erased_at` marker (or an equivalent tombstone that survives compaction). 2. Salience rescoring can only *defer* expiry within a bounded window; it can never cross an `erased_at` boundary. 3. Every derived index (embeddings, inverted indices, caches) carries the erasure marker or is rebuilt from a source that does. 4. The resurrection window for TTL-expired records is finite and documented; beyond it, TTL expiry is promoted to hard deletion but is still logged as expiry, not erasure. If any of these fails — most commonly (3), where vector indexes lag the primary store — the erasure guarantee is unprovable and the distinction collapses. ## Decision Boundary The operational rule: **branch on the cause of unreadability before performing any restoration, rescoring, or reindexing.** Concretely: - On `read` miss, inspect `erased_at` first, then `expires_at`. - If `erased_at` is set → return a terminal `ErasureConfirmed` signal; never resurrect, never rescore, never reindex from cold or derived tiers. - If only `expires_at` has passed → the record is a candidate for salience-driven resurrection *iff* within the documented window and no erasure marker exists in any tier. - A `forget(subject_id)` call must write a tombstone that propagates to archive and derived indices *before* returning success. Returning 200 on hot-tier deletion alone is a defect. The boundary is crossed the moment a background job can restore a record without consulting the erasure marker. If your compactor or rescoring job does not read `erased_at`, you do not have an erasure guarantee — you have a TTL with extra steps. ## Operational Effect Teams that collapse the two paths observe erasure violations under exactly one condition: a background job with resurrection authority. The symptom is intermittent — erasure holds until the first salience rescoring or cold-tier promotion touches the subject's cluster. Auditors find it, not production monitors, because the hot-tier read is correctly 404. The fix is structural, not a patch: separate the tombstone namespace from the TTL namespace, make `forget` synchronous across all tiers, and gate every resurrection path on the absence of an erasure marker. Cost is a tombstone store roughly proportional to erasure rate, not corpus size. ```python from __future__ import annotations import time from dataclasses import dataclass, field from typing import Optional class ErasureViolationError(RuntimeError): """Raised when a resurrection path would revive an erased record.""" pass @dataclass class MemoryRecord: key: str payload: str expires_at: float salience: float erased_at: Optional[float] = None class MemoryStore: def __init__(self) -> None: self._hot: dict[str, MemoryRecord] = {} self._archive: dict[str, MemoryRecord] = {} self._tombstones: set[str] = set() def write(self, rec: MemoryRecord) -> None: if rec.key in self._tombstones: raise ErasureViolationError( f"refusing to write {rec.key!r}: subject erasure tombstone is active" ) self._hot[rec.key] = rec def forget(self, key: str) -> None: # Tombstone must be durable before any tier returns success. self._tombstones.add(key) self._hot.pop(key, None) self._archive.pop(key, None) def resurrect(self, key: str, new_salience: float) -> MemoryRecord: """Salience-driven restoration of an expired (not erased) record.""" now = time.time() if key in self._tombstones: raise ErasureViolationError( f"resurrect({key!r}) blocked: erased_at marker present in tombstone store" ) src = self._archive.get(key) or self._hot.get(key) if src is None: raise KeyError(f"no record {key!r} in any tier") if src.erased_at is not None: raise ErasureViolationError( f"resurrect({key!r}) blocked: record carries erased_at={src.erased_at}" ) if src.expires_at > now and key in self._hot: return src src.salience = new_salience src.expires_at = now + 3600.0 * max(1.0, new_salience * 24.0) self._hot[key] = src self._archive.pop(key, None) return src ```