Erasure that holds on every write path: the vault outranks the draft
An interview note erased from a candidate's record can still sit in an interviewer's unsubmitted draft. If the next submit validates that draft against itself, the erased sentence backs a rating again, and the deletion gets undone without anyone doing anything wrong. The read order has to run the other way: ask the authoritative store first, and let the draft speak only for notes the store has never seen.
We meet this shape whenever deletion is a product requirement rather than a cleanup job. A payments platform that removes a dispute attachment, a compliance queue that drops a verification document when its retention window expires, a hiring loop that erases a candidate on request. In each of those the deletion is a promise made to somebody outside the system, and the promise is only as strong as the weakest write path that runs afterwards. Removing the bytes is the easy half. The hard half is making every subsequent write refuse to put them back.
sealedloop (https://github.com/shipmindlabs/sealedloop) is our interview-loop engine, and it is where we worked this through in the open. Free text lives in an erasable per-candidate vault keyed by the digest of the text, and a filed scorecard keeps digests only. Erasing a candidate leaves a tombstone behind, and the append-only hash chain over the loop still verifies afterwards, because nothing in the chain ever held the text.
The draft is a cache, and caches outlive their source#
While an interviewer is still writing, the note has to be readable, since you cannot ask somebody to review their own card against a hash. So addEvidence files the digest under the competency and keeps the text beside it on the draft:
export function addEvidence(card: Scorecard, competencyId: string, text: string): Scorecard {
checkOpen(card);
const competency = requireCompetency(card.rubric, competencyId);
if (typeof text !== 'string') {
throw new SealedLoopError('INVALID_EVIDENCE', `evidence for ${competency.id} must be a string`);
}
const written = text.normalize('NFC');
const digest = digestOf(written);
const note: EvidenceNote = { competencyId: competency.id, digest };
return freezeCard({
...card,
evidence: [...card.evidence, note],
texts: { ...card.texts, [digest]: written },
});
}That texts map is a cache of something the vault owns, and it is held on a client object that nobody else can reach. A card drafted on Monday and submitted on Thursday carries Monday's copy. If the candidate asked to be erased on Wednesday, the draft is now the only surviving copy of a sentence the system has promised is gone, and it is about to be handed to a validator.
The dangerous part is that this needs no malice and no bug. Two interviewers on the same panel who watched the same exercise can type close to the same observation, and a panel member who drafts early and submits late is normal behaviour rather than an edge case. Any design that validates a submission against the submitter's own copy of the evidence will re-file erased text sooner or later.
checkSubmittable takes its reader as an argument#
The validator does not reach for a store, and it does not reach for the draft either. It takes a resolver, and defaults to the draft:
export function checkSubmittable(
card: Scorecard,
resolve: TextResolver = (digest) => readDraftText(card, digest),
): void {That default is the right one for the drafting surface. An interviewer typing on a laptop with no network should be told immediately that a top anchor has no note long enough to back it, and that check is local, cheap, and about their own work in progress. It is advisory, and it has to be understood as advisory.
At submit the Loop passes a different reader. In src/loop.ts, after the panel, reveal, recusal and duplicate checks have all passed, submit runs:
checkSubmittable(card, this.#resolver(ref, card));
assertSameRubric([...this.#store.readCards(ref), card]);The resolver is private and bound to one candidate reference and one card, which matters: evidence is scoped per candidate in the vault, so a reader that is not pinned to the candidate under submission would be the wrong instrument regardless of its precedence rule.
MISSING is the only status that lets the draft answer#
The precedence the resolver applies reduces to a single rule. The vault is asked for the candidate and the digest, and the draft is consulted only when the vault reports that it has never held that digest at all:
const read = this.#store.readText(ref, digest);
return read.status === 'MISSING' ? readDraftText(card, digest) : read;This works because a text read is a three-way answer rather than a nullable string. TextRead resolves to PresentText, ErasedText or MissingText, and the distinction is load-bearing: MISSING means nothing was ever filed under that digest, while ERASED means something was and is gone. An erased read carries who erased it and when, and deliberately carries no text field, so there is no shape in which a caller can accidentally read through it. Our vault tests pin that directly. An erased note reports ERASED, 'text' in read is false, and a digest that was never filed still reports MISSING.
Collapse those two into one falsy value and the whole scheme fails. null for both forces the resolver to ask the draft in exactly the case where the draft must not be trusted.
A PRESENT answer from the vault also wins over the draft, which is the quieter benefit. Only the store's copy ever decides whether a note is long enough to back an anchor, so what the draft happens to be carrying under that digest never enters the judgement.
The refusal has to name which failure it is#
With the resolver in place, the evidence rule in checkSubmittable counts only present reads:
const filed = card.evidence
.filter((note) => note.competencyId === competency.id)
.map((note) => resolve(note.digest));
const backed = filed.some(
(read) => read.status === 'PRESENT' && countChars(read.text) >= minChars,
);
if (backed) {
continue;
}
throw new SealedLoopError(
'EVIDENCE_REQUIRED',
filed.some((read) => read.status === 'ERASED')
? `${competency.id} rests on the ${edge} anchor ${rating} and the evidence note behind it has been erased`
: `${competency.id} rests on the ${edge} anchor ${rating} with no evidence note of ${minChars} characters or more`,
);Both paths raise the same code, EVIDENCE_REQUIRED, because for the caller the outcome is identical: the anchor is not backed and the card is not fileable. The message splits, and that split is the whole difference between a usable refusal and a support ticket. An interviewer who is told their note is too short will lengthen it and submit, then fail again, because length was never the problem. Told that the note behind the anchor has been erased, they know the sentence is gone for a reason and the next move is a different note or a different anchor.
We apply the same rule to money paths. A refusal should say which invariant it defends, not merely that something is wrong, because the recovery action differs per cause even when the status code does not.
Retyping the sentence lands on the same tombstone#
The one remaining way to reopen an erasure is to type it again. digestOf hashes text that has been NFC-normalized, and addEvidence normalizes before hashing, so the digest is a property of the sentence and not of its byte encoding. Retyping the same sentence produces the same digest, which resolves to the same tombstone and is refused again. Composed and decomposed forms of the same accented character do not fork the record into a fresh slot.
The write path is closed from the other side too. The Store contract states the rule in the interface itself:
readText(candidateRef: string, digest: string): TextRead;
// A digest already in the vault keeps the record it has, so a tombstone never reopens.
writeText(candidateRef: string, digest: string, text: string): void;So even if a submission reaches the copy-out stage, nothing is resurrected. After the commitment and salt are written, submit copies notes into the vault only where the draft reports them present:
for (const note of filed.evidence) {
const read = readDraftText(card, note.digest);
if (read.status === 'PRESENT') {
this.#store.writeText(ref, note.digest, read.text);
}
}
this.#store.writeCard(filed);and redactScorecard has already emptied the texts map on the card that gets filed, so the long-lived record never holds the sentence. A writeText call against an erased digest is a no-op by contract rather than by luck. Our test for this walks the full sequence: one card submitted, the candidate erased, a second card carrying the same note refused with EVIDENCE_REQUIRED, the digest still reading ERASED, and a card with a different note accepted and reading PRESENT, with verifyChain still returning { ok: true } at the end.
What it costs to run#
Validation at submit is no longer a pure function of the card. It needs the store, which means one read per filed evidence note on the competencies that sit at an anchor edge, inside the submit path. For a panel-sized card that is a handful of keyed lookups. Against a real database it is an indexed read on a composite key, and it is probably worth batching if a loop ever files evidence in bulk.
The second cost is conceptual, and it is the one to design the UI around: the local check and the submit check can legitimately disagree. A draft that passed checkSubmittable in the editor can be refused at submit, because the world changed underneath it. Treat the local result as a fast fail rather than a promise, and surface the server's message verbatim when it differs, since the erased-note wording exists precisely for that moment.
What we buy is that erasure means the same thing on every path. There is no window in which an in-flight draft can quietly re-file deleted text, no byte-encoding trick that forks a tombstone into a fresh slot, and no write that can undo a deletion by arriving late. That is the property we want when somebody asks us what, exactly, happens after a deletion request, and it comes from one ordering decision: ask the owner of the data first, and let the copy answer only about things the owner has never heard of.