Redaction versions
A document collection (an UnstructuredFacet) often has readers who may see the
documents but not every value in them: a support assistant that answers from
customer letters without seeing account numbers, an analyst who needs the topics
of complaints but not who wrote them.
A redaction version is a copy of the collection’s content in which a fixed set of classes of values is replaced by tokens. A policy binds each subject to exactly one version, or to the original. The engine serves that version or refuses: it never picks a “close enough” one.
Families and numbering
Section titled “Families and numbering”Every version belongs to a family, the human name of what it is for
(No contact data). The engine numbers the versions of a family itself: the
version’s name is <family> · v<number> (No contact data · v3).
- The number is one more than the highest number the family ever had in the collection, deleted versions included, so a number is never reused.
- The name is unique and stable. Every route, policy binding, audit record and validation sample uses it as the key.
- A family named in another letter case or Unicode form is the same family, under its first spelling. A family name may not end in a version number.
- A version created from another one (
derived_from) or as the correction of a returned one (correction_of) continues the parent’s family unless you name another. - When a release makes a family’s live version stale, you declare the same classes again in the same family: the new version takes the next number, and the old number stays with the old definition.
GET …/redaction-versions?view=families on the management API answers one entry
per family: its head (the live version, else the newest one in progress), the
counts by state and the lineage edges between versions.
What defines a version
Section titled “What defines a version”A version is defined by:
- a set of classes, each with a detector:
- pattern classes from the built-in catalogue:
email,phone,iban,credit_card,es_dniandvehicle_plate, all run by one pattern detector; - text classes: a plain-language instruction executed by the cell’s own language model (see below);
- visual classes:
face, where the deployment mounts the image assets (see Images, audio and video);
- pattern classes from the built-in catalogue:
- an operator: replace each value with its class token (
[EMAIL]), or number distinct entities per document ([CUSTOMER_NAME_1],[CUSTOMER_NAME_2]); - a visual operator for images:
opaque(a solid fill, the default) orblur; - an optional corpus description: what the documents are (see below);
- the deployment inputs that change what is stored: the chunker, the embedder, the text detector’s contract and pinned model, the metadata fields scrubbed, the audio margin and, on a deployment that reads images or speech, the image and speech settings.
The catalogue of classes, with each detector’s documented limitations, is
GET /osl/redaction/detectors.
Text classes, context and examples
Section titled “Text classes, context and examples”A text class is an instruction such as:
Names of the customer and of their relatives; never company names.The model reads each chunk at temperature 0 and names the values it finds. The runner then locates those values in the chunk itself, exactly and after folding accents, letter case and whitespace, so offsets never come from the model. A value the model flags but that cannot be found fails the chunk: it is not stored, and the document is retried on the next sync. A chunk is never written in clear because its detector failed.
Two kinds of context reach the model:
- The corpus description (optional, at most 600 characters) says what the documents are, for example “invoices of an electricity supplier; its own contact details are not personal data”. Every text-class call gets it, so it is part of the version’s definition and fingerprint.
- Exclusions written into an instruction. In
“postal address of a person; not the company’s own addresses”, the
exclusion travels with its class. When a version’s words say what does not
belong, an owner check asks the model, with the document’s context, whether a
value is the organisation’s own (its name, address or a service contact
point), and a second reading must agree. Anything else, an unclear answer or
no answer keeps the value redacted. Identity numbers, IBANs, card numbers,
vehicle plates and faces are never left in clear by this check. Each value kept
is counted per class (
keptByClass), never stored.
Structured context of a class
Section titled “Structured context of a class”Instead of packing examples into the instruction, a text class can carry a
context object. Every field is optional:
| Field | Bound | Meaning |
|---|---|---|
description |
500 characters | What the class is. |
whereItAppears |
300 characters | Where its values are usually written. |
examplesYes |
up to 10 × 120 characters | Made-up values that belong to the class. |
examplesNo |
up to 10 × 120 characters | Made-up values that look similar and do not belong. |
The context is validated strictly (an unknown field, a value over its bound, or
an example in both lists is refused with E0278, invalid_context). Texts are
normalised and each list of examples is treated as a set, so the same examples
in another order are the same definition. The context is part of the class and
of the version’s fingerprint: changing one example is a new version. The model
sees it in a fixed block next to the instruction in every call that names the
class.
Examples must be made up. An example travels in the definition, the
fingerprint and the prompt, so a real value pasted there would copy the
tenant’s data into a definition. When a version is created or a draft is saved,
an example that appears verbatim in the collection’s documents is refused
(422 E0102, example_looks_real). The answer names the class, the field and
the position of the example in the list, never its text.
Trying a class. On a draft, POST …/redaction/drafts/{id}/sample/try-class
runs one class, with its context, over the draft’s validation sample. It answers,
per document, how many spans the class marks and a few excerpts in which each
span is replaced by the class token and the span’s shape (digits as 9, capitals
as X, lower case as x), never the value. It stores nothing, follows the
access and audit rules of the sample, and runs one at a time per draft.
Some instructions that work well as text classes:
| Class tag | Instruction |
|---|---|
customer_name |
Names of the customer and of their relatives; never company names. |
postal_address |
Postal address of a person; not the company’s own addresses. |
health_data |
Any mention of an illness, a diagnosis, a treatment or a medication. |
other_identifier (contextual) |
Any other data that identifies the customer. |
scope: contextual asks the model to decide in context (“the name only when it
is the customer”) or to act as a catch-all. Contextual classes are useful and
imprecise: a version that has one requires a person’s review of a sample
before it can be validated, and a catch-all never counts as coverage of anything
in particular.
Writing a version in plain language
Section titled “Writing a version in plain language”POST /osl/redaction/compile takes a text such as “hide the IBAN and the
customer’s name, but keep the amounts” and proposes classes. Catalogue
classes are matched from a versioned lexicon; everything else goes to the local
model, which only chooses a text class’s tag and scope (the instruction is the
author’s own words). A fragment the compiler cannot place is reported as not
understood and blocks until the author resolves it. The proposal stores and
audits nothing: creating the version stays an explicit act.
Previewing
Section titled “Previewing”POST /osl/redaction/preview runs the same chunker, detectors and operators as
ingest over up to three sample texts, so what it shows is what will be stored. It
also reports near misses (for example a digit run too short to be a phone).
Fingerprints
Section titled “Fingerprints”The defining inputs, and nothing else, are hashed into the version’s
fingerprint (rvf-v1:…). The name, the status, who approved it and the
author’s free-text statement are not part of it: renaming or activating a version
never changes what it is, and two versions with the same classes are the same
definition (the second is refused as a duplicate).
A version is immutable. Changing anything in its definition, a comma in an
instruction included, is a new version with a new fingerprint. The engine is the
only writer of a collection’s versions, every write carries the collection’s
If-Match etag, and the compiler recomputes each fingerprint from the definition
and the deployment inputs recorded next to it (fingerprint_basis), so a declared
fingerprint can never stand for another definition.
A version is its definition, not a set of documents
Section titled “A version is its definition, not a set of documents”The sign-off attests a definition, checked on its validation sample. It does not attest a frozen list of documents. Every load applies each declared version to the collection’s documents as they are at that moment:
- A document that arrives later, after the version was validated and signed, is redacted under the same definition and served at once, without a new review.
- A document edited at its source is redacted again in place, under the same opaque id, so an earlier value is never served.
- A document removed at its source leaves the base table and every version
table at the next load. The removal is recorded on the audit trail first, and
nothing is removed without that record. From then on, its media answers
410 source_deleted, and a validation sample that holds it records the removal (a closed sample only carries the annotation). - The version’s summary counts the documents its table holds after that load.
A document whose copy needs a person’s review is withheld until it is reviewed, whenever it arrived. See Materialization for how the runner applies these changes.
Re-create when detectors change
Section titled “Re-create when detectors change”The fingerprint records the deployment inputs the version was materialized with. When one of them changes, the version no longer describes what the deployment would produce, and it becomes stale:
- a new release changes a detector’s behaviour, the text detector’s prompt or
rules, or the way document text is normalised. For example, the rule that
checks table columns in spreadsheets and office tables
(
column-consistency-v2) and the detection template that reads a class’s context (text-detect-v2) enter every text fingerprint, so text versions declared before them are stale; a change to the phone pass makes versions with a phone class stale; - the configured language model, or its reasoning mode, changes;
- the embedder, the chunker, the metadata fields or the audio margin change;
- on a deployment that reads images, the OCR engine, its version or languages, the confidence thresholds, the box padding, or face detection settings change; turning video frame redaction on adds the video settings.
A stale version is reported (state: stale, fingerprintCurrent differs from
fingerprint), it can never be activated, and the runner refuses to materialize
it rather than silently re-render it under other rules. A live version that turns
stale keeps being served from the table it already has.
What to do: create the version again. Use the same family (it gets the next
number), and the classes and instruction you want. Validate and sign the new
version, then move the policies to it and retire the old one. A version declared
under detector rules that a release removed is refused when the collection loads
(E0277, version_refused): it is neither served nor materialized, and it has
to be created again in the same way.
Lifecycle
Section titled “Lifecycle”create ──▶ pending ──activate──▶ live ──(a successor is activated)──▶ superseded │ └──────retire──────┐ │ │ ▼ │ └──────delete──────▶ deleted ◀──delete── retired ◀──retire───┘| Status | Meaning |
|---|---|
pending |
Declared and materialized, but never served and never bindable by a policy. |
live |
Served to the policies that bind it by name. |
superseded |
Replaced by a live successor; still served, but only to policies that bind it by its exact name, so policies can migrate at their own pace. |
retired |
No longer served, bound or materialized; it can only be deleted. |
The management API derives a richer state for a pending version:
materializing, failed, validated, stale or pending, plus
returned when a reviewer sent it back. Only a validated version can be
activated. See Validation and sign-off.
Retiring and deleting
Section titled “Retiring and deleting”A tenant administrator acting as a person removes a version in two audited steps:
- Retire a served version (live or superseded) with a reason. It is refused while a policy that is not archived binds the version; the answer names those policies.
- Delete a version that is not served (pending, or retired). The deletion removes its table and indexes, its media and redacted copies, its validation sample with every review and note, the review marks and every document link holding one of its documents. The originals stay: they belong to the document, not to a version.
A deleted version’s name is never declared again in the collection, so nothing that names it (an audit record, a receipt, a policy) can reach another version under its identity. The same classes can be declared again under the next number. Versions derived from a deleted one keep working: every version is materialized from the original, never from its parent.
Exact or deny
Section titled “Exact or deny”The engine serves the version that redacts exactly what the subject’s policy (or
the union of its policy chain) requires. If no servable version matches, or its
table is not materialized yet, the read is refused visibly with E0276: never an
empty answer and never a more or less redacted version.
“Exactly” is about definitions, not only tags. A pattern class means the same
everywhere. A text class does not: customer_name described as “every person
name” and as “customer names only” are different things, so two policies of
one chain that bind different definitions of the same tag are denied rather than
served either.
Isolation and identifiers
Section titled “Isolation and identifiers”- One table and one index per version. Embeddings computed from text that contains a value can leak that value. Each version has its own table, vector and full-text indexes, built from text in which its classes were already replaced, and a query opens only the table its policy selects.
- Opaque document identifiers. A version’s table never shows the original
document id or file name. Its
doc_idisd_followed by 26 characters of a keyed hash: stable for that table, different in every version, and not derivable from the original id without the key. Itssourceis a governed name (document-<id><ext>). On a version,doc_idis compared with=orINonly (E0243otherwise). - Always from the original. Every version is materialized from the collection’s original text, never from another version’s output, so the errors of one version never propagate into another.
- The base table holds the original once a tenant administrator other than
the version’s author approved it for the collection’s first version
(
approve-base). Until then the base keeps the masked text every subject bound to the original already reads. A collection needs anacl_fieldbefore any version can be created.
Limitations
Section titled “Limitations”The catalogue lists each detector’s limitations. The most important ones:
- Text and contextual classes do not guarantee coverage. A model can miss a value, and a document can contain text that tries to steer it. That is why a person’s review is mandatory before validation, and why the discoverer reports sensitive content no class covers.
- Phone numbers are a generic digit run of 8 to 12 digits; dates, amounts and references of that length can be masked as phones, and shorter numbers are missed. A long code (two capital letters followed by digit groups holding more than 15 digits, such as a supply-point code) and a range of years are not read as phones.
- Payment cards are Luhn-validated, so any other Luhn-valid number of 13 to 19 digits is masked too.
- The voice is not de-identified. A version covers what is said in a recording, not the speaker’s voice.
- A covered image is what its boxes cover. Never present it as anonymised.