Skip to content

Commit 54bc058

Browse files
authored
Merge pull request #114 from matanp/feat/srs-implementation
Feat/srs implementation
2 parents 92f6ad7 + f4dfeb2 commit 54bc058

510 files changed

Lines changed: 61801 additions & 4743 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.cursorrules‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ Senior full-stack 10x developer: balances speed, clarity, and maintainability.
5454
- **Stale closures**: For callbacks/effects, use `useRef` when a dependency has unstable identity (e.g. `toastRef.current = toast`). `useApiMutation.mutate` is now stable; no `mutateRef` needed.
5555
- **Enums**: Use `PrivilegeLevel.Admin` not `"Admin"`
5656
- **Prisma models**: Never use `(prisma as unknown as {...})` casts. Add the model to [apps/frontend/prisma/schema.prisma](apps/frontend/prisma/schema.prisma), run migrations, then use `prisma.modelName` directly. The schema is the single source of truth.
57+
- **Client-safe shared packages**: Packages imported by client components (e.g. `shared-validators`) must NOT re-export runtime code from `shared-prisma` or any package that pulls in Prisma Client. Prisma uses Node.js built-ins (`async_hooks`) and will break browser/Vercel builds. Server-only helpers (e.g. `runBoeEligibilityFlagging`) belong in `shared-prisma`; import them directly in API routes and server code.
58+
59+
## Tests
60+
61+
- Use typed matcher utilities from `__tests__/utils/testUtils.ts` instead of raw `expect.objectContaining` when asserting Prisma mock calls (e.g. `expectMembershipCreate`, `expectMembershipUpdate`). Avoids `@typescript-eslint/no-unsafe-assignment` and keeps assertions type-safe.
62+
- If no domain-specific matcher exists, add one to testUtils (e.g. `expectXCreate`) rather than using raw `expect.objectContaining`, which Jest types as `any`.
5763

5864
## File Locations
5965

@@ -78,3 +84,9 @@ Senior full-stack 10x developer: balances speed, clarity, and maintainability.
7884
## Plan Documents
7985

8086
When creating a plan document, put it in the `docs/` folder (or `AI_PLAN_DOCS/` subfolder if gitignored planning material).
87+
88+
## Authentication and privilege changes
89+
90+
Before changing or reviewing authentication, authorization, privileges, or role-gated UI, read `skills/auth-check-patterns/SKILL.md`.
91+
92+
Before adding or extending report types, read `skills/adding-reports/SKILL.md`.

‎.gitignore‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ terraform.tfstate*
99
**/dist/
1010
**/coverage/
1111
.vercel
12+
.pnpm-store/
1213

1314
**/.DS_Store
1415

@@ -18,5 +19,12 @@ terraform.tfstate*
1819

1920
AI_PLAN_DOCS/
2021

22+
# Architecture review manifests and cited-files lists (local, not for version control)
23+
.review/
24+
25+
# Local planning/review docs (not for version control)
26+
docs/ADMIN_USER_MANAGEMENT_REVIEW.md
27+
docs/AUDIT_TRAIL_PREVIOUS_SEAT_OCCUPANT.md
28+
2129
*.tsbuildinfo
2230
.test-results/

‎AGENTS.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Agent Guidance
2+
3+
Before changing or reviewing authentication, authorization, privileges, or role-gated UI, read [skills/auth-check-patterns/SKILL.md](skills/auth-check-patterns/SKILL.md).
4+
5+
Before adding or extending report types (API schema, scoped pages, grid cards, report-server handlers), read [skills/adding-reports/SKILL.md](skills/adding-reports/SKILL.md).
6+
7+
Before adding or materially changing tests, read [skills/test-type-safety/SKILL.md](skills/test-type-safety/SKILL.md).
8+
9+
Before merging API, auth, role-gated UI, report, upload, invite, committee membership, or audit-log changes, run the illegible-bug checklist:
10+
11+
- Trust boundary: every route is `withPrivilege`, `withBackendCheck`, or `withPublic`.
12+
- Negative auth: tests cover unauthenticated, insufficient privilege, and cross-user/cross-scope access.
13+
- State race: find-then-write flows use transactions, unique constraints, conditional updates, or P2002 handling.
14+
- Validation: request bodies and query params use Zod/shared validators, not TypeScript casts.
15+
- Data scope: list/file/report/PII responses prove owner, jurisdiction, or privilege scope.
16+
- Audit/state invariants: privileged mutations preserve audit and domain invariants.

‎CLAUDE.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Agent Guidance
2+
3+
Before changing or reviewing authentication, authorization, privileges, or role-gated UI, read [skills/auth-check-patterns/SKILL.md](skills/auth-check-patterns/SKILL.md).
4+
5+
Before adding or extending report types, read [skills/adding-reports/SKILL.md](skills/adding-reports/SKILL.md).

‎README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ packages/
2727
- **Local development** → [docs/LOCAL_DEVELOPMENT.md](docs/LOCAL_DEVELOPMENT.md)
2828
- **Deployment** → [DEPLOYMENT_GUIDE.md](DEPLOYMENT_GUIDE.md), [infrastructure/DEPLOYMENT_SETUP.md](infrastructure/DEPLOYMENT_SETUP.md)
2929
- **Shared Prisma** → [docs/SHARED_PRISMA_ARCHITECTURE.md](docs/SHARED_PRISMA_ARCHITECTURE.md)
30+
- **SRS implementation roadmap** → [docs/SRS/SRS_IMPLEMENTATION_ROADMAP.md](docs/SRS/SRS_IMPLEMENTATION_ROADMAP.md)
31+
- **SRS ticket index / status** → [docs/SRS/tickets/README.md](docs/SRS/tickets/README.md)
32+
33+
## Current Phase 1 Follow-Up Tickets (SRS)
34+
35+
- [1.R.1 Leader Privilege Escalation](docs/SRS/tickets/1.R.1-leader-privilege-escalation.md) (P0)
36+
- [1.R.2 requestAdd Resubmission for Non-Active Memberships](docs/SRS/tickets/1.R.2-requestAdd-resubmission-non-active.md) (P1)
37+
- [1.R.3 Replacement Flow Not Implemented in handleRequest](docs/SRS/tickets/1.R.3-replacement-flow-not-implemented.md) (P1)
38+
- [1.R.4 Bulk Import Incompatible with Phase 1 Schema](docs/SRS/tickets/1.R.4-bulk-import-phase1-incompatible.md) (P1)
39+
- [1.R.5 Source-of-Truth Split](docs/SRS/tickets/1.R.5-source-of-truth-split.md) (P1)
40+
- [1.R.6 Audit Tests Fail](docs/SRS/tickets/1.R.6-audit-tests-fail.md) (P2)
41+
- [1.R.7 Capacity + Seat Assignment Non-Atomic](docs/SRS/tickets/1.R.7-capacity-seat-assignment-non-atomic.md) (P2)
3042

3143
## Contributing
3244

‎apps/frontend/.eslintrc.cjs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const config = {
2525
"warn",
2626
{
2727
argsIgnorePattern: "^_",
28+
varsIgnorePattern: "^_",
2829
},
2930
],
3031
"@typescript-eslint/require-await": "off",
@@ -43,6 +44,9 @@ const config = {
4344
env: { jest: true },
4445
rules: {
4546
"@typescript-eslint/unbound-method": "off",
47+
"@typescript-eslint/no-unsafe-assignment": "warn",
48+
"@typescript-eslint/no-unsafe-member-access": "warn",
49+
"@typescript-eslint/non-nullable-type-assertion-style": "warn",
4650
},
4751
},
4852
{

0 commit comments

Comments
 (0)