Skip to content

Extract ihp-rowlevelsecurity package#2569

Open
mpscholten wants to merge 1 commit intomasterfrom
extract-ihp-rowlevelsecurity
Open

Extract ihp-rowlevelsecurity package#2569
mpscholten wants to merge 1 commit intomasterfrom
extract-ihp-rowlevelsecurity

Conversation

@mpscholten
Copy link
Copy Markdown
Member

Summary

  • Extract hasql-level RLS primitives into a new ihp-rowlevelsecurity package with no dependency on ihp core
  • New convenience wrappers (withRLS, withRLSPipeline, setRLSConfig) replace inline RLS branching in ModelSupport, FetchPipelined, and DataSync.RowLevelSecurity
  • ihp-datasync modules become thin wrappers that delegate to the new package and add IHP-specific ?context/currentUserOrNothing logic

New package modules

Module Contents
IHP.RowLevelSecurity.Types RowLevelSecurityContext, TableWithRLS
IHP.RowLevelSecurity.Statement setRLSConfigStatement, pipeline variants, hasRLSEnabledStatement, rlsPolicyColumnsStatement, doesRoleExistStatement
IHP.RowLevelSecurity.Session withRLS, withRLSPipeline, setRLSConfig, hasRLSEnabledSession, ensureRLSEnabledSession
IHP.RowLevelSecurity.Role ensureAuthenticatedRole, createAuthenticatedRole, grantPermissions, quoteIdentifier
IHP.RowLevelSecurity.Introspection ensureRLSEnabled, makeCachedEnsureRLSEnabled, rlsPolicyColumns, makeCachedRLSPolicyColumns

Test plan

  • All 6 new modules compile cleanly (ghci -ignore-dot-ghci)
  • ihp/IHP/ModelSupport.hs compiles
  • ihp/IHP/FetchPipelined.hs compiles
  • ihp-datasync/IHP/DataSync/RowLevelSecurity.hs compiles
  • ihp-datasync/IHP/DataSync/Role.hs compiles
  • ihp-datasync/IHP/DataSync/ControllerImpl.hs compiles
  • ihp-datasync/IHP/DataSync/Controller.hs compiles
  • ihp/IHP/AutoRefresh.hs compiles (uses withRowLevelSecurityDisabled)
  • ihp/IHP/LoginSupport/Helper/Controller.hs compiles
  • Full test suite passes: 396 examples, 0 failures

🤖 Generated with Claude Code

Move hasql-level RLS primitives (statements, sessions, role management,
introspection) into a dedicated package with no dependency on ihp core.
This makes the RLS building blocks reusable by both ihp and ihp-datasync,
and introduces convenience wrappers (withRLS, withRLSPipeline, setRLSConfig)
that simplify the existing inline RLS branching.

New modules:
- IHP.RowLevelSecurity.Types: RowLevelSecurityContext, TableWithRLS
- IHP.RowLevelSecurity.Statement: all hasql Statement values
- IHP.RowLevelSecurity.Session: withRLS, withRLSPipeline, setRLSConfig
- IHP.RowLevelSecurity.Role: ensureAuthenticatedRole, grantPermissions
- IHP.RowLevelSecurity.Introspection: ensureRLSEnabled, rlsPolicyColumns + caching

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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