Repository navigation
test(invariant): pre-register HR Stage 5B tables in RLS matrix - #4461
Conversation
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
de0f232 to
320e85e
Compare
Security review (HRM PO)Independent protected-path security review completed by fresh-context flagship reviewer (
|
|
PO acceptance: merge at 320e85e Verified clean rebased head |
Refs #4448
Step 0 of 2 invariant preparation PR for HR Stage 5B (#4448).
Summary
Pre-registers the three upcoming Stage 5B tenant tables in
apps/kernel/test/invariant/rls-matrix.db.test.ts(PENDING_TABLES,MEMBER_VY_READS,AUTHOR_ONLY, andROW_FACTORIES) so CI'sInvariant suite (from base)accepts the Step 1 feature migration PR once this lands onmain:crove_hr.onboarding_submissioncrove_hr.overtime_requestcrove_hr.probation_reviewPENDING_TABLESentries will be removed in Step 1 (or immediately after Step 1 lands) alongside the actual SQL migrations.Acceptance
apps/kernel/test/invariant/rls-matrix.db.test.tsis modified (+46 lines). No runtime code, schema, or production behavior changes.pnpm --filter @ludy/kernel-server typecheck: exited 0 cleanly after final edit.CROVE_TEST_ADMIN_URL=... pnpm test:db apps/kernel/test/invariant/rls-matrix.db.test.ts: 1589/1589 passed in this branch, and also verified 1610/1610 passed locally against the draft Stage 5B migration before extracting Step 0.research): PASS (0 blocking findings; 1 operational note to rebase ontoorigin/mainbefore merge and removePENDING_TABLESentries in Step 1).codex review -c model_reasoning_effort=high --base origin/main: skipped due to Codex usage quota exhaustion (resets Nov 25th, 2026); HRM PO independent security review applies per protected-path rules.PENDING_TABLES,MEMBER_VY_READS,AUTHOR_ONLY, andROW_FACTORIES;RowFactoryshapes satisfyRecord<string, string | number>and planned PostgreSQL CHECK/trigger guards.AUTHOR_ONLY = 'false'(system context blocked) andMEMBER_VY_READS = () => 'false'(agent context blocked), matchingcrove_hr.leave_requestandis for owners and admins onlyfor unlinked members and viewers.org_idviapayroll_employeesetup rows for cross-org andle_scopeenforcement.overtime_request.hoursuses decimal string'2').main(tables stay skipped viaPENDING_TABLESuntil Step 1 merges). Protected path (apps/kernel/test/invariant/rls-matrix.db.test.ts) awaits HRM PO independent security review and acceptance.📌 TL;DR
This PR extends the Row-Level Security (RLS) invariant test matrix to cover three new HR tables (
onboarding_submission,overtime_request, andprobation_review), ensuring that access controls correctly restrict visibility to authorized roles (owners, admins, and linked employees) while blocking system and agent contexts.🎯 Type of Change
🔍 Changes Walkthrough
apps/kernel/test/invariant/rls-matrix.db.test.tsPENDING_TABLESset, indicating they are now subject to RLS verification.2. Access Control Maps:
- Added entries to
MEMBER_VY_READSto verify that member-level views returnfalse(no access) for these HR tables.- Added entries to
AUTHOR_ONLYto enforce that only owners/admins have read access (returningfalsefor other roles).3. Row Factories: Implemented
ROW_FACTORIESfor the new tables to generate valid test data:-
onboarding_submission: Creates a linked employee and a pending submission.-
overtime_request: Creates a linked employee and an overtime request with specific date/hour constraints.-
probation_review: Creates a linked employee and a probation review with a defined period and decision.📊 Architectural Flow
flowchart TD subgraph Test_Infrastructure A[RLS Matrix Test] --> B[Load Row Factories] B --> C{Table Type} end subgraph New_HR_Tables C -->|onboarding_submission| D[Create Employee + Submission] C -->|overtime_request| E[Create Employee + Overtime Req] C -->|probation_review| F[Create Employee + Probation Review] end subgraph Access_Verification D --> G[Verify MEMBER_VY_READS = false] E --> G F --> G G --> H[Verify AUTHOR_ONLY = false for non-owners] H --> I[Assert RLS Policies Enforced] end