Skip to content

feat: add RLS operation ergonomics#903

Merged
fenos merged 1 commit intomasterfrom
ferhat/operation-ergonomics
Mar 27, 2026
Merged

feat: add RLS operation ergonomics#903
fenos merged 1 commit intomasterfrom
ferhat/operation-ergonomics

Conversation

@ferhatelmas
Copy link
Copy Markdown
Member

@ferhatelmas ferhatelmas commented Mar 11, 2026

What kind of change does this PR introduce?

Feature

What is the current behavior?

Users need to write raw comparisons which can be brittle.

What is the new behavior?

A bit higher level helpers to ease writing a policy.

Additional context

@ferhatelmas ferhatelmas requested a review from a team as a code owner March 11, 2026 12:39
@ferhatelmas ferhatelmas force-pushed the ferhat/operation-ergonomics branch 2 times, most recently from 59b5086 to 19c5079 Compare March 11, 2026 16:06
@ferhatelmas ferhatelmas changed the title feat: add RLS ooperation ergonomics feat: add RLS operation ergonomics Mar 11, 2026
@ferhatelmas ferhatelmas force-pushed the ferhat/operation-ergonomics branch 2 times, most recently from 21a8e02 to 512fcd9 Compare March 17, 2026 13:21
Copilot AI review requested due to automatic review settings March 25, 2026 11:34
@ferhatelmas ferhatelmas force-pushed the ferhat/operation-ergonomics branch from 512fcd9 to efd53ad Compare March 25, 2026 11:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds higher-level PostgreSQL helpers for operation-aware RLS policies (based on the storage.operation GUC) and wires legacy operation names into the centralized operation registry, with accompanying tests to validate matching semantics.

Changes:

  • Introduces storage.allow_only_operation(text) and storage.allow_any_operation(text[]) migration helpers to simplify RLS policy authoring.
  • Centralizes/extends route operation constants (including legacy object.*_authenticated_info) and updates getObjectInfo routes to use them.
  • Adds integration coverage in rls_tests.yaml and a new Jest test suite validating operation helper behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/test/rls_tests.yaml Adds policy + integration test cases exercising the new operation helper functions in RLS.
src/test/operation-helpers.test.ts New unit-style DB tests validating normalization and matching semantics of the helpers.
src/internal/database/migrations/types.ts Registers the new migration name/version (operation-ergonomics: 57).
src/http/routes/operations.ts Adds file header docs and introduces legacy object.*_authenticated_info operation constants.
src/http/routes/object/getObjectInfo.ts Switches route operation strings to ROUTE_OPERATIONS.* constants for consistency.
migrations/tenant/57-operation-ergonomics.sql Adds the new SQL helper functions used in ergonomic RLS policies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread migrations/tenant/57-operation-ergonomics.sql Outdated
Comment thread migrations/tenant/57-operation-ergonomics.sql Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ferhatelmas ferhatelmas force-pushed the ferhat/operation-ergonomics branch 2 times, most recently from 3a822c5 to 970a3c7 Compare March 25, 2026 20:51
Comment on lines +22 to +23
GET_AUTH_OBJECT_INFO: 'object.get_authenticated_info', // legacy
HEAD_AUTH_OBJECT_INFO: 'object.head_authenticated_info', // legacy
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fenos these are the two operations that don't follow others

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fenos fenos merged commit a69b0e6 into master Mar 27, 2026
7 checks passed
@fenos fenos deleted the ferhat/operation-ergonomics branch March 27, 2026 13:04
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.

3 participants