feat(node-type-registry): sync the CheckOwnedRelation node type from constructive-db - #1770
Merged
Merged
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings the published registry up to date with
CheckOwnedRelation, shipped in constructive-io/constructive-db#3270, so blueprint authors get the type.constructive-db's private registry must stay a superset of this one, and its blueprint types are generated from these definitions — without this entry{ $type: 'CheckOwnedRelation', data: … }is a type error against the published package.CheckOwnedRelationdeclares that typed pointer columns may only reference rows owned by the same scope owner as the referencing row, proven through a link table carrying(owner_scope, owner_key)— typically a catalog projection that must never be referenced structurally, so no FK can express the constraint. It is also the write-path complement to RLS, which scopes what a caller may see and write but cannot stop a legitimately-scoped writer from pointing at a row in another scope.Two things worth knowing beyond the diff:
It redefines the
Check*prefix. The other fourCheck*nodes compile to a tableCHECKconstraint; this one emits aBEFORE INSERT OR UPDATEtrigger, because aCHECKcannot read another table.Check*now means "validation", not "CHECK constraint".arityis what makes it cover every relation shape. The guard lives on whichever table carries the pointer, sobelongs_to/has_one/has_manyare the row being written andhas_and_belongs_to_manyis the junction row:arityexactly_one(default)allanyDefinition copied verbatim from
constructive-db'spackages/node-type-registry/src/data/check-owned-relation.ts;blueprint-types.generated.tsis regenerated withpnpm generate:types(99 node types), addingCheckOwnedRelationParamsand theCheckOwnedRelationarms ofBlueprintNodeShorthand/BlueprintNodeObject. No generator behavior lives in this repo — the SQL is emitted bymetaschema_generators.check_owned_relationinconstructive-db.Link to Devin session: https://app.devin.ai/sessions/50d7f9c53d1c4a5ea0092cd47a90fcb7
Requested by: @pyramation