Skip to content

feat!: unify grants[] and policies[] in node type registry and export config#1016

Merged
pyramation merged 1 commit intomainfrom
devin/1776687196-grants-policies-node-types
Apr 20, 2026
Merged

feat!: unify grants[] and policies[] in node type registry and export config#1016
pyramation merged 1 commit intomainfrom
devin/1776687196-grants-policies-node-types

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

Summary

Aligns the constructive plugin layer with the unified grants[] and policies[] 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

File What changed
generate-types.ts Codegen for BlueprintEntityTableProvision and BlueprintTable — replaces grant_roles/grant_privileges with unified grants[]
relation-many-to-many.ts JSON schema for RelationManyToMany node — 7 separate fields → 2 structured arrays
blueprint-types.generated.ts Regenerated from codegen
export-utils.ts secure_table_provision table config: 8 columns → fields, grants, policies
export.test.ts + snapshots Removed old column names from tests; null-array tests now use actual array columns (out_fields) instead of grants/policies (which are plain jsonb, not jsonb[])

Review & Testing Checklist for Human

  • Deployment ordering: Verify constructive-db PRs docs(spec): add Blueprint Specification v1 #929 and feat(codegen): pluggable embedding system with --auto-embed flag [CI] #924 are merged and the secure_table_provision table has the new grants jsonb / policies jsonb columns before deploying this. The export-utils.ts column list must match the live DB schema exactly.
  • BlueprintTable.grants consolidation: Previously had two fields (grant_roles: string[] + grants: unknown[]); now a single grants: { roles, privileges }[]. Confirm no plugin code is still referencing the old grant_roles property on BlueprintTable.
  • RelationManyToMany schema: Verify that consumers of this JSON schema (blueprint processors, UI editors) handle the new grants[]/policies[] shape and don't expect the old flat fields.

Notes

  • grants and policies in export-utils.ts are typed 'jsonb' (not 'jsonb[]') — this matches the DB schema where they're JSONB columns containing arrays, not PostgreSQL array-of-JSONB.
  • The csv-to-pg test changes are purely about keeping the null-array test focused on actual array-typed columns. Plain jsonb NULL → NULL is correct standard behavior.

Link to Devin session: https://app.devin.ai/sessions/18879be982854a40abe5c9b915aa4a84
Requested by: @pyramation

… 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[]).
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit 6ee3b97 into main Apr 20, 2026
51 checks passed
@pyramation pyramation deleted the devin/1776687196-grants-policies-node-types branch April 20, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant