Blackholes
An API key accidentally saved in a customer record can stay in history after ordinary deletion. The current record no longer shows it, but a historical query can still read it. Restoring an older backup can put it back in the record.
The blackholes plugin removes or replaces stored field values throughout their history. It changes those values in transaction history and in configured backups. Fields it does not select keep their history, including corrections that may still be needed. History retention serves a different purpose: limiting how much history a database keeps.
Choosing the values to remove
A leak rarely stays in one record. The key from the example may have been copied into every record of the same customer, or into a token field next to it. A blackhole is therefore a stored definition, written like a mutation: a query selects the records, and a patch names the fields to change on each of them. All selected fields change together in one local transaction.
The selection follows the query's ordering, grouping and limits. It reads current records by default, while a temporal query can find a record that ordinary deletion has already removed from current state. This lets the definition select earlier records without restoring them. The selected fields are then rewritten throughout their history through the operation's cutoff.
For each selected field, the removal covers every value asserted through a transaction cutoff, including its current value at that cutoff. A field set to null in the patch loses those values. Any other patch value is an expression that calculates a replacement for each assertion; a fixed text is the simplest one. Existing retractions stay unchanged. Fields the definition does not select, and transaction IDs, stay unchanged.
A null can also occupy the entity position in the patch. It erases every historical field of that entity, including fields no longer present in current state. The query must explicitly select each entity to erase. Outgoing links are not followed, and the field name does not establish ownership.
Incoming references require a separate choice in the definition. Without links {incoming remove}, those references block whole-entity erasure. With that option, matching references are removed throughout history, while the entities containing them remain. Other content and empty containers survive the cleanup. Preview shows the expanded scope, and approval covers every additional field that cleanup changes.
Previewing a transformation
A replacement expression can use the historical value, the selected record's query variables and a secret seed to calculate a pseudonym. Preview evaluates the expressions with a temporary seed and shows sample replacements. Execution generates a fresh secret seed and uses it for every expression in the operation. An expression of only the seed and the value therefore gives one value the same pseudonym in every selected field. With a cryptographic hash of the seed and value, the preview cannot predict the actual replacements.
Approval covers the definition, its parameters, the selected fields with their expressions and the source history, rather than the sample output. A preview counts the affected fields and assertions without changing history and uses the current transaction as its cutoff. Execution selects again and checks that all of it still matches the approval. Editing the definition, or any commit after the preview, requires a new preview, even if the commit changed an unrelated entity.
Seeded replacements can support anonymization and erasure workflows while keeping useful data types and history. The expression must actually remove the sensitive information: returning the original value or exposing the seed defeats that purpose. Read access to the resulting records stays unchanged.
The rewrite transaction records the actor, reason, the definition and its revision, and maps of affected entities and fields. This immutable metadata commits with the rewrite, so an interruption cannot leave a committed removal without its audit. Recovery progress is kept separately. The plugin does not copy removed values or parameters into the audit, and the person supplying the reason must also keep sensitive values out of it.
Backups and interrupted operations
Backups must change with the database so that a restore cannot reintroduce the removed values. Removal therefore replaces the history in every configured backup target. Before removal begins, every target must be reachable and agree with local history. If a target is unavailable, the operation changes nothing.
Once the local rewrite commits, a later failure cannot undo it. The database keeps a recovery record until all backup targets contain the rewritten history. If backup replacement is interrupted, the next database open resumes it. Opening fails while a required target remains unreachable.
Backup recovery copies the replacement values already committed in the database. It does not run the expression again or generate another set of pseudonyms. The execution seed is temporary and is never stored in the audit or backup recovery record.
Limits of removal
Removal changes readable history in the database and its configured backups. It does not overwrite freed disk pages or erase old versions retained by a storage provider. Independent database copies and external snapshots need separate cleanup.
Applications must reopen affected mounted snapshots after removal. They must also discard staged saves based on the old history. Bytes already delivered to an application cannot be recalled. On macOS, where the mount cannot expire files that are already open, removal is refused while a filesystem mount is configured.
A stored field can reference a shared binary payload. Removing that reference leaves the payload intact. Other records may still use it, so deleting the payload requires a separate operation.
Later transactions can store the field or the same value again. An application that must prevent this needs a validation rule for future writes.