Expand description
Turn a neutral DumpProfile into an explicit, self-contained
SyntheticModel through a set of small, registered heuristics.
Each heuristic (see the submodules) receives the schema + evidence for one
column and proposes zero or more Candidate rules, each tagged with a
Precedence, a Confidence, a stable reason code, and — for the rare
rule that embeds literal source values — the literals it would persist.
Heuristics never mutate a model and never generate a value; they only
propose.
The resolver applies a strict precedence
order and records both the winner and every rejected alternative (without
their values) so --explain can show why a rule won. The precedence order,
highest first, is:
- explicit YAML (reserved for the overrides merge; never proposed here)
- schema constraint (identity / declared default)
- credential guard (password/token/secret columns are synthetic-only)
- relationship / planner (declared foreign keys)
- strong semantic name+shape (email, person, money, …)
- observed distribution (categorical, constant, histogram, sample)
- type fallback (a plain generator for the column’s family)
The emitted model is self-contained (audit amendment D3): observed row
counts are frozen to an integer count while keeping kind: observed,
defaults.inference is disabled, raw samples are never retained, and any
literal an explicit rule genuinely requires stays in that rule and raises a
source-derived warning — there is no “safe to store” mode.
Structs§
- Candidate
- A single proposed rule for one column: a typed generator plus the metadata the resolver needs to rank it and explain the outcome.
- Decision
- Why one column ended up with the rule it did, plus the alternatives that lost. Values are never recorded here.
- Inference
Options - Knobs controlling how a profile is turned into a model.
- Inference
Result - The output of
ModelInference::infer: an explicit, self-contained model, the per-column decisions, and any warnings raised while inferring. - Model
Inference - Infers explicit generation rules from a dump profile through the registered
heuristics. Build one with
ModelInference::standard(the built-in registry + default options) orModelInference::new. - Rejected
Candidate - One rejected alternative recorded for
--explain. Deliberately carries no values — only the shape of the losing proposal.
Enums§
- Confidence
- How sure a heuristic is about a candidate, used to order candidates that
share a
Precedenceand to label the decision for--explain. - Inference
Error - Errors from
ModelInference::infer. - Precedence
- Strict precedence class of a proposed rule. Higher classes always beat lower ones regardless of confidence; see the module docs for the full order.
Functions§
- is_
credential_ name - Whether a column name denotes credential material (any confidence). The profiler consults this — together with the column being string-shaped — to keep raw values of credential columns out of its sketches entirely, so secret material (hashes, tokens, keys) never enters profiling evidence.
- schema_
inferred_ generator - Infer one column’s generator from its schema alone — declared name and type,
with no value evidence — reusing the same schema, credential, and semantic
heuristics (and their precedence) the profiler applies at schema depth. The
distributionheuristics need value evidence and contribute nothing here. A generator is always returned: the type fallback is the guaranteed floor, so a caller relying on this never leaves a column unowned.