Skip to content

docs(data-modeling): correct view data to ID-based body + document ownership/AST validation#195

Merged
pyramation merged 3 commits into
mainfrom
feat/view-docs-id-based-ownership
Jul 22, 2026
Merged

docs(data-modeling): correct view data to ID-based body + document ownership/AST validation#195
pyramation merged 3 commits into
mainfrom
feat/view-docs-id-based-ownership

Conversation

@pyramation

@pyramation pyramation commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Two things:

1. Corrected view docs (the original point of this PR). The view docs added in #187 showed the data body keyed by name strings (data: { source_schema: 'app_public', source_table: 'owners' }). That is wrong and security-misleading: view_parser.parse requires ID-based input and would reject the name form (BAD_VIEW_EXPRESSION source_table_id).

- data: { source_schema: 'app_public', source_table: 'owners' }
+ data: { source_table_id: ownersTableId }   // field_ids optional

New references/views.md → "Referential integrity & ownership" documents why it's ID-based:

  • Ownership enforced — every referenced table id (source_table_id / primary_table_id / per-join table_id) goes through metaschema_private.assert_same_database(...)CROSS_DATABASE_REF if it's not in the view's databaseId; field_ids scoped by database_id.
  • Names derived, not trusted — physical source_schema/source_table in the generated CREATE VIEW are resolved from the id via metaschema.schema_and_table(id).
  • Query AST validatedactions_public.create_view/alter_view run the compiled query through actions_public.validate_ast_for_database(database_id, query, 'query', ...) (same path as check constraints/indexes/functions), restricting referenced schemas to the database's own + framework schemas. Covers the ViewComposite raw-query_ast escape hatch.

2. Removed all committed .zip skill packages. They were the source of the repeated, unmergeable binary conflicts on this repo. Deleted all 23 tracked *.zip archives, added a *.zip rule to .gitignore, and updated AGENTS.md / CLAUDE.md to stop instructing agents to commit them.

Docs/chore only. No SQL authored (generated-SQL behavior described in prose per the repo rule).

Ref: constructive-db #2416, epic constructive-planning#1236.

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

@pyramation pyramation self-assigned this Jul 22, 2026
@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, CI, and merge conflict monitoring

@pyramation
pyramation merged commit 5f7bb3b into main Jul 22, 2026
2 checks passed
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