Expand description
THE ID DEVICE’s model — the register a #[repr(transparent)] id wrapper is equipped
with, from the sealed vocabulary’s transparency row out to the schema’s own scalar.
The ID DEVICE’s model: what #[derive(ingraph::Id)] emits for a #[repr(transparent)] tuple
wrapper — the whole register a product’s own id type used to hand-write, from one word.
#[derive(ingraph::Id)]
#[repr(transparent)]
pub struct TrackId(uuid::Uuid);§Named for the TRAIT IT ADMITS, which is the derive(Clone) convention
The word is Id because what the door hands out is Id
membership, the same way #[derive(Clone)] is named for Clone. It is deliberately NOT the
attribute spelling #[ingraph(id)]: that word is the RECORD’s, naming which FIELD of a
declaration is its address, and one word meaning two things across two devices is a vocabulary a
reader has to disambiguate by position.
§THE ROSTER IS A MEASUREMENT, and the measurement is two live registers
Everything below was hand-written — twice, independently, to the impl — by findit’s MediaId
and mediagraph’s VolumeId, each a pub struct X(uuid::Uuid). This device emits that register
and nothing beside it, so the door’s content is a census rather than a wish list:
| face | mechanism |
|---|---|
DelegatesId | the transparency assertion — key admission |
Debug, Clone, PartialEq, Eq, Hash | delegated to the inner |
Display, FromStr | delegated to the inner |
From<Inner>, From<Self> for Inner, From<Self> for String | the conversions, and the SQL comparison’s crossing |
CursorValue | delegated to the inner |
ColumnKind | one column, the default |
IdColumn<Db> | the storage seam, delegating — UNGATED, see below |
StoredAs<Db> | the seam’s word, UNGATED — see below |
Carrier<Db>, Assemble<'_, R> | the seam’s bind and read back, gated — see below |
ToGraphqlInput, ToGraphqlOutput | the identity crossing and the borrow |
ScalarWire, CompositeFilterMarker, DefaultMarker | the filter reading, over a minted <Name>Wire |
async_graphql::ScalarType | the scalar itself, wide in and strict out |
| the CASTS | from_ref, as_inner, from_slice, as_inner_slice |
§THE STORAGE SEAM, and the census that closed the road it replaced
The three storage rows delegate to the inner THROUGH
IdColumn<Db> — the framework trait that answers how
does an id wrapping me reach a column? per member, per dialect. That trait’s own note carries the
ruling, the per-member roads and the completeness audit; what belongs here is why this device
reads a trait rather than the inner directly or a word at the declaration.
What the road used to be, and why. ingraph shipped a bare [uuid::Uuid] exactly four rows —
Id membership, the filesystem segment, the column-language row and CursorValue — no
ColumnKind, no StoredAs<Db>, no Carrier<Db>, no Assemble; and sqlx’s own uuid feature
was off everywhere in the graph. A row spelled where Inner: Carrier<Db> was therefore
unsatisfiable at the one declaration this device exists for, so both live registers bound on
String and bound the CANONICAL TEXT, and this device emitted what they wrote.
The 2026-08-29 uuid knife filled every one of those rows — each backend storing a uuid in its
own native form — which removed the bound blocker and left a COVERAGE one. Measured against the
sealed set on SQLite (ingraph #452), twelve members had no ColumnKind/StoredAs/Carrier/
Assemble at all — i128, u64, u128, the six core::net address types,
smol_str::SmolStr, bson::Uuid and bson::oid::ObjectId — so re-bounding the rows on #inner
would have turned each of those from stored as text into not storable, through a VACUOUS impl
rather than a named refusal.
IdColumn<Db> is what closes both at once, and it is #452’s 呈裁 1 resolved as a seam rather
than as a word: every member of the sealed vocabulary has a row, so nothing is un-stored, and each
row names the form that member actually stores in, so a uuid inherits its native sixteen bytes.
The twelve are on the text road their Display/FromStr already gave them; the one member that
MOVED is [uuid::Uuid].
§Why the seam is a trait and not an attribute
A MACRO SEES TOKENS. type MyId = uuid::Uuid reaches this device as the word MyId, and no
front-end pass can tell what it names — the same floor inner_is_string
is documented at, where the failure mode is a legible E0119. A uuid branch decided on tokens
would fail as a SILENT DIVERGENCE IN STORED FORM instead, which is the one failure a storage
decision must not have. So per-inner dispatch has to be resolved by the type system.
An attribute at the declaration was the other candidate and is refused for three reasons rather
than one: it re-adds ceremony against the zero-ceremony ruling this door was opened under, it
restates a TYPE-LEVEL fact once per declaration where the type already knows it, and a declaration
that names the wrong road gets an E0277 naming nothing a reader can act on. An optional override
word MAY come later as sugar OVER the seam; it is not here.
§What the switch changed, stated rather than left to be discovered
A wrapper over a [uuid::Uuid] declares, binds and reads back the NATIVE form — PostgreSQL
uuid, MySQL binary(16), SQLite BLOB — where it used to spend the canonical 36-character
text. Nothing in this workspace is published, so there is no migration ceremony: a declarer
re-emits its schema on the next sync. A wrapper over any other member stores exactly what it
stored before.
StoredAs<Db> carries NO FURTHER GATE, as it did not before — the trait puts no
Db: sqlx::Database bound on itself, so there is nothing here for a family gate to guard — and
neither does the wrapper’s own IdColumn<Db> row, which is the seam read one layer out so that an
id over an id stores.
§THE ONE OBLIGATION ON WHAT IS WRAPPED: a canonical text form
The obligation SURVIVED the seam and it survived unchanged, because what asks for it was never
the storage rows alone: an id must implement Display and
FromStr. The delegating text pair spends both, the SQL crossing spends
the first, and the GraphQL scalar — wide in through the door, canonical out — spends both again,
so an inner type with neither is one this device has nothing to write the register with.
What the seam moved is which row ASKS. The storage rows used to carry Inner: Display and
Inner: FromStr because they crossed through text themselves; they now carry
Inner: IdColumn<Db>, and the text obligation rides the seam’s own text-road impls where it is a
fact about a concrete member rather than a predicate on a declaration. The refusals a declaration
gets are unchanged, which is asserted rather than assumed —
key_admission/derive/an_id_wrapper_with_no_text_form is the golden.
That is a REAL boundary and not a formality. [u8; N] is a measured member of the id vocabulary
and has neither face, so #[derive(ingraph::Id)] #[repr(transparent)] struct Sha256([u8; 32]) is
refused — at the declaration, naming the two missing faces, because the obligations ride the
rows’ own where clauses. smol_bytes::Utf8Bytes has Display and no FromStr, and is refused
for the half it is missing. A digest and a text carrier are perfectly good keys; what they are not
is text-shaped VALUES, and the road for them is the one they always had —
unsafe impl ingraph::DelegatesId, which asks for no text at all.
The obligation is stated rather than checked at the front end, deliberately. A macro sees TOKENS:
type Inner = MyAlias reaches this device as the word MyAlias, so a front-end test of does it
render would be a guess about a name. A where predicate is the compiler’s own answer, at the
declaration, naming the type and the trait.
§WHY THE IDENTITY KIT IS EMITTED AND NOT LEFT TO #[derive(…)]
DelegatesId’s safety contract has a clause a shape
check cannot close: two Selfs are equal exactly when their delegates are. The shape law
closes the other two — no second field, no tag, no width — but a hand-written PartialEq that
ignored a case would falsify the assertion this device makes on the declaration’s behalf, and
what that buys is two distinct keys resolving one stored row rather than a compile error.
So the door writes the identity kit itself, delegating, and the obligation closes STRUCTURALLY:
there is no PartialEq on this type that is not the inner’s own, because the one that exists is
emitted here and a second is E0119.
Ord and PartialOrd are NOT among them, and the absence is MEASURED rather than economical. No
id duty reads either — the stored order is the backend’s reading of the value, and the filesystem
segment is store::fs’s Render, which the delegation row routes to the inner — and
ingraph/tests/aggregate_group_newtype_probe.rs stands a deliberately Ord-refusing wrapper at a
live group-key position to prove it. A door that minted an order would be inventing one for a type
whose author refused it. Copy is absent for the opposite reason: #[derive(Copy)] beside this
word resolves against the Clone emitted here, and a Copy row bounded on the inner would refuse
every text-carried id outright.
§THE CASTS, and the door that has no invariant to break
from_ref views a &Inner as a &Self, which is sound because the type is
#[repr(transparent)] over exactly one field — the front end refuses every other shape — and
unsound the moment a wrapper carries a CONSTRUCTOR INVARIANT its inner does not. This door
declares it has none: an id is an address, the whole of its content is the value it holds, and a
type whose values are a checked subset of its inner’s belongs at
#[derive(ingraph::NewType)]’s scalar(check = "…") door, where every read is spent on the
check.
Structs§
- IdModel
- A declared ID WRAPPER, as the device reads it.