Skip to content

docs(data-integrity): domain integrity extends to OAS + codec types - #260

Merged
dimitri-yatsenko merged 3 commits into
mainfrom
docs/domain-integrity-codecs
Aug 18, 2026
Merged

docs(data-integrity): domain integrity extends to OAS + codec types#260
dimitri-yatsenko merged 3 commits into
mainfrom
docs/domain-integrity-codecs

Conversation

@dimitri-yatsenko

@dimitri-yatsenko dimitri-yatsenko commented Aug 14, 2026

Copy link
Copy Markdown
Member

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:

  • A codec defines a domain-specific datatype (a movie, a sorting result, a fitted model) whose contents live in object storage but are addressed and governed by the schema.
  • It can run arbitrary validation checks on encode (rejecting out-of-domain values, as enum does for a category) and expose typed access methods on decode.
  • Object stores are not transactional participants: the codec validates and encodes before anything is written, the row commit is the atomic act that makes an object referenced, and a failed check aborts the insert with nothing written; unreferenced objects are removed by garbage collection.

Net: domain integrity holds uniformly from int32/enum to 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.

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.
@dimitri-yatsenko dimitri-yatsenko added the documentation Improvements or additions to documentation label Aug 14, 2026
MilagrosMarin
MilagrosMarin previously approved these changes Aug 17, 2026
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
MilagrosMarin previously approved these changes Aug 18, 2026

@MilagrosMarin MilagrosMarin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. The PR description still has the pre-30eb545 claim. 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.

  2. [garbage collection](referential-integrity.md) points at a page that doesn't cover it. referential-integrity.md has 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.md looks 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.

@dimitri-yatsenko

Copy link
Copy Markdown
Member Author

Both items addressed: the garbage-collection link now points at ../how-to/garbage-collection.md (the referential-integrity mislabel is gone), and the PR description's transactional claim is rewritten to match what 30eb545 corrected in the file — object stores are not transactional participants; the row commit is the atomic act — so a squash message carries the accurate version. One-line commit; re-review requested since the push resets the approval.

@MilagrosMarin MilagrosMarin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dimitri-yatsenko
dimitri-yatsenko merged commit e8e473e into main Aug 18, 2026
2 checks passed
@dimitri-yatsenko
dimitri-yatsenko deleted the docs/domain-integrity-codecs branch August 18, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants