Skip to content

feat(rls): Phase 1 #11 — PolicyDecision RLS + callsite fixes#139

Merged
webdevcom01-cell merged 1 commit into
mainfrom
feat/rls-phase1-policydecision
May 24, 2026
Merged

feat(rls): Phase 1 #11 — PolicyDecision RLS + callsite fixes#139
webdevcom01-cell merged 1 commit into
mainfrom
feat/rls-phase1-policydecision

Conversation

@webdevcom01-cell
Copy link
Copy Markdown
Owner

Summary

  • Migration 20260605000000_rls_phase1_policydecision: ENABLE ROW LEVEL SECURITY + FORCE, 4 policies for app_user, organizationId+id composite index on PolicyDecision
  • approval-engine.ts: requestApproval findFirst+create wrapped in withOrgContext; resolveDecision + waitForDecision given organizationId param and wrapped; processTimeouts stays 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: loadDecisionwithAdminBypass (pre-auth lookup); GET findUnique + DELETE updatewithOrgContext; resolveDecision call updated with decision.organizationId
  • policies/[policyId]/route.ts: policyDecision.countwithOrgContext
  • policies/[policyId]/decisions/route.ts: findManywithOrgContext
  • pending-approvals/route.ts: agent lookup for orgId, findManywithOrgContext
  • Test updates: resolveDecision and waitForDecision call sites updated for new organizationId param positions

Runbook position

§2.3 #11 — "FK to ApprovalPolicy; apply immediately after #10" ✓

Test plan

- 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
@webdevcom01-cell webdevcom01-cell added the e2e Run E2E tests on this PR label May 24, 2026
@webdevcom01-cell webdevcom01-cell merged commit d03825c into main May 24, 2026
6 of 12 checks passed
@webdevcom01-cell webdevcom01-cell deleted the feat/rls-phase1-policydecision branch May 24, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e Run E2E tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant