docs(data-integrity): domain integrity extends to OAS + codec types - #260
Conversation
Expand the Domain integrity section to describe how Object-Augmented Schemas and the codec system extend domain integrity beyond scalar SQL types: a codec defines a domain-specific datatype with arbitrary validation checks on encode and typed access methods on decode, and because the object write is bound to the same database transaction as its row, object-backed attributes obey the same transaction discipline (commit/rollback together) as tabular data.
Address the accuracy caveat on the codec/domain-integrity paragraph: object stores are not transactional participants, so the earlier 'row and object commit together or not at all' overstated atomicity. Reframe accurately: the codec's validation check runs at encode time (before any write), so an invalid value is rejected up front and its row is never committed; the stored object is schema-addressed and reclaimed by garbage collection when unreferenced, so a failed insert leaves at most an orphaned object, never a bad value in the table.
MilagrosMarin
left a comment
There was a problem hiding this comment.
Verified the substance: validate() runs at table.py:1369, before encode() at :1395, so "the check runs before anything is written" holds. Link targets all resolve and the #object-augmented-schemas anchor exists.
Two things:
-
The PR description still has the pre-
30eb545claim. It says "the object write is bound to the same database transaction as its row … row and object commit together or not at all" — which is what that commit was written to correct, and the file now correctly says object stores are not transactional participants. Worth updating the description so a squash-merge message doesn't carry the inaccurate version. -
[garbage collection](referential-integrity.md)points at a page that doesn't cover it.referential-integrity.mdhas no mention of garbage collection (its two "orphan" hits are about orphaned records / dangling FKs — a different concept, which makes the mislabel easier to trip over).../how-to/garbage-collection.mdlooks like the intended target. Worth noting §4 of this same file already links that page as "Referential Integrity" — text matching target — so it's just this new paragraph's label/target pairing.
|
Both items addressed: the garbage-collection link now points at |
MilagrosMarin
left a comment
There was a problem hiding this comment.
Both verified. The link now points at ../how-to/garbage-collection.md — target resolves, and you correctly left §4's existing [Referential Integrity](referential-integrity.md) alone since that pairing was already text-matching-target. Description reads accurately now, and "a failed check aborts the insert with nothing written" is exactly right given validate() precedes encode().
One micro-nit, not worth a push on its own: "validates and encodes before anything is written" — encoding is the object write, so strictly it's validate → encode (object written) → row commit. The clauses after it make the model clear, so it reads fine in context.
Re-approving.
Expands the Domain integrity section of Data Integrity to cover what was only gestured at ("custom codecs attach domain rules … as well").
The added paragraph explains that Object-Augmented Schemas + the codec system carry domain integrity beyond scalar SQL types:
enumdoes for a category) and expose typed access methods on decode.Net: domain integrity holds uniformly from
int32/enumto arbitrary structured and object-backed types, under one consistency guarantee. Links to the OAS explanation, the custom-codec how-to, and the codec API spec.