Document Generations Schema
Generated document runs assembled from an exact document version snapshot
Dormant table — keys retargeted to Folios
Nothing writes this table. GB-152 Stage B (2026-09-03) renamed its keys to
folioKey / folioVersionKey when the legacy version tables were deleted;
generation binds to the export input pinned to one exact Folio edition in
Stage E. The description below predates that and is rewritten in Stage F.
Phase scope:
[app]. This page describes generated output runs under the unifieddocuments/documentVersionsmodel.
Purpose
- Stores generation lifecycle state.
- Captures the assembled text or output file reference.
- Anchors each generation to the exact
documentVersionssnapshot used for assembly. - Preserves enough render metadata to explain which committed content and runtime data produced the output.
Relationships
- Many generation runs can belong to one
documentsrow over time. - Each generation run points at one
documentVersionsrow throughdocumentVersionKey. - Generation reads the named
documentVersionsrow and its pinnedmoduleVersionsrows. Party facts, if any, are data on a pinneddata_poolmodule version, notpartyData/partyDataVersions. - A generation run may also record
documentKeyas a convenience pointer for listing and support workflows, butdocumentVersionKeyis the audit anchor.
Fields
Prop
Type
Example document
{
"documentGenerationId": "gen_01HV8XQZK4J9R9W3M6T4M2RGN1",
"documentKey": "doc_01HV8XQZK4J9R9W3M6T4M2R8E1",
"documentVersionKey": "docv_01HV8XQZK4J9R9W3M6T4M2RH09",
"status": "completed",
"generatedAt": "2026-04-18T14:22:00Z",
"assembledText": "I, Jane Smith, being of sound mind...",
"fileReference": "storage/docs/DOCD-00123/v1.pdf",
"renderMetadata": {
"format": "pdf",
"rendererVersion": "2026-04-18",
"moduleCount": 6,
"visibleBlockCount": 24
}
}Render Boundary
A generation run is deterministic for a given documentVersionKey:
- Read the
documentVersionsrow. - Read all
moduleVersionsrows pinned to it bymoduleVersions.documentVersionKey. - Evaluate module and block flow conditions against the runtime data in those version rows.
- Render embedded
blocks[]. - Store generated output metadata on
documentGenerations.
No generation step reads partyData, partyDataVersions, documentInstances, or moduleInstances. Historical party values are preserved because the relevant data_pool module version is pinned to the document version being generated.
Indexes
| Index | Purpose |
|---|---|
(documentGenerationId) | Business lookup and support/debugging. |
(documentKey) | List all generation runs for a document object. |
(documentVersionKey) | Audit all outputs produced from one exact snapshot. |
(status) | Find in-progress or failed generation jobs. |
Foreign Keys
documentGenerations.documentKey → documents.key(optional convenience pointer).documentGenerations.documentVersionKey → documentVersions.key(required audit anchor).
Timestamp Rule
- Use
generatedAtas the meaningful business timestamp for when a document generation run produced its output. - Convex
_creationTimealready captures when the row itself was inserted.