feat(rls): Phase 1 #11 — PolicyDecision RLS + callsite fixes#139
Merged
Conversation
- Migration 20260605000000: enable RLS + FORCE on PolicyDecision, 4 policies for app_user, organizationId+id composite index - approval-engine: wrap requestApproval findFirst+create, resolveDecision findUnique+update, waitForDecision findUnique in withOrgContext; add organizationId param to resolveDecision and waitForDecision; processTimeouts stays unwrapped (cross-org cron, BYPASSRLS) - decisions/[decisionId]/route: loadDecision to withAdminBypass, GET findUnique and DELETE update to withOrgContext, pass organizationId to resolveDecision - policies/[policyId]/route: policyDecision.count to withOrgContext - policies/[policyId]/decisions/route: findMany to withOrgContext - pending-approvals/route: agent lookup for orgId, findMany to withOrgContext - approval-engine tests: update resolveDecision and waitForDecision call signatures to match new organizationId param positions
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
20260605000000_rls_phase1_policydecision:ENABLE ROW LEVEL SECURITY+FORCE, 4 policies forapp_user,organizationId+idcomposite index onPolicyDecisionapproval-engine.ts:requestApprovalfindFirst+create wrapped inwithOrgContext;resolveDecision+waitForDecisiongivenorganizationIdparam and wrapped;processTimeoutsstays unwrapped (cross-org cron, relies on BYPASSRLS — see tech-debt chore(deps): bump actions/upload-artifact from 4.6.2 to 7.0.0 #6)decisions/[decisionId]/route.ts:loadDecision→withAdminBypass(pre-auth lookup); GETfindUnique+ DELETEupdate→withOrgContext;resolveDecisioncall updated withdecision.organizationIdpolicies/[policyId]/route.ts:policyDecision.count→withOrgContextpolicies/[policyId]/decisions/route.ts:findMany→withOrgContextpending-approvals/route.ts: agent lookup fororgId,findMany→withOrgContextresolveDecisionandwaitForDecisioncall sites updated for neworganizationIdparam positionsRunbook position
§2.3 #11 — "FK to ApprovalPolicy; apply immediately after #10" ✓
Test plan
pnpm precheck— TypeScript ✅ vitest 4117 passed ✅ ESLint ✅processTimeoutscron path intentionally unwrapped — see tech-debt chore(deps): bump actions/upload-artifact from 4.6.2 to 7.0.0 #6 for pre-flag-flip verification