Skip to main content

Erasure execution

The erasure execution batch carries out every erasure request that is due: approved, or deferred with its earliest execution passed (D11 phase 5). For each, the erasure executor asks every precondition again under a lock, writes the permanent erasure certificate, and tombstones the person's identity in the Warden identity vault. The batch decides nothing: approving decides.

At a glance​

Batch classMGCWardenErasureExecutionBatch, which calls MGCWardenErasureExecutor::execute once per due request
Menu itemMGCWardenErasureExecuteMenuItem, label Execute due erasures
Menu pathSystem administration → Setup → Execute due erasures, and the same button on Erasure requests
Who may run itMGCWardenErasureRequestPriv (Request erasure of a person from the Warden identity vault, granted at Update) → MGCWardenErasureRequestDuty → Warden identity resolver (MGCWardenIdentityResolver). The API operation MGCWardenBatchService.runErasureExecute is granted on the same privilege and re-checks the same menu item
Feature toggleNone. run() reads no feature toggle
Company scopeInstallation-wide. Requests, certificates and the vault are shared tables, so one schedule in any company covers every request. The preconditions and the census read every legal entity explicitly, each confirmed read first (MGCWardenErasureLegalEntities)
Scheduled by defaultNo. Nothing in the product creates a batch job for it
RecurrenceYou choose. A deferred request becomes due on a date; it is erased on the first run after that date
Setup-gap rules watching itErasureExecutionNotScheduled (code ERASUREEXEC): a request is Approved or Deferred and no job of this class carries a recurrence in any company. A recurrence in any company clears it. LegalEntityWithoutWardenParameters lists legal entities the guard cannot confirm it read, where erasure is refused
Run recordNone of its own. Each executed request has its certificate; each request not executed carries the reason on the request
Overlap guardNot guarded by MGCWardenBatchOverlapGuard. The executor locks the request and then the vault row (pessimisticlock), so two executions of one request, or two requests for one subject, serialize and the second finds the first's work

Purpose and business justification​

A data subject's right to erasure has to be met without destroying evidence. Warden keeps people in its evidence as subject references (WP-...), resolved through the identity vault. Erasure destroys the vault's link between the reference and the person (a tombstone) and keeps every evidence row untouched, so no digest, anchor or purge certificate moves.

Erasure is dual-controlled: one person raises the request and a second approves it through workflow (Warden erasure approval). Approval records the decision and restricts the identity. This batch then performs the irreversible step outside the workflow, where a failure is a recorded execution exception rather than a faulted workflow, the same split the audit purge uses.

Where a record naming the person is still inside its retention period, approval defers the request to the date the last retention lapses. The identity stays restricted until then.

How and when it is triggered​

  • Scheduled from the menu item, with a recurrence, in any one company.
  • Run now from the menu item or the button on Erasure requests. canRunInNewSession() returns true.
  • API: MGCWardenBatchService.runErasureExecute.

Upstream, the Warden erasure approval workflow's completion (MGCWardenErasureApprovalWFEventHandler, MGCWardenErasureRequestManager::accept) asks the preconditions and makes the request Approved, or Deferred with its earliest execution, or Refused. That runs on the workflow runtime, not in this batch.

Configuration and scheduling options​

No dialog fields; pack() returns conNull(). Nothing is configured for the batch itself. What decides when a request becomes due is the retention configuration of every family that names the person:

FamilyRetention used
Audit evidence storeThe row's own retention class from Last occurred; a row with no class on the longest class; no class configured at all keeps it indefinitely
Governance event logThat company's Evidence retention (years); 0 keeps it indefinitely
Role eventsSeven years (84 months) from the event
Signature manifestations, leaver intake records, decided deprovisioning entriesThat company's evidence window
Purge proposals and certificates the person proposed or approvedThe longest evidence window in any company
Count cases and counter records (workers and warehouse users)Indefinitely while a case is open; then Closed case retention

Choosing a recurrence. Daily is enough. Deferral dates are in UTC and a request is erased on the first run after its date. Each run also re-asks every deferral (see below), whose cost grows with the number of deferred requests.

