Expand description
The ModelCompiler: turns a complete model plus CLI options into an
immutable GenerationPlan.
Compilation is two concerns woven together:
-
Selection —
--tables/--excludeglobs choose the tables to generate; a selected table whose required parent was excluded is aGEN-EXCLUDED-DEPENDENCYerror reporting the full dependency path. -
Exact counts — every selected table gets a single resolved integer row count. Roots resolve from their model count through the global
--scale/--rowscontrol, a per-table--table-rows/--table-scaleoverride, and finally the--max-rowscap. Relationship children derive from their final parent count times the stored fan-out mean — the global control is never applied a second time — then take their own override and cap. Fractional targets are stochastically rounded on a stable per-tableStreamId::roundingstream, so a run is reproducible. -
Ownership, types, and dependencies — every column gets exactly one owner: an explicit generator, a table planner, a declared relationship, a database default, or the database itself (identity/serial, computed, or a bare integer primary key). Two owners claiming one column is a
GEN-COLUMN-OWNER-CONFLICT; a column no rule or structural schema fact can supply is aGEN-COLUMN-OWNER-MISSING. Generators/modifiers are type-checked against their descriptor’s accepted families, and the column/planner read→write graph is scanned for cycles (GEN-COLUMN-CYCLE), except a cycle a single planner owns end-to-end.
Errors are gathered, not short-circuited: a model with a count conflict and
three excluded dependencies reports all four. Warnings (e.g. a --max-rows
cap) survive a successful compile via GenerationPlan::diagnostics.
Structs§
- Compile
Options - The CLI-supplied knobs a compile honors, mapping one-to-one onto the generation command’s count and selection flags.
- Model
Compiler - Compiles a
SyntheticModelinto aGenerationPlan. - Table
Count Override - A single per-table count override from the CLI (
--table-rowsor--table-scale).
Enums§
- Table
Count Kind - The two shapes of a per-table count override.