Short answer: for a legal contract review workspace, a retrieval architecture should use a durable source-of-truth log, versioned chunks, and a freshness-aware fallback index; failure recovery returns a clearly older answer with evidence, or no answer, rather than silently mixing contract versions.

I run a one-person SaaS, so my retrieval budget is measured in revenue per hour. A legal contract review workspace cannot trade correctness for a slightly faster demo. The same design shows up in a less obvious place: aggregating logistics listings from several feeds. A stale delivery window is annoying; a stale indemnity clause can be expensive. In both systems, the hard problem is deciding what to do when one part of the retrieval path is unavailable.

Here is the choice matrix I use before writing code:

Recovery path Freshness guarantee Operational cost Best fit
Live vector index only Strong when healthy, none during outage Low at first Prototypes with disposable answers
Rebuild from source log Exact after replay completes Medium and bursty Contract systems with auditable history
Versioned primary plus read-only fallback Explicitly bounded staleness Medium User-facing review during partial failure
Keyword-only emergency search No semantic recall guarantee Low Finding a known clause or listing ID

My default is the third row, backed by the second. Keep an immutable ingest record, publish an index only after a complete batch passes validation, and retain the previous published version for reads. That lets me ship weekly without making every deploy a legal review exercise.

What should a retrieval architecture do when freshness and failure collide?

Freshness is a property of a document version, not of a database connection. Every chunk needs a source identifier, source revision, extraction timestamp, and index version. A query result should carry those fields into the answer layer. If the newest index is missing, the answer can say “indexed at 14:10 UTC” and still cite the exact text it used.

The failure mode to avoid is a partial publish. Imagine 800 pages of a master services agreement: 790 pages are from revision 12, while ten chunks still belong to revision 11 because an embedding worker timed out. Similarity search will happily return both. A filter on sourceRevision is more valuable than another reranker here.

For logistics aggregation, the equivalent mistake is joining a fresh carrier price with yesterday's capacity record. Chunk metadata prevents that cross-version join. I group records by (sourceId, revision) and only expose a revision after its expected chunk count, checksum, and metadata validation pass.

The source log is boring. That is good.

A small state machine for recoverable indexing

An index lifecycle with explicit states is easier to reason about than a collection of retry loops. received means the raw payload is durable. parsed means the text and metadata passed validation. embedded means vectors exist for every chunk. published is the only state query traffic should use. superseded remains readable for an audit window, then can be archived according to retention policy.

This TypeScript sketch keeps the write path idempotent and makes the read decision visible:

type RevisionState = "received" | "parsed" | "embedded" | "published" | "superseded"; type Revision = { sourceId: string; revision: string; state: RevisionState; chunkCount: number; checksum: string; indexedAt?: string; }; type RetrievalResult = { text: string; sourceId: string; revision: string; indexedAt: string; stale: boolean; }; function chooseRevision( published: Revision | undefined, fallback: Revision | undefined, nowMs: number, maxStaleMs: number ): Revision | undefined { if (published?.state === "published") return published; if (!fallback || fallback.state !== "superseded" || !fallback.indexedAt) return undefined; const age = nowMs - Date.parse(fallback.indexedAt); return age <= maxStaleMs ? fallback : undefined; } async function retrieve(query: string): Promise<RetrievalResult[]> { const newest = await loadRevision("contract-42", "12"); const previous = await loadRevision("contract-42", "11"); const revision = chooseRevision(newest, previous, Date.now(), 86_400_000); if (!revision) return []; const hits = await searchIndex(query, revision.revision); return hits.map((hit) => ({ ...hit, sourceId: revision.sourceId, revision: revision.revision, indexedAt: revision.indexedAt ?? "unknown", stale: revision.state === "superseded" })); } declare function loadRevision(sourceId: string, revision: string): Promise<Revision | undefined>; declare function searchIndex(query: string, revision: string): Promise<Array<{ text: string }>>; 

The example deliberately returns an empty set when the fallback exceeds its staleness budget. That is a product decision: the UI should ask for a narrower query or wait for indexing, not manufacture confidence. In a listing aggregator I might choose a longer budget for low-risk fields such as warehouse hours, while contract clauses usually deserve a shorter one.

Chunking is part of recovery. Store the chunk boundaries and a deterministic chunk ID, such as a hash of source ID, revision, page, and character offsets. Replaying a failed batch then overwrites the same IDs instead of creating duplicate evidence. Keep overlap modest and preserve headings; a clause detached from its section title is hard to review even when the embedding is perfect.

How do chunking, freshness, and failure recovery stay auditable?

Start each ingest with a manifest: source revision, expected document count, parser version, chunking policy version, and checksum. Workers consume that manifest. A supervisor can retry a single missing chunk without guessing which policy produced its neighbors.

I also write a recovery ledger. Each event records the revision, state transition, attempt number, reason category, and operator-visible timestamp. Categories should be finite: parse rejection, dependency timeout, checksum mismatch, quota delay. Free-form error strings are useful for debugging, but they are a poor basis for alerting.

Observability should answer three questions quickly: which revision is serving, how old it is, and how many queries were forced onto fallback. Track those as dimensions, not as a single “search healthy” gauge. A green process with a 30-hour-old index is not healthy for a same-day amendment.

Tests need failure fixtures, too. Keep one contract with a changed definition, one with a deleted clause, and one malformed logistics record. Assert that old chunks disappear from the published revision, that citations include revision metadata, and that a replay is idempotent. Your mileage may vary on the exact staleness window; legal counsel and retention policy should set it, not the queue latency dashboard.

Where is this pattern the wrong choice?

The catch is storage and process overhead. A tiny internal tool with ten static documents may be better served by a rebuild-on-change script and a visible maintenance banner. Versioned fallback is not suitable when regulations require every answer to use the latest signed copy and no stale read is acceptable; in that case, fail closed and route the user to the source repository.

Stick with a keyword-only index when reviewers search for exact identifiers, section numbers, or carrier listing IDs. Semantic retrieval earns its keep when wording varies, but it should not be the sole path for a known token. A hybrid query can run both paths and mark which one produced each hit.

The other runner-up is a queue-first design that delays all reads until embedding completes. It is simpler to explain, yet it turns a short dependency outage into a full product outage. I choose it only for batch workflows where an answer during the gap has no value.

No architecture removes judgment. It makes the judgment inspectable.

References