What it does​

  1. Refresh deferrals (refreshDeferrals). For every Deferred request, asks the retention calculation again (MGCWardenErasurePreconditions::retention). A changed date or reason is written to the request with an ErasureDeferred governance event. A request that fails here keeps its date and files an Error execution exception.
  2. Work list. Reads every request that is Approved, or Deferred with an earliest execution at or before now (MGCWardenErasureRequest::isDue). A deferral whose date is the maximum value waits on an indefinite retention and is never due.
  3. For each request (executeOne, at transaction level 0), the executor:
    • mints the executing account's subject reference before any transaction;
    • in one transaction: locks the request (must still be Approved or Deferred), then the vault row;
    • asks the three preconditions again under the lock:
      1. the account is gone or disabled, and a disabled account holds no enabled role (a warehouse user is asked in its own legal entity);
      2. the person takes part in no open control: no non-final purge proposal, missing-count entry still queued, gated trade agreement journal, active hold or Proposed deprovisioning entry, and for a warehouse user no open count case;
      3. nothing naming the person is still inside its retention period;
    • a refusal is written on the request (noteNotExecuted) and nothing else; the request keeps its state and the next run tries again;
    • otherwise takes the census (MGCWardenErasureCensus::take): what the erasure reaches, what it cannot (rows still naming the person in clear), and which clear operational rows to clean;
    • inserts the erasure certificate and checks it certifies this reference;
    • tombstones the identity (MGCWardenIdentityVault::tombstone, its only production caller);
    • cleans the clear operational rows the census planned: AssignedTo blanked on open work-queue rows, signing limit and role snapshot rows deleted, and a worker's device map rows deleted. If the count differs from the certificate's, everything rolls back;
    • marks the request Executed with its certificate;
    • writes an ErasureExecuted self-audit row and governance event, inside the same transaction, so a failure to record either rolls the whole erasure back.
  4. A throw out of the executor is filed as a Critical execution exception against the request (The erasure of subject ... failed while it was being executed, and nothing was erased ...). The request keeps its state.
  5. Writes Warden erasure execution: N deferred request(s) given a new earliest execution; N due erasure request(s) examined; N executed, N not executed yet and still waiting (the reason is on each request), N no longer due. ...

A failure of the run itself files one Error exception under document key ERASURE-EXECUTION.

Dependencies and prerequisites​

  • An erasure request raised (Raise erasure request), submitted (Submit for erasure approval) and approved through Warden erasure approval by a second person.
  • Warden initialized in every legal entity, so each can be confirmed read. Otherwise the erasure is refused and the setup gaps page lists the legal entity.
  • The account the batch runs under able to read every legal entity's Warden parameters.
  • For retention to lapse at all: retention classes configured and evidence windows above zero.

Inputs and outputs​

DirectionTable or objectWhat
Reads, locks, updatesMGCWardenErasureRequestState, earliest execution, status reason
Reads, locks, updatesMGCWardenIdentityVaultRestricted row, then tombstoned
ReadsThe audit store, event log, role events, signatures, leaver intake, deprovisioning, purge, hold, count and trade agreement tables, in every legal entityPreconditions and census
InsertsMGCWardenErasureCertificateOne per executed erasure; permanent
Updates, deletesWork-queue claims, signing limits, role snapshots, device map rowsThe planned cleanup
InsertsMGCWardenAuditEvent, MGCWardenEventLogErasureExecuted rows; ErasureDeferred rows for refreshed deferrals
InsertsMGCWardenExecutionExceptionCritical per failed request; Error per failed deferral refresh or failed run

Evidence rows are not written to or deleted.

Logging and monitoring​

  • Erasure requests (System administration → Setup → Erasure requests): each request's state, earliest execution and the reason it has not executed.
  • Erasure certificates (System administration → Setup → Erasure certificates): what each erasure reached and could not reach.
  • Data entities Warden erasure requests and Warden erasure certificates. The certificate entity is the ledger from which erased references are re-applied after a database restore.
  • Execution exceptions: failed executions (Critical), failed refreshes and runs (Error).
  • Setup gaps: ErasureExecutionNotScheduled when accepted requests wait and the batch has no recurrence in any company; the row counts them. A Deferred request counts even before it is due, because the batch is also what moves its date.

Screenshot to add: the Erasure requests page with one Deferred request showing its earliest execution and reason.

Errors, recovery and troubleshooting​

SymptomCause and recovery
Request stays Approved or Deferred, with a reasonA precondition refused at execution: the account was re-enabled or holds a role, an open control names the person, or a retention period has not lapsed. Resolve the cause; the next run tries again
Reason names a legal entity that could not be confirmed readWarden is not initialized there, or the batch account cannot read its Warden parameters. Run Initialize Warden in that legal entity, or run the batch under an account that can
Deferred, and the reason says no date can be setA retention rule keeps a record indefinitely (no retention class configured, or an evidence window of 0). The request is never due until that changes; each run asks again
Critical The erasure of subject ... failed while it was being executed, and nothing was erased ...The executor threw; the whole transaction rolled back. A cleanup count that changed between census and cleanup is one cause; the next run counts again
Error ... could not ask the deferral of subject ... again ...The deferral keeps its previous date. The next run asks again

The class does not implement BatchRetryable. Every failure is caught and recorded, so the task ends normally.

Impact on other functionality​

  • Evidence. Rows that named the person by reference now name nobody; the reference renders as erased. Rows that still name the person in clear (written before their column was converted, and the kernel Created by) are not reached; the certificate counts them.
  • Role capture. Erasure is refused while a disabled account holds any role, because the next capture would issue the account a new reference. See Role event capture.
  • Role event retention and the other retention tasks are what eventually release a deferral. See Role event retention and Warden retention cleanup.
  • Database restore. Restoring a database from before an erasure brings the identity back unless the erased references are applied again.

Not confirmed: the legal reading behind deferral and restriction is with counsel.