Skip to content

Materialization

Materializing a version writes its table: every document of the collection, read from the original, redacted under the version’s definition, chunked, embedded and indexed, together with its media derivatives and its redacted copy.

POST …/redaction-versions/{name}:materialize on the management API starts one ingest run per document connector feeding the collection. A connector that already has a run queued or running is coalesced: no duplicate run starts. Each run materializes every declared version of the collection, so a new version and the existing ones stay in step. The create call also takes materialize: true to request the materialization in the same request.

The runner never trusts a declared fingerprint: it recomputes it with the settings it is about to use. A run that names a version it cannot reproduce is refused before any document is read (fingerprint_mismatch); other runs skip that version. A configuration change never produces a half-written table.

While a run is in flight, the version’s progress.live block shows:

  • the stage (extract, load or verify);
  • documents done out of the collection’s total, chunks done and failed documents;
  • an estimate of the time left (from the average time per document, after three documents);
  • liveStale: true when no progress arrived for five minutes.

progress.live.activity says what the runner is doing now: the step (reading, ocr, transcribing, faces, text_classes, rendering_copy, verifying, loading…), the document by its opaque version id and kind, and progress within the step in its own unit (pages, seconds of a recording, frames, windows of text, cells), with a step estimate where the total is known. A client can render a line such as “Transcribing video · document-… · 1:20 of 4:05”. It never carries a file name, a value or text.

While the latest run group of a version is queued or running, every route that decides on the version answers 409 E0290 materializing, with the progress: decisions on validation-sample documents, returning the version, creating or reminding a review request, approving, approving the base, activating and retrying failed documents. The version, its sample and its documents stay readable. Listing the version’s documents (GET …/redaction-versions/{name}/documents) answers an empty page with the state and the progress ({"items": [], "nextCursor": null, "total": 0, "state": "materializing", "progress": …}) while its table is being written. The load writes a version’s table in one commit at the end, so a half-loaded table is never served.

A document that could not be materialized (a failed extraction, a chunk whose detector failed, a copy or media step that failed) is listed by GET …/redaction-versions/{name}/failed-documents: keyed digests (never the document id), the stage (extract, chunks, copy, media) and a neutral reason such as copy_failed:copier_error. A version with failed chunks is failed, never validated.

POST …/redaction-versions/{name}:retry-failed materializes only those documents again under the same fingerprint, even if they are unchanged. It is refused when the fingerprint changed (the version is stale), while a run is in flight, for a version that is no longer pending, and when there is nothing to retry. Each retry is audited.

When a materialization cannot be sure it covered everything (speech the transcription dropped, an on-screen reading in doubt, a page below the OCR confidence floor, a copy whose pages were re-typeset or rasterized, a table cell the column rule could not settle), the document is marked review_required with neutral reasons. Such a document covers more, never less, but it is withheld from every consumption read of the version (search, full-text search, pages, samples, populations, aggregates, jobs, downloads) until a person who can approve the version marks it reviewed.

  • The review queue, GET …/redaction-versions/{name}/documents?review=pending, lists exactly the documents the gate withholds; scope=all lists every document of the version.
  • A mark (PUT …/documents/{docId}/review) is for a tenant administrator acting as a person, is audited before it is stored, and binds the version’s fingerprint and a digest of what was materialized. Re-materializing a document that changed withholds it again.
  • Table columns. In a spreadsheet, or a table of a text document or a presentation, a column in which at least three cells, and two thirds of them, hold one text class is judged as a whole (column-consistency-v2). A value the model read across several cells (a first name and two surnames) is split into its cells first. A cell of that column whose text is a value redacted elsewhere but reads in clear here (a surname two customers share) is redacted at once; any other cell left in clear is read again by the model for that class alone. A cell the model still reads as no value marks the document column_inconsistent with the cells’ positions, never their values, and the document joins the version’s validation sample as a targeted item.
  • When the engine cannot tell which documents need review (no readable media store), it withholds every audio, video, image and PDF document of the version. A document that may be media and has no current record is withheld too.

Live corpora: new, edited and deleted documents

Section titled “Live corpora: new, edited and deleted documents”

A collection keeps changing after a version is live. Every sync of a feeding connector materializes each document it lands into the base table and every declared version, most redacted first and the original last.

Change at the source What happens to the versions
New document Landed on the next sync and materialized into every version. A live version serves it at once under the definition that was signed, without a new review. If it needs review, it is withheld until marked.
Edited document (new bytes) Detected by its checksum, read again and re-materialized into every version in place, under the same opaque id, so the earlier text is never served. A review mark bound to the old materialization stops counting, so a document that needs review is withheld again.
Unchanged document Skipped by an incremental sync. When a run re-materializes it anyway (a new version, a retry), work that depends only on the source (transcription, OCR, the model’s answers) is reused, and a version record that would not change is not rewritten, so its review mark keeps counting.
Document deleted at the source Removed from the base table and every version table at the next load, after the removal is recorded on the audit trail. See below.

If any write of a document fails, the document is removed from every materialization, base first, rather than leaving an older, less-redacted generation readable. A detector that fails on a chunk keeps that chunk out of the version, and the document is retried on the next sync.

The extract stage compares what the source lists with what the collection holds and writes a deletion marker for what is gone:

  • File stores (S3-compatible, GCS, Azure Blob, OneDrive, Dropbox, Google Drive, a local root): every sync lists the whole source, so a document the listing no longer names was deleted at the source.
  • Mail: the parts of a re-listed message that the run no longer produces.

The load stage then removes each marked document from the base table and every version table (retired ones too), with its redacted copies, audio, image and PDF artefacts, its ledger entry and the extraction-cache entries only it used.

  • Audit first. The removal is recorded on the audit trail before anything is removed. When the load has no audit trail configured, or the trail does not take the record, nothing is removed: the marker is kept, the run logs why, and the next load tries again. The document stays served until then. See Operations.
  • Safety cap. A listing that would remove too much removes nothing. For a file store that is an empty listing while the collection holds documents, more than 20 % of them (at least 5), or more than 1000; for mail, more than 20 % of the listed parts or more than 1000. The run does not fail; its summary reports reconciliation_refused with the count. An operator who checked the count accepts it with RECONCILE_MAX_DELETIONS=<n> in the job environment, and removes the variable once that run has finished: every run it applies to logs its value.
  • Media and links. A media ticket for a removed document answers 410 source_deleted, in a version’s scope and in a validation sample’s, also for a ticket issued before. A document link opened before the removal is refused like any other unusable link.
  • Summary. The run that removes documents already reports each version without them, so the version’s summary counts what its table holds after that load. A document landed again is counted again.

The run lists the removed documents by keyed digest only. A version’s validation sample reacts to the same changes: a sample document whose text changed is processed again and the decisions given on it turn stale, and a sample that holds a removed document records the removal (see Validation).

Speech-to-text, OCR and the reading of a video’s frames do not depend on the versions, so the runner keeps what each extractor read in an extraction cache next to the originals, keyed by the SHA-256 of the source bytes and the extractor’s identity. A renamed document reuses its reading; new bytes or another extractor read it again; a corrupt entry is never trusted. Entries no document uses are collected after a grace period, and a deleted document’s entries go with it. Outputs are identical with and without the cache.