feat!: unify grants[] and policies[] in node type registry and export config#1016
Merged
pyramation merged 1 commit intomainfrom Apr 20, 2026
Merged
Conversation
… config
Replace old grant_roles/grant_privileges/policy_* fields with unified:
- grants[]: array of { roles: string[], privileges: unknown[] } objects
- policies[]: array of { $type, data, privileges, policy_role, permissive } objects
Updated files:
- generate-types.ts: BlueprintEntityTableProvision + BlueprintTable
- relation-many-to-many.ts: parameter schema for junction table
- export-utils.ts: secure_table_provision column types
- export.test.ts: test data + snapshots
Companion to constructive-db PR #929 (grants[]) and PR #924 (policies[]).
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
Aligns the constructive plugin layer with the unified
grants[]andpolicies[]DB schema introduced in constructive-db PR #929 (grants) and #924 (policies).Before: Grants and policies were spread across many separate fields:
grant_roles,grant_privileges(grants)policy_type,policy_privileges,policy_role,policy_permissive,policy_data(policies)After: Two structured arrays:
grants: { roles: string[], privileges: unknown[] }[]policies: { $type: string, data?, privileges?, policy_role?, permissive?, policy_name? }[]Files changed
generate-types.tsBlueprintEntityTableProvisionandBlueprintTable— replacesgrant_roles/grant_privilegeswith unifiedgrants[]relation-many-to-many.tsblueprint-types.generated.tsexport-utils.tssecure_table_provisiontable config: 8 columns →fields,grants,policiesexport.test.ts+ snapshotsout_fields) instead ofgrants/policies(which are plainjsonb, notjsonb[])Review & Testing Checklist for Human
secure_table_provisiontable has the newgrants jsonb/policies jsonbcolumns before deploying this. Theexport-utils.tscolumn list must match the live DB schema exactly.BlueprintTable.grantsconsolidation: Previously had two fields (grant_roles: string[]+grants: unknown[]); now a singlegrants: { roles, privileges }[]. Confirm no plugin code is still referencing the oldgrant_rolesproperty onBlueprintTable.grants[]/policies[]shape and don't expect the old flat fields.Notes
grantsandpoliciesinexport-utils.tsare typed'jsonb'(not'jsonb[]') — this matches the DB schema where they're JSONB columns containing arrays, not PostgreSQL array-of-JSONB.jsonbNULL →NULLis correct standard behavior.Link to Devin session: https://app.devin.ai/sessions/18879be982854a40abe5c9b915aa4a84
Requested by: @pyramation