refactor(provision): cross-relations via provisionBlueprint() (drop raw SQL)#25
Merged
pyramation merged 1 commit intomainfrom Apr 18, 2026
Merged
Conversation
🤖 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:
|
3 tasks
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
Converts
packages/provision/src/schemas/cross-relations.tsfrom rawpool.query('SELECT metaschema_modules_public.provision_relation(...)')calls into a declarativeBlueprintDefinitionthat rides the sameprovisionBlueprint()path as every other schema in this package.BlueprintRelation[]entries ($type: 'RelationManyToMany' | 'RelationBelongsTo') withsource_schema_name/target_schema_name='app_public'for disambiguation (e.g.emailsalso exists inuser_identifiers_public).pg.Poolinstantiation, schema-id lookup, per-callresolveTableId, per-relation try/catch, and a post-hocDISABLE ROW LEVEL SECURITYloop on each junction table.cross-relations.tswas the only other place in this package using raw SQL to drive provisioning, violating the "SDK / blueprint only" convention. This finishes the cleanup started in feat(provision): upgrade to latest PostGIS spatial-relation stack + 5 RelationSpatial entries + ORM tests #24 (spatial-relations).No behavioral intent change — same 21 junctions, same 7 FKs, same
delete_action/is_requiredvalues. Server-sideconstruct_blueprintdispatches toprovision_relation(...)the same way the old raw SQL did.Review & Testing Checklist for Human
provisionBlueprintbuild one blueprint record and callconstruct_blueprintonce — if any relation is a duplicate, confirmconstruct_blueprinttolerates it or that the overall run is still safe. (CIpgpm-deployprovisions a fresh DB, so it only exercises the first-run path.)provision.tsto cover them. Worth confirming the junctions land inapp_public(not some other schema) so the global sweep catches them.tables: []is accepted by the server. The old code carried a comment claiming blueprint validation "requires non-empty tables array". I believe that's stale (resolve_blueprint_tablefalls back to existing tables by name, and PR feat(provision): upgrade to latest PostGIS spatial-relation stack + 5 RelationSpatial entries + ORM tests #24's spatial-relations uses the same empty-tables pattern and passes CI). Please sanity-check the deployed@pgpm/metaschema-modulesversion matches.pgpm-deploy,orm-tests,cli-e2e-tests,embedding-*.Notes
delete_actiontypes tightened to the 5-char union ('c' | 'r' | 'n' | 'd' | 'a') thatRelationBelongsToParamsdeclares. Existing values are all'n'or'c', so no logical change.pnpm buildfailure onmain(staleref/source_ref/target_refusage in the wrapperblueprint.tsvs the publishedBlueprintDefinitiontype) is unrelated and not addressed here.source_field/target_fieldaddition onto theRelationSpatialarm ofBlueprintRelationinsidenode-type-registryso agentic-db can drop the localSpatialRelationEntrycast added in feat(provision): upgrade to latest PostGIS spatial-relation stack + 5 RelationSpatial entries + ORM tests #24. Will be a separate PR againstconstructive-io/constructive.Link to Devin session: https://app.devin.ai/sessions/c5eeee65a3c546c4ac6753bb05fa03e0
Requested by: @pyramation