Documentation

Docs / Reference

ADR 0065 - Model kit: per-dialect facts, type families and tool-side types

Status: Accepted (delegated review, 2026-11-15)

Context

ADR 0058 gave every model column one value per fact, one claim per known fact and one verification per claim, under a group that states one dialect or none. The developer's decisions of 2026-11-15 (Revision 1 of T018g4 Diesel, T018g5 GORM and T018g6 TypeORM) need three things that shape cannot hold:

The record shape reaches the Schema API, which serves stored attributes verbatim; contract v1 attributes are open maps (docs/contract/v1.md), so the indexer contract is not changed.

Options considered

  1. Where per-dialect values live.
    • A. One column attribute by_dialect: {<dialect>: {<fact>: value}}, the flat fact null, claims in the one claims list with a dialect key (chosen: every reader of a flat fact, the web view included, sees unknown instead of one dialect's value; /sets' claim stripping, the stored verification_counts and /table's claim links keep working unchanged).
    • B. One column record per dialect (rejected: column identities and contains edges would multiply; dialect-independent facts would be repeated and could disagree).
    • C. Suffixed attributes (type@mysql) (rejected: open-ended keys every reader must parse; no place for a missing dialect).
    • D. Per-dialect groups (models/gorm/.@mysql) (rejected: one source table would appear three times; foreign keys and overlaps triple).
  2. Type family.
    • A. A separate fact type_family: {name, unknown: [modifiers]} with type and the listed modifiers null (chosen: type keeps its meaning "the full type"; a reader that knows only type sees unknown; the modifiers' null is explained by the family).
    • B. type holds the family name plus a flag (rejected: every existing reader would show the bare family as the type).
    • C. type becomes an object (rejected: changes the JSON type of an existing attribute for every front end).
  3. Autoincrement rendering.
    • A. A new claim fact autoincrement (boolean: the database generates the value), per dialect where it differs; the rendering itself (bigserial, AUTO_INCREMENT) is the type or the dialect's keyword (chosen: one meaning on every dialect).
    • B. A free text of the rendering (rejected: not comparable across dialects, no claim vocabulary).
  4. Tool-side type. A tool_type string outside ClaimFacts (chosen: never claimed, so never verified; the view labels it as the tool's) vs a claimed fact (rejected: it is not a database fact, O5).
  5. Compatibility. Every new attribute is written only when a front end sets it and the claim's dialect is omitempty (chosen: existing records and goldens stay byte-identical, no extractor version bump) vs always-present nulls (rejected: every model golden and the stored records of every index would change for no fact).

Decision

Options 1A, 2A, 3A, 4 (tool_type) and 5 (omit when unset).

Consequences

Known gaps

Review notes (delegated review, 2026-11-15)

Report a problem with this pageSource: docs/adr/0065-model-dialect-facts.md