After the person's own commit
On this page
Erasing a person is one transaction in their store. Everything else an erasure reaches follows it, and what it doesn't rewrite is kept erased.
Records in another store
An action can write to only one store, so records your app keeps in another
store are erased straight after the person's own commit, by an event
subscriber that Jadpo generates, named
erasure in archive here. Such a record refers to the person with a
reference that says erase: and has no on_delete:, and erase: means what
it means on any reference:
// app.jadpoapplication { connections: { main: { driver: Driver.postgres } archive: { driver: Driver.postgres } erasures: { driver: Driver.postgres } } privacy: { erasure_log: { store: erasures } }}
// domains/club/entities/old_ticket.jadpouse club/entities { Member }use club/types { TicketTitle }/// A ticket from years ago, deleted with whoever raised it.entity OldTicket { id: Uuid owner_id: Member.id { erase: Erasure.deleted } title: TicketTitle store: archive policy: { create: [Access.public] read: [Access.public] }}
- It isn't a foreign key, since no database holds one across stores, so nothing checks what it names when a record is written. It is indexed like any reference, since erasure finds its records by it.
- Nothing reads through it. A query is one statement, which reads one
database, so an include can't follow it, and neither can a membership's
member:. - Only erasure applies it. Anything else that would delete the person
would leave a record holding an
idno record has, out of reach of any erasure, so it is refused: a harddeleteof them, aretention:or apurge:, on their entity or through a cascade (data.person_removal_across_stores). A lifecycle'sdeleteonly hides them, and erasure still finds them. So a person whose own record stays until its retention ends can't be referred to from another store. - Each store's share is one statement. Records there it deletes, however
deep, and those it keeps, go as they would in the person's own store. A
person it deletes there is erased in their own right, with their own
PersonErasedand their own entry in the log, so a record in a third store that refers to them is reached from there. - Any other reference across stores, with an
on_delete:or to an entity that isn't a person, isdata.reference_across_stores.
A store that can't do its share yet doesn't undo the erasure. The delivery
stays in the person's store, tried again for a month, and
jadpo deliveries shows it with
why. Past that it is failed, and stays for an operator, whose retry finishes
it. The next start's replay applies it too (What erasure doesn't
rewrite), once the person's entry is in the log.
This test closes an account and looks in the archive:
// domains/club/actions/close_account.jadpouse club/entities { Member, MemberNotFound }/// Erases a member, here and in the archive.action close_account(member: Member.id) fails MemberNotFound -> Unit { attempt Member.erase(member)}
// domains/club/actions/close_account.test.jadpouse club/entities { Member, MemberNotFound, OldTicket, OldTicketNotFound }use club/actions { enrol, file_ticket }test "closing an account reaches the archive" { var ada: Member = attempt enrol("ada@example.com") var old_ticket: OldTicket = file_ticket(ada, "The heating") attempt close_account(ada.id) assert Member.get(ada.id) fails MemberNotFound assert OldTicket.get(old_ticket.id) fails OldTicketNotFound}
Who was erased: PersonErased
An erasure emits a PersonErased event for each person it erases, in its
transaction: entity, the person entity's name, id, their id, and
erased_at, when they were erased, and nothing personal. It travels through
the outbox like any event
(Delivery: at least once, safe to repeat).
Subscribe to it to reach anything Jadpo can't, such as a CRM your app calls
through its own integration:
// domains/club/entities/farewell.jadpo/// A note that someone has gone, kept without saying who they were.entity Farewell { id: Uuid departed: Uuid at: Instant policy: { create: [Access.system] read: [Access.public] }}
// domains/club/actions/note_farewell.jadpouse club/entities { Farewell }/// Notes that someone has gone.action note_farewell(event: PersonErased) -> Farewell { return Farewell.create { set: { departed: event.id at: event.erased_at } }}
// domains/club/subscribers/say_farewell.jadpouse club/actions { note_farewell }/// Notes each person erased.subscriber say_farewell { on: PersonErased run: note_farewell(event)}
A subscriber to it in an app with no person is
subscriber.event_invalid.
What erasure reaches
- Every store and cache. The main store's records go in one transaction, and once it commits every entry every cache holds is deleted, before the response goes (Caches). Records in another store follow straight after (Records in another store), each store's share clearing the caches again as it commits.
- Records with a lifecycle are removed outright, not soft-deleted. Your own code can't do that, but erasure, like purge, is an operation the compiler generates, so it can (Lifecycle).
- Files attached to erased records are deleted with them (Files).
- History. An audited record erasure deletes takes its history with
it, in the same statement, and one it keeps keeps its history with
<erased>in place of each value that was the person's (Erasure and the records it keeps). - Feature flags. Their
idleavesjadpo_flagsandjadpo_flag_changes, where a flag named them, with the erasure or straight after it when the flags are in another store (The log). - OAuth grants, the permissions a person gave your app to act for them at a provider, are deleted with the person or record that owns them (OAuth grants). They are revoked at the provider where its package declares how.
- Other companies. Data already sent to a provider, such as an email or payment provider, is outside your database. Providers that can erase are asked to (see "Erasure at providers" below). The personal-data report lists every connection that receives a marked field, and whether its copy is erased.
What erasure doesn't rewrite
- Backups aren't rewritten. Each erasure leaves an entry in an erasure
log, holding the person entity's name, the person's
idand the time and nothing else, written after it commits. Your app names where the log is kept, inprivacy: { erasure_log: { store: } }: a store that holds no person's records, or a store of files, so restoring a person's database can't take the log back with it (data.erasure_log_store). An app that erases someone must name one (data.erasure_log_required). A database named this way needs no entity of its own. A Worker has no disk, so it keeps the log in a database or in aDriver.s3store of files. The runtime replays the log every time it starts, erasing again anyone logged who is still there, in each store, so a restored backup is erased before the app serves anything. It asks each store about a thousand people at a time, and finding nothing changes nothing, however often. A log it can't read, or a store it can't work in, keeps the app from serving until it can, and a replay that finds someone says so withruntime.erasures_replayed. An entry stays as long as the log does, since a backup older than any entry could still be restored. Backups themselves expire on the hosting platform's schedule, which the report states. This is what the UK regulator, the ICO, calls putting data "beyond use". - There are no per-person encryption keys, so erasure never works by deleting a person's key ("crypto-shredding").
- Logs aren't rewritten either. They hold identifiers and hashes, never marked values, and expire on their own retention.
Markdown for agents: /docs/erasure-after-the-commit.md.Built from Jadpo's main branch at commit 9080dc3.