Table of Contents

Class ErasureException

Namespace
Excalibur.Compliance
Assembly
Excalibur.Compliance.Abstractions.dll

Exception where data was retained per Article 17(3).

[SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "Represents a GDPR erasure exception (legal retention), not a runtime exception.")]
public sealed record ErasureException : IEquatable<ErasureException>
Inheritance
ErasureException
Implements
Inherited Members

Properties

Basis

Gets the Article 17(3) ground under which this data was kept.

public required LegalHoldBasis Basis { get; init; }

Property Value

LegalHoldBasis

The legal basis; or NotEstablished meaning nobody stated a ground.

Remarks

The unknown lives in the enum rather than in a nullable, and that placement is the fix. A nullable here would protect only this property: default(LegalHoldBasis) would still be a lawful-looking ground at every other carrier, including every carrier added later. NotEstablished at zero fixes the type once, for every site that has one of these and every site that will.

It is not a neutral omission — it makes the erasure incomplete. An exemption whose ground was never established is an unmet obligation, and presenting an unmet obligation as a lawful basis turns a failure into a defensible retention. The certificate is still issued and records that the erasure did not complete, rather than attesting a lawful outcome over a retention nobody justified.

DataCategory

Gets the data category retained.

public required string DataCategory { get; init; }

Property Value

string

HoldId

Gets the associated legal hold ID.

public Guid? HoldId { get; init; }

Property Value

Guid?

Reason

Gets the reason for retention.

public required string Reason { get; init; }

Property Value

string

RetainedKeyHandle

Gets the key handle still protecting this data subject's fields in the retained aggregate type, so the retention can be released when the obligation lapses.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? RetainedKeyHandle { get; init; }

Property Value

string

The handle to destroy, in the form DeleteKeyAsync(string, int, CancellationToken) accepts; or null for an exemption that is not an aggregate retention, and for one whose key this erasure did not decide about.

Remarks

Without this, the declared period is decorative. A retained aggregate type keeps a key of its own so the surviving record stays readable, and that key is NOT the data subject's own handle — so nothing in the erasure path ever queues it again. When the statutory period ends, destroying it is the only act that completes the erasure, and it can only be done BY NAME. A retention whose exit cannot be found is a retention with no exit, which is the Article 17 breach the mandatory period exists to prevent.

It discloses nothing the record does not already carry. The handle is composed from the data subject hash, which the payload already states, and a digest of the aggregate type, which this entry already names. Recording it adds an identifier, not a fact.

Releasing it is yours to time, and the framework does not attempt it. The instant a particular record's obligation lapses depends on the transaction date, the jurisdiction and whether the period was extended — facts the framework does not hold. What it guarantees is that the handle is named on the record, so the act is possible at all.

NULL, not empty, and omitted from the signed form when null — this is load-bearing, and it is not a style choice. The canonical form is what gets signed, and verification recomputes it from the DESERIALIZED payload. The serializer context emits defaulted properties, so a property that always serialized would change the canonical bytes of every certificate issued before it existed and make each of them verify as a FORGERY — and these documents are retained for seven years. Being null-by-default and ignored when null, this property is absent from the canonical form of exactly those certificates, so their signatures still verify.

RetentionPeriod

Gets the length of the retention, stated only alongside the instant it is measured from.

public TimeSpan? RetentionPeriod { get; init; }

Property Value

TimeSpan?

Always null in this scheme, meaning the end of this retention is not established. A period is emitted only where the end instant it is measured from is also recorded, and nothing in this framework can yet establish that instant.

Remarks

A duration with no anchor is not a retention end, and it reads as one. "Six years" on a signed document leaves the reader to supply the missing instant, and the only instant in front of them is the certificate's own date — which restarts a statutory clock at the moment the data subject asked to be erased, and so extends every retention past the end the law actually gives it. The certificate would then be evidence for a longer retention than the obligation supports, in a document produced to prove the opposite.

Why the end cannot be established here. The instant a particular record's obligation lapses depends on facts held by the deployment, not by the framework: a warranty term runs from delivery rather than from the order that created the record, and a limitation period for claims arising from it runs from something else again. A period declared once for an aggregate type cannot express that, and the erasure's own completion instant is the one anchor in reach and the one anchor that is wrong. Until the end can be supplied per record, the honest form of the claim is its absence.

Reading this property. null is a statement, not a gap: it says the end was not established and MUST NOT be read as "no retention applies" or "the retention has no end". What the entry does establish is Basis, DataCategory, Reason and RetainedKeyHandle — the ground, the data, the justification, and the key whose destruction ends the retention.