Skip to main content

sql_splitter/diagnostic/
codes.rs

1//! Canonical metadata for every built-in `GEN-*` diagnostic.
2
3use super::{DiagnosticCategory, DiagnosticDefinition, TypicalSeverity};
4
5macro_rules! define_diagnostics {
6    (
7        $(
8            $name:ident,
9            $code:literal,
10            $title:literal,
11            $category:ident,
12            $severity:ident,
13            $summary:literal;
14        )+
15    ) => {
16        $(
17            pub const $name: DiagnosticDefinition = DiagnosticDefinition {
18                code: $code,
19                title: $title,
20                category: DiagnosticCategory::$category,
21                typical_severity: TypicalSeverity::$severity,
22                summary: $summary,
23            };
24        )+
25
26        /// Every built-in diagnostic definition, in code order.
27        pub static ALL: &[&DiagnosticDefinition] = &[$(&$name),+];
28    };
29}
30
31define_diagnostics! {
32    AFFIX_MISSING_VALUE, "GEN-AFFIX-MISSING-VALUE", "Affix value is missing", Modifier, Error, "A prefix or suffix modifier does not declare the value it should add.";
33    BOOLEAN_PROBABILITY, "GEN-BOOLEAN-PROBABILITY", "Boolean probability is invalid", Generator, Error, "A boolean generator probability falls outside the supported zero-to-one range.";
34    BYTES_LENGTH_RANGE, "GEN-BYTES-LENGTH-RANGE", "Byte length range is invalid", Generator, Error, "A bytes generator has incompatible minimum and maximum lengths.";
35    CANCELLED, "GEN-CANCELLED", "Generation was cancelled", Runtime, Error, "The generation loop observed a cancellation request before it finished.";
36    CASE_INVALID_MODE, "GEN-CASE-INVALID-MODE", "Case mode is invalid", Modifier, Error, "A case modifier names a mode other than the supported lower, upper, or title transformations.";
37    CHILD_COUNT_IMPOSSIBLE, "GEN-CHILD-COUNT-IMPOSSIBLE", "Child row count is impossible", Selection, Error, "The resolved child count cannot satisfy the configured minimum fan-out for every parent.";
38    CHOICE_EMPTY, "GEN-CHOICE-EMPTY", "Choice list is empty", Generator, Error, "A choice generator has no values from which to draw.";
39    CHOICE_INVALID_VALUE, "GEN-CHOICE-INVALID-VALUE", "Choice value is incompatible", Generator, Error, "A choice value cannot be represented by the target column type.";
40    CHOICE_MISSING_VALUES, "GEN-CHOICE-MISSING-VALUES", "Choice values are missing", Generator, Error, "A choice generator omits its required values list.";
41    CLAMP_MISSING_BOUNDS, "GEN-CLAMP-MISSING-BOUNDS", "Clamp bounds are missing", Modifier, Error, "A clamp modifier supplies neither a minimum nor a maximum bound.";
42    CLAMP_RANGE, "GEN-CLAMP-RANGE", "Clamp range is invalid", Modifier, Error, "A clamp modifier's maximum is below its minimum.";
43    COLUMN_CYCLE, "GEN-COLUMN-CYCLE", "Column dependency cycle", Selection, Error, "Column and planner read/write dependencies contain a cycle that no single planner owns.";
44    COLUMN_OWNER_CONFLICT, "GEN-COLUMN-OWNER-CONFLICT", "Column has multiple owners", Selection, Error, "More than one generator or planner claims responsibility for the same output column.";
45    COLUMN_OWNER_MISSING, "GEN-COLUMN-OWNER-MISSING", "Column has no owner", Selection, Error, "A generated column has no generator, planner, or structural source that can produce its value.";
46    COMMERCE_MONEY_RANGE, "GEN-COMMERCE-MONEY-RANGE", "Money range is invalid", Generator, Error, "A commerce money generator has incompatible amount bounds.";
47    COMMERCE_MONEY_SCALE, "GEN-COMMERCE-MONEY-SCALE", "Money scale is invalid", Generator, Error, "A commerce money generator requests an unsupported decimal scale.";
48    CONSTANT_INVALID_VALUE, "GEN-CONSTANT-INVALID-VALUE", "Constant value is incompatible", Generator, Error, "A constant value cannot be represented by the target column type.";
49    CONFIG_COMPLETE_MODEL, "GEN-CONFIG-COMPLETE-MODEL", "Complete model overrides the profiled base", Config, Warning, "A complete model was supplied with a source dump, so the complete model is authoritative.";
50    CONFIG_IO, "GEN-CONFIG-IO", "Configuration file could not be read", Config, Error, "The root configuration or an imported configuration file could not be read.";
51    CONFIG_PARSE, "GEN-CONFIG-PARSE", "Configuration YAML is invalid", Config, Error, "A configuration document is not valid YAML or contains a duplicate mapping key.";
52    CONFIG_ROLE, "GEN-CONFIG-ROLE", "Configuration role is invalid", Config, Error, "A merged document cannot be parsed as its declared model or overrides role.";
53    COORDINATE_BOUNDS, "GEN-COORDINATE-BOUNDS", "Coordinate bounds are invalid", Planner, Error, "A coordinate planner bounding box is inverted or outside valid latitude or longitude limits.";
54    COORDINATE_COLUMN_MISSING, "GEN-COORDINATE-COLUMN-MISSING", "Coordinate column is missing", Planner, Error, "A coordinate planner role names a column that does not exist.";
55    COORDINATE_PRECISION, "GEN-COORDINATE-PRECISION", "Coordinate precision is invalid", Planner, Error, "A coordinate planner precision falls outside the supported range.";
56    COPY_MISSING_SOURCE, "GEN-COPY-MISSING-SOURCE", "Copy source is missing", Generator, Error, "A copy generator omits the sibling column it should read.";
57    COPY_TYPE_MISMATCH, "GEN-COPY-TYPE-MISMATCH", "Copy source type is incompatible", Generator, Error, "A copy generator's source value cannot populate the target column type.";
58    COPY_UNKNOWN_FIELD, "GEN-COPY-UNKNOWN-FIELD", "Copy source column is unknown", Generator, Error, "A copy generator names a sibling column that does not exist.";
59    COUNT_CONTROL_CONFLICT, "GEN-COUNT-CONTROL-CONFLICT", "Global count controls conflict", Selection, Error, "Mutually exclusive global row-count controls were supplied together.";
60    DECIMAL_RANGE, "GEN-DECIMAL-RANGE", "Decimal range is invalid", Generator, Error, "A decimal generator's maximum is below its minimum.";
61    DECIMAL_SCALE, "GEN-DECIMAL-SCALE", "Decimal scale is invalid", Generator, Error, "A decimal generator's scale cannot represent its configured range or target type.";
62    DETACHED_DEPENDENCY, "GEN-DETACHED-DEPENDENCY", "Dependency was detached", Selection, Warning, "A foreign key points to a table unavailable to the generation run, so its rendered constraint was omitted.";
63    DIALECT_INVALID, "GEN-DIALECT-INVALID", "SQL dialect is invalid", Config, Error, "A source or output dialect is not one of mysql, postgres, sqlite, or mssql.";
64    DUPLICATE_COLUMN, "GEN-DUPLICATE-COLUMN", "Duplicate column name", Selection, Error, "A table's schema declares the same column name more than once.";
65    EMIT_IO, "GEN-EMIT-IO", "Resolved model could not be written", Rendering, Error, "Writing the resolved model configuration failed.";
66    EMIT_SERIALIZE, "GEN-EMIT-SERIALIZE", "Resolved model could not be serialized", Rendering, Error, "The resolved model could not be encoded as YAML.";
67    EXCLUDED_DEPENDENCY, "GEN-EXCLUDED-DEPENDENCY", "Required dependency was excluded", Selection, Error, "A selected table depends on another table that filtering excluded.";
68    FAMILY_SPOOL, "GEN-FAMILY-SPOOL", "Family spool failed", Runtime, Error, "A buffered cross-table planner could not write or replay its protected temporary data.";
69    FILE_COLUMN_MISSING, "GEN-FILE-COLUMN-MISSING", "File metadata column is missing", Planner, Error, "A file metadata role names a column that does not exist.";
70    FILE_EXTENSIONS, "GEN-FILE-EXTENSIONS", "File extension list is invalid", Planner, Error, "A file metadata planner has no usable recognized extension.";
71    FILE_HASH_KIND, "GEN-FILE-HASH-KIND", "File hash kind is invalid", Planner, Error, "A file metadata planner requests an unsupported digest shape.";
72    FILE_SIZE_RANGE, "GEN-FILE-SIZE-RANGE", "File size range is invalid", Planner, Error, "A file metadata size range is negative or inverted.";
73    FOREIGN_KEY_CYCLE, "GEN-FK-CYCLE", "Nullable foreign-key cycle", Selection, Warning, "Nullable foreign keys form a cycle; the cyclic tables cannot all be ordered parent-before-child in the output.";
74    FOREIGN_KEY_UNRESOLVED, "GEN-FOREIGN-KEY-UNRESOLVED", "Foreign key value cannot be resolved", Selection, Error, "A relationship-owned foreign-key column has no usable value source.";
75    FORMAT_MISSING_TEMPLATE, "GEN-FORMAT-MISSING-TEMPLATE", "Format template is missing", Modifier, Error, "A format modifier omits its required template.";
76    GAUSSIAN_MISSING_PARAMS, "GEN-GAUSSIAN-MISSING-PARAMS", "Gaussian parameters are missing", Generator, Error, "A gaussian generator omits required distribution parameters.";
77    GAUSSIAN_NON_FINITE, "GEN-GAUSSIAN-NON-FINITE", "Gaussian parameter is not finite", Generator, Error, "A gaussian generator contains a NaN or infinite parameter.";
78    GAUSSIAN_RANGE, "GEN-GAUSSIAN-RANGE", "Gaussian range is invalid", Generator, Error, "A gaussian generator's configured bounds are incompatible.";
79    GENERATOR_TYPE, "GEN-GENERATOR-TYPE", "Generator does not support the column type", Generator, Error, "The selected generator cannot produce values for the target SQL type family.";
80    GENERATOR_UNKNOWN, "GEN-GENERATOR-UNKNOWN", "Generator kind is unknown", Generator, Error, "The model names a generator kind that is not registered.";
81    HISTOGRAM_ALL_ZERO, "GEN-HISTOGRAM-ALL-ZERO", "Histogram weights are all zero", Generator, Error, "A histogram has no bin with positive probability.";
82    HISTOGRAM_EMPTY, "GEN-HISTOGRAM-EMPTY", "Histogram is empty", Generator, Error, "A histogram generator has no bins from which to draw.";
83    HISTOGRAM_INVALID_BIN, "GEN-HISTOGRAM-INVALID-BIN", "Histogram bin is invalid", Generator, Error, "A histogram bin is malformed or cannot be represented by the target column.";
84    HISTOGRAM_MISSING_BINS, "GEN-HISTOGRAM-MISSING-BINS", "Histogram bins are missing", Generator, Error, "A histogram generator omits its required bins.";
85    HISTOGRAM_NON_FINITE, "GEN-HISTOGRAM-NON-FINITE", "Histogram value is not finite", Generator, Error, "A histogram bin contains a NaN or infinite bound or weight.";
86    HISTOGRAM_RANGE, "GEN-HISTOGRAM-RANGE", "Histogram range is invalid", Generator, Error, "A histogram bin or overall range has incompatible bounds.";
87    HISTOGRAM_UNSORTED, "GEN-HISTOGRAM-UNSORTED", "Histogram bins are unsorted", Generator, Error, "Histogram bin boundaries are not in ascending order.";
88    IMPORT_COLLISION, "GEN-IMPORT-COLLISION", "Imported settings collide", Config, Error, "Two imports define the same configuration path without an unambiguous owner.";
89    IMPORT_KIND, "GEN-IMPORT-KIND", "Imported document has the wrong kind", Config, Error, "An imported document is not an overrides document.";
90    IMPORT_NESTED, "GEN-IMPORT-NESTED", "Nested imports are not allowed", Config, Error, "An imported overrides document declares its own imports.";
91    IMPORT_REMOTE, "GEN-IMPORT-REMOTE", "Remote import is not allowed", Config, Error, "An import path is absolute or looks like a remote URL.";
92    INCOMPLETE_ROWS, "GEN-INCOMPLETE-ROWS", "Row-count override is incomplete", Config, Error, "An override changes the row-count rule kind without supplying the fields that kind needs.";
93    INFER_FAILED, "GEN-INFER-FAILED", "Model inference failed", Inference, Error, "Profiling evidence could not be converted into a complete synthetic model.";
94    INFER_PLANNER_NOMINATE, "GEN-INFER-PLANNER-NOMINATE", "Schema matches an optional planner", Inference, Info, "The schema has the columns required by a planner that inference does not enable automatically.";
95    INFER_SOURCE_DERIVED, "GEN-INFER-SOURCE-DERIVED", "Inference retained source-derived literals", Inference, Warning, "An inferred rule embeds bounded literal values observed in the source dump.";
96    INFER_TABLE_UNKNOWN, "GEN-INFER-TABLE-UNKNOWN", "Profiled table is absent from the schema", Inference, Warning, "Profiling produced evidence for a table that the inferred schema does not contain.";
97    INTEGER_RANGE, "GEN-INTEGER-RANGE", "Integer range is invalid", Generator, Error, "An integer generator's maximum is below its minimum.";
98    INTERVAL_COLUMN_MISSING, "GEN-INTERVAL-COLUMN-MISSING", "Interval column is missing", Planner, Error, "A temporal interval role names a column that does not exist.";
99    INTERVAL_DURATION, "GEN-INTERVAL-DURATION", "Interval duration is invalid", Planner, Error, "A temporal interval duration is negative, overflowing, or incompatible with inclusive ends.";
100    INTERVAL_OPEN_END, "GEN-INTERVAL-OPEN-END", "Open interval cannot represent a missing end", Planner, Error, "Open rows are possible but the configured end column is not nullable.";
101    INTERVAL_START, "GEN-INTERVAL-START", "Interval start configuration is invalid", Planner, Error, "A temporal interval start range is missing, unparsable, or inverted.";
102    INTERVAL_TIMEZONE, "GEN-INTERVAL-TIMEZONE", "Interval timezone is invalid", Planner, Error, "A temporal interval names an unknown timezone.";
103    INVALID_GLOB, "GEN-INVALID-GLOB", "Table glob is invalid", Selection, Error, "A table include or exclude pattern cannot be compiled as a glob.";
104    JSON_VALUE_INVALID, "GEN-JSON-VALUE-INVALID", "JSON value is invalid", Generator, Error, "A JSON value generator contains text that is not valid JSON.";
105    JUNCTION_COLUMN_MISSING, "GEN-JUNCTION-COLUMN-MISSING", "Junction column is missing", Planner, Error, "A junction planner role names a column that does not exist.";
106    JUNCTION_EXHAUSTED, "GEN-JUNCTION-EXHAUSTED", "Junction pair space is exhausted", Planner, Error, "The requested junction rows exceed the number of distinct left/right pairs.";
107    JUNCTION_KEY_UNSUPPORTED, "GEN-JUNCTION-KEY-UNSUPPORTED", "Junction key domain is unsupported", Planner, Error, "A junction relationship does not expose a dense key domain.";
108    JUNCTION_RELATIONSHIP, "GEN-JUNCTION-RELATIONSHIP", "Junction relationship is invalid", Planner, Error, "A junction planner omits or names an unknown left or right relationship.";
109    KEY_DOMAIN_UNSUPPORTED, "GEN-KEY-DOMAIN-UNSUPPORTED", "Relationship key domain is unsupported", Runtime, Error, "A relationship targets a parent key that cannot be enumerated as a supported dense domain.";
110    LIFECYCLE_COLUMN_MISSING, "GEN-LIFECYCLE-COLUMN-MISSING", "Lifecycle column is missing", Planner, Error, "A lifecycle planner role names a column that does not exist.";
111    LIFECYCLE_NULLABILITY, "GEN-LIFECYCLE-NULLABILITY", "Lifecycle column nullability is impossible", Planner, Error, "A timestamp can be absent in a reachable state but its target column is not nullable.";
112    LIFECYCLE_RANGE, "GEN-LIFECYCLE-RANGE", "Lifecycle start range is invalid", Planner, Error, "A lifecycle start range is missing, unparsable, or inverted.";
113    LIFECYCLE_STATES, "GEN-LIFECYCLE-STATES", "Lifecycle states are invalid", Planner, Error, "A lifecycle planner has an empty or duplicate state chain.";
114    LIFECYCLE_STATUS_VOCABULARY, "GEN-LIFECYCLE-STATUS-VOCABULARY", "Lifecycle status vocabulary is inconsistent", Planner, Error, "A lifecycle column mapping names a state outside the declared state chain.";
115    LIFECYCLE_STEP, "GEN-LIFECYCLE-STEP", "Lifecycle step is invalid", Planner, Error, "A lifecycle timestamp step is negative, overflowing, or uses an unknown unit.";
116    LIFECYCLE_WEIGHTS, "GEN-LIFECYCLE-WEIGHTS", "Lifecycle weights are invalid", Planner, Error, "Lifecycle terminal-state weights are malformed, negative, or sum to zero.";
117    LOSSY_TYPE, "GEN-LOSSY-TYPE", "Type conversion is lossy", Rendering, Warning, "Cross-dialect rendering cannot preserve a source column type exactly.";
118    MAX_ROWS_CAPPED, "GEN-MAX-ROWS-CAPPED", "Maximum row cap reduced a table", Selection, Warning, "The final maximum-row limit reduced a table's resolved row count.";
119    MISSING_COLUMN, "GEN-MISSING-COLUMN", "Override column does not exist", Config, Error, "An overrides document names a column absent from the base model.";
120    MISSING_TABLE, "GEN-MISSING-TABLE", "Override table does not exist", Config, Error, "An overrides document names a table absent from the base model.";
121    MODIFIER_TYPE, "GEN-MODIFIER-TYPE", "Modifier does not support the column type", Modifier, Error, "The selected modifier cannot transform the target SQL type family.";
122    MODIFIER_UNKNOWN, "GEN-MODIFIER-UNKNOWN", "Modifier kind is unknown", Modifier, Error, "The model names a modifier kind that is not registered.";
123    MONOTONIC_STEP, "GEN-MONOTONIC-STEP", "Monotonic step is invalid", Generator, Error, "A monotonic generator uses a zero or otherwise invalid step.";
124    NULL_ON_NON_NULLABLE, "GEN-NULL-ON-NON-NULLABLE", "Null generator targets a non-nullable column", Generator, Error, "A rule can emit null for a column whose schema forbids null values.";
125    NULL_RATE_MISSING_RATE, "GEN-NULL-RATE-MISSING-RATE", "Null-rate probability is missing", Modifier, Error, "A null-rate modifier omits its required rate.";
126    NULL_RATE_ON_NON_NULLABLE, "GEN-NULL-RATE-ON-NON-NULLABLE", "Null-rate modifier targets a non-nullable column", Modifier, Error, "A null-rate modifier can emit null for a column whose schema forbids it.";
127    NULL_RATE_RANGE, "GEN-NULL-RATE-RANGE", "Null-rate probability is invalid", Modifier, Error, "A null-rate probability falls outside the supported zero-to-one range.";
128    OBSERVED_SAMPLE_ALL_ZERO, "GEN-OBSERVED-SAMPLE-ALL-ZERO", "Observed-sample weights are all zero", Generator, Error, "An observed sample has no value with positive probability.";
129    OBSERVED_SAMPLE_EMPTY, "GEN-OBSERVED-SAMPLE-EMPTY", "Observed sample is empty", Generator, Error, "An observed-sample generator has no values from which to draw.";
130    OBSERVED_SAMPLE_INVALID_VALUE, "GEN-OBSERVED-SAMPLE-INVALID-VALUE", "Observed-sample value is incompatible", Generator, Error, "An observed sample value cannot be represented by the target column type.";
131    OBSERVED_SAMPLE_INVALID_WEIGHT, "GEN-OBSERVED-SAMPLE-INVALID-WEIGHT", "Observed-sample weight is invalid", Generator, Error, "An observed sample contains a negative, NaN, or infinite weight.";
132    OBSERVED_SAMPLE_MISSING_VALUES, "GEN-OBSERVED-SAMPLE-MISSING-VALUES", "Observed-sample values are missing", Generator, Error, "An observed-sample generator omits its required values.";
133    ORDER_FAMILY_CHILD_UNKNOWN, "GEN-ORDER-FAMILY-CHILD-UNKNOWN", "Order-family child table is unknown", Planner, Error, "An order-family planner names a child table absent from the model.";
134    ORDER_FAMILY_COLUMN_MISSING, "GEN-ORDER-FAMILY-COLUMN-MISSING", "Order-family column is missing", Planner, Error, "A required parent or child money role is absent or names an unknown column.";
135    ORDER_FAMILY_CONFIG, "GEN-ORDER-FAMILY-CONFIG", "Order-family configuration is invalid", Planner, Error, "An order-family planner omits or misconfigures a required top-level option.";
136    ORDER_FAMILY_OVERFLOW, "GEN-ORDER-FAMILY-OVERFLOW", "Order-family arithmetic overflow", Planner, Error, "Order-family minor-unit arithmetic exceeds the representable range.";
137    ORDER_FAMILY_RELATIONSHIP, "GEN-ORDER-FAMILY-RELATIONSHIP", "Order-family relationship is invalid", Planner, Error, "The named child relationship does not reference the planner's parent table.";
138    ORDER_FAMILY_SCALE, "GEN-ORDER-FAMILY-SCALE", "Order-family currency scale is inconsistent", Planner, Error, "A configured money column does not match the planner's currency scale.";
139    ORDER_FAMILY_UNKNOWN_FIELD, "GEN-ORDER-FAMILY-UNKNOWN-FIELD", "Order-family field is unknown", Planner, Error, "An order-family planner uses a removed flat field instead of the parent or child column maps.";
140    ORDER_FAMILY_ZERO_LINES, "GEN-ORDER-FAMILY-ZERO-LINES", "Order-family line count is impossible", Planner, Error, "A configured line distribution can yield zero lines where the planner requires at least one.";
141    OUTPUT_BATCH_SIZE, "GEN-OUTPUT-BATCH-SIZE", "Output batch size is invalid", Config, Error, "A model output batch size is zero or exceeds the supported allocation bound.";
142    OUTPUT_IO, "GEN-OUTPUT-IO", "Generated output could not be written", Runtime, Error, "Opening, writing, flushing, or publishing the generated SQL output failed.";
143    OPERATOR_UNKNOWN_ARGUMENT, "GEN-OPERATOR-UNKNOWN-ARGUMENT", "Operator argument is unknown", Config, Error, "A generator, modifier, or planner configuration contains a key absent from that operator's descriptor.";
144    OVERRIDES_NO_BASE, "GEN-OVERRIDES-NO-BASE", "Overrides document has no base model", Config, Error, "An overrides document was supplied without a source dump or other base model.";
145    PATTERN_MISSING_MASK, "GEN-PATTERN-MISSING-MASK", "Pattern mask is missing", Generator, Error, "A pattern generator omits the mask that describes its output.";
146    PLANNER_UNKNOWN, "GEN-PLANNER-UNKNOWN", "Planner kind is unknown", Planner, Error, "The model names a planner kind that is not registered.";
147    POLYMORPHIC_COLUMN_MISSING, "GEN-POLYMORPHIC-COLUMN-MISSING", "Polymorphic column is missing", Planner, Error, "A polymorphic planner role names a column that does not exist.";
148    POLYMORPHIC_KEY_UNSUPPORTED, "GEN-POLYMORPHIC-KEY-UNSUPPORTED", "Polymorphic key domain is unsupported", Planner, Error, "A polymorphic target does not expose a supported dense key domain.";
149    POLYMORPHIC_TARGET_UNKNOWN, "GEN-POLYMORPHIC-TARGET-UNKNOWN", "Polymorphic target is unknown", Planner, Error, "A polymorphic target table or identifier column does not exist.";
150    POLYMORPHIC_TARGETS, "GEN-POLYMORPHIC-TARGETS", "Polymorphic targets are invalid", Planner, Error, "A polymorphic planner has no usable target with rows and a valid weight.";
151    PROFILE_DECODE_SKIPPED, "GEN-PROFILE-DECODE-SKIPPED", "Some source values could not be decoded", Profiling, Warning, "The profiler counted rows whose values could not all be decoded into column evidence.";
152    PROFILE_SCHEMA_LATE, "GEN-PROFILE-SCHEMA-LATE", "Source schema arrived after data", Profiling, Warning, "The dump declared a table after more data rows than the bounded late-schema buffer could retain.";
153    PROGRESS_COLUMN_MISSING, "GEN-PROGRESS-COLUMN-MISSING", "Progress column is missing", Planner, Error, "A progress-counter role names a column that does not exist.";
154    PROGRESS_COMPLETION, "GEN-PROGRESS-COMPLETION", "Progress completion state is impossible", Planner, Error, "Configured completion timestamps or nullability cannot represent every reachable progress state.";
155    PROGRESS_OBSERVED, "GEN-PROGRESS-OBSERVED", "Observed progress lacks evidence", Planner, Error, "Observed progress was requested where no planner evidence can form the required exact partition.";
156    PROGRESS_OVERFLOW, "GEN-PROGRESS-OVERFLOW", "Progress counter can overflow", Planner, Error, "A possible total exceeds the capacity of one or more counter columns.";
157    PROGRESS_PARTITION, "GEN-PROGRESS-PARTITION", "Progress partition mode is invalid", Planner, Error, "A progress planner names an unsupported partition mode.";
158    PROGRESS_STATUS_VOCABULARY, "GEN-PROGRESS-STATUS-VOCABULARY", "Progress status vocabulary is incomplete", Planner, Error, "A reachable progress state has no status label available.";
159    PROGRESS_TOTAL, "GEN-PROGRESS-TOTAL", "Progress total range is invalid", Planner, Error, "A progress total is negative or has an inverted range.";
160    PROGRESS_WEIGHTS, "GEN-PROGRESS-WEIGHTS", "Progress weights are invalid", Planner, Error, "Progress-state weights are non-finite, negative, or sum to zero.";
161    RANDOM_STRING_INVALID_ALPHABET, "GEN-RANDOM-STRING-INVALID-ALPHABET", "Random-string alphabet is invalid", Generator, Error, "A random-string generator has an empty or unsupported alphabet.";
162    RANGED_INTEGER_RANGE, "GEN-RANGED-INTEGER-RANGE", "Ranged integer bounds are invalid", Generator, Error, "A ranged-integer generator has incompatible bounds.";
163    REGISTRY_ALIAS_DUPLICATE, "GEN-REGISTRY-ALIAS-DUPLICATE", "Registry alias is duplicated", Registry, Error, "Two registered operators claim the same alias.";
164    REGISTRY_ALIAS_SHADOWS_KIND, "GEN-REGISTRY-ALIAS-SHADOWS-KIND", "Registry alias shadows a kind", Registry, Error, "An operator alias collides with a registered canonical kind.";
165    REGISTRY_DUPLICATE, "GEN-REGISTRY-DUPLICATE", "Registry kind is duplicated", Registry, Error, "The same canonical operator kind was registered more than once.";
166    RELATIONSHIP_UNKNOWN, "GEN-RELATIONSHIP-UNKNOWN", "Relationship is unknown", Planner, Error, "A rule or planner names a relationship absent from the table schema.";
167    RELATIVE_MISSING_SOURCE, "GEN-RELATIVE-MISSING-SOURCE", "Relative source is missing", Generator, Error, "A relative generator omits the sibling column it should offset.";
168    RELATIVE_RANGE, "GEN-RELATIVE-RANGE", "Relative offset range is invalid", Generator, Error, "A relative generator has negative, inverted, or overflowing offset bounds.";
169    RELATIVE_UNKNOWN_SOURCE, "GEN-RELATIVE-UNKNOWN-SOURCE", "Relative source column is unknown", Generator, Error, "A relative generator names a sibling column that does not exist.";
170    RENDER_COPY_DEFAULT, "GEN-RENDER-COPY-DEFAULT", "PostgreSQL COPY cannot render DEFAULT", Rendering, Error, "A COPY row requests DEFAULT for a column without a database default, identity, or generated expression.";
171    RENDER_IO, "GEN-RENDER-IO", "SQL rendering failed", Rendering, Error, "The renderer could not write or format generated SQL.";
172    RENDER_WARNING, "GEN-RENDER-WARNING", "SQL renderer reported a warning", Rendering, Warning, "The renderer encountered a non-fatal condition without a more specific diagnostic code.";
173    REQUEST_OUTPUT, "GEN-REQUEST-OUTPUT", "Generation output request is invalid", Runtime, Error, "The requested output or resolved-model destination is unavailable or conflicting.";
174    REQUEST_SOURCE, "GEN-REQUEST-SOURCE", "Generation source is missing", Runtime, Error, "Neither a source dump nor a complete model configuration was supplied.";
175    ROUND_MISSING_SCALE, "GEN-ROUND-MISSING-SCALE", "Round scale is missing", Modifier, Error, "A round modifier omits the number of decimal places to retain.";
176    ROUND_SCALE_RANGE, "GEN-ROUND-SCALE-RANGE", "Round scale is invalid", Modifier, Error, "A round modifier's requested scale falls outside the supported range.";
177    ROWS_CYCLE, "GEN-ROWS-CYCLE", "Row-count dependency cycle", Selection, Error, "Parent-derived table row-count rules contain a dependency cycle.";
178    ROWS_OBSERVED_MISSING, "GEN-ROWS-OBSERVED-MISSING", "Observed row count is unavailable", Selection, Error, "An observed row-count rule has no attached profile count to resolve.";
179    SCHEMA_MISMATCH, "GEN-SCHEMA-MISMATCH", "Override schema assertion does not match", Config, Error, "An override's schema name or create statement disagrees with the base model.";
180    SEQUENCE_OUT_OF_RANGE, "GEN-SEQUENCE-OUT-OF-RANGE", "Sequence start is out of range", Generator, Error, "A sequence generator's start value does not fit the declared integer width of its column.";
181    SEQUENCE_ZERO_STEP, "GEN-SEQUENCE-ZERO-STEP", "Sequence step is zero", Generator, Error, "A sequence generator cannot advance because its configured step is zero.";
182    SLUG_MAX_LENGTH, "GEN-SLUG-MAX-LENGTH", "Slug max length is invalid", Generator, Error, "A slug generator's max_length is zero or not a positive integer.";
183    SLUG_MISSING_SOURCE, "GEN-SLUG-MISSING-SOURCE", "Slug source is missing", Generator, Error, "A slug generator omits the sibling column it should derive from.";
184    SLUG_UNKNOWN_FIELD, "GEN-SLUG-UNKNOWN-FIELD", "Slug source column is unknown", Generator, Error, "A slug generator names a sibling column that does not exist.";
185    SOFT_DELETE_COLUMN_MISSING, "GEN-SOFT-DELETE-COLUMN-MISSING", "Soft-delete column is missing", Planner, Error, "A soft-delete role names a column that does not exist.";
186    SOFT_DELETE_NULLABILITY, "GEN-SOFT-DELETE-NULLABILITY", "Soft-delete nullability is impossible", Planner, Error, "Non-deleted rows are possible but the deleted timestamp column is not nullable.";
187    SOFT_DELETE_RANGE, "GEN-SOFT-DELETE-RANGE", "Soft-delete timestamp range is invalid", Planner, Error, "A deletion timestamp range is missing, unparsable, or inverted.";
188    SOURCE_FINGERPRINT, "GEN-SOURCE-FINGERPRINT", "Source fingerprint does not match", Config, Variable, "An overrides document's source fingerprint differs from the base model under the configured policy.";
189    SOURCE_IO, "GEN-SOURCE-IO", "Source dump could not be profiled", Runtime, Error, "Reading or profiling the source SQL dump failed.";
190    SOURCE_VALUES, "GEN-SOURCE-VALUES", "Generated output replays literal values", Privacy, Advisory, "One or more rules replay literal values and should be reviewed before sharing generated output.";
191    STRING_LENGTH_RANGE, "GEN-STRING-LENGTH-RANGE", "String length range is invalid", Generator, Error, "A string generator has incompatible minimum and maximum lengths.";
192    TABLE_COUNT_CONFLICT, "GEN-TABLE-COUNT-CONFLICT", "Per-table count controls conflict", Selection, Error, "The same table matches both an absolute and a scaled row-count override.";
193    TABLE_SCALE_INVALID, "GEN-TABLE-SCALE-INVALID", "Per-table scale is invalid", Selection, Error, "A table scale is negative, non-finite, or otherwise unsupported.";
194    TEMPLATE_INVALID_PART, "GEN-TEMPLATE-INVALID-PART", "Template part is invalid", Generator, Error, "A template part is neither a supported literal nor a valid sibling-column reference.";
195    TEMPLATE_MISSING_PARTS, "GEN-TEMPLATE-MISSING-PARTS", "Template parts are missing", Generator, Error, "A template generator omits its required parts list.";
196    TEMPLATE_UNKNOWN_FIELD, "GEN-TEMPLATE-UNKNOWN-FIELD", "Template field is unknown", Generator, Error, "A template generator references a sibling column that does not exist.";
197    TENANT_COLUMN_MISSING, "GEN-TENANT-COLUMN-MISSING", "Tenant-family column is missing", Planner, Error, "A tenant-family role names a column that does not exist.";
198    TENANT_KEY_UNSUPPORTED, "GEN-TENANT-KEY-UNSUPPORTED", "Tenant-family key domain is unsupported", Planner, Error, "The parent relationship does not expose a supported dense key domain.";
199    TENANT_PARTITION, "GEN-TENANT-PARTITION", "Tenant partition is invalid", Planner, Error, "The requested tenant partition count cannot be formed from the available parent rows.";
200    TENANT_RELATIONSHIP, "GEN-TENANT-RELATIONSHIP", "Tenant-family relationship is invalid", Planner, Error, "A tenant-family planner omits or names an unknown parent relationship.";
201    TIMESTAMPS_COLUMN_MISSING, "GEN-TIMESTAMPS-COLUMN-MISSING", "Timestamp column is missing", Planner, Error, "A temporal timestamps role names a column that does not exist.";
202    TIMESTAMPS_DELAY, "GEN-TIMESTAMPS-DELAY", "Timestamp delay is invalid", Planner, Error, "A temporal delay is negative, overflowing, inverted, or uses an unknown unit.";
203    TIMESTAMPS_RANGE, "GEN-TIMESTAMPS-RANGE", "Timestamp range is invalid", Planner, Error, "A created timestamp range is missing, unparsable, or inverted.";
204    TREE_BRANCHING, "GEN-TREE-BRANCHING", "Tree branching limit is invalid", Planner, Error, "A hierarchy tree branching limit is below one.";
205    TREE_COLUMN_MISSING, "GEN-TREE-COLUMN-MISSING", "Tree parent column is missing", Planner, Error, "A hierarchy tree parent role names a column that does not exist.";
206    TREE_DEPTH, "GEN-TREE-DEPTH", "Tree depth is invalid", Planner, Error, "A hierarchy tree maximum depth is below one.";
207    TREE_REQUIRED_CYCLE, "GEN-TREE-REQUIRED-CYCLE", "Tree root cannot be represented", Planner, Error, "The self-reference column is non-nullable, so the hierarchy cannot create a root row.";
208    TREE_ROOT_RATIO, "GEN-TREE-ROOT-RATIO", "Tree root ratio is invalid", Planner, Error, "A hierarchy tree root ratio falls outside the supported zero-to-one range.";
209    TRUNCATE_MISSING_MAX_LENGTH, "GEN-TRUNCATE-MISSING-MAX-LENGTH", "Truncate length is missing", Modifier, Error, "A truncate modifier omits its required maximum length.";
210    UNIQUE_INVALID_ON_EXHAUSTION, "GEN-UNIQUE-INVALID-ON-EXHAUSTION", "Unique exhaustion policy is invalid", Modifier, Error, "A unique modifier names an unsupported behavior for exhausted retries.";
211    UNIQUE_WIDEN_UNSUPPORTED, "GEN-UNIQUE-WIDEN-UNSUPPORTED", "Unique widening is unsupported", Modifier, Error, "The target type has no safe widening strategy for unique-value exhaustion.";
212    VERIFY_FAILED, "GEN-VERIFY-FAILED", "Generated output failed verification", Verification, Error, "One or more exact verification checks failed and the destination was not published.";
213    VERIFY_IO, "GEN-VERIFY-IO", "Verification input could not be read", Verification, Error, "The verifier could not read the staged generated output.";
214    VERIFY_MODE, "GEN-VERIFY-MODE", "Verification mode is invalid", Verification, Error, "Verification was requested with an incompatible generation mode.";
215    VERIFY_NO_FILE, "GEN-VERIFY-NO-FILE", "Verification requires a file", Verification, Error, "Verification cannot audit output that has no real file destination.";
216    VERIFY_NOTCHECKED, "GEN-VERIFY-NOTCHECKED", "Some capabilities were not checked", Verification, Warning, "Verification passed, but one or more capabilities had no exact audit predicate.";
217    VERIFY_PARSE, "GEN-VERIFY-PARSE", "Generated SQL could not be parsed for verification", Verification, Error, "The verifier could not parse the staged generated SQL.";
218    VERIFY_PARTIAL_PUBLISH, "GEN-VERIFY-PARTIAL-PUBLISH", "Verified outputs were only partially published", Verification, Error, "Publishing a verified output set failed after one destination had already changed.";
219    VERIFY_STAGE, "GEN-VERIFY-STAGE", "Verification staging failed", Verification, Error, "Creating or writing protected temporary output for verification failed.";
220    WEIGHTED_CHOICE_ALL_ZERO, "GEN-WEIGHTED-CHOICE-ALL-ZERO", "Weighted-choice weights are all zero", Generator, Error, "A weighted choice has no entry with positive probability.";
221    WEIGHTED_CHOICE_EMPTY, "GEN-WEIGHTED-CHOICE-EMPTY", "Weighted choice is empty", Generator, Error, "A weighted-choice generator has no choices from which to draw.";
222    WEIGHTED_CHOICE_INVALID_ENTRY, "GEN-WEIGHTED-CHOICE-INVALID-ENTRY", "Weighted-choice entry is invalid", Generator, Error, "A weighted choice contains a malformed entry.";
223    WEIGHTED_CHOICE_INVALID_VALUE, "GEN-WEIGHTED-CHOICE-INVALID-VALUE", "Weighted-choice value is incompatible", Generator, Error, "A weighted choice value cannot be represented by the target column type.";
224    WEIGHTED_CHOICE_INVALID_WEIGHT, "GEN-WEIGHTED-CHOICE-INVALID-WEIGHT", "Weighted-choice weight is invalid", Generator, Error, "A weighted choice contains a negative, NaN, or infinite weight.";
225    WEIGHTED_CHOICE_MISSING_CHOICES, "GEN-WEIGHTED-CHOICE-MISSING-CHOICES", "Weighted choices are missing", Generator, Error, "A weighted-choice generator omits its required choices.";
226}
227
228/// Looks up canonical metadata for a built-in code.
229pub fn find(code: &str) -> Option<&'static DiagnosticDefinition> {
230    ALL.iter()
231        .copied()
232        .find(|definition| definition.code == code)
233}