Skip to content

Commit 245e0d8

Browse files
committed
feat: replace mock agency detail flows and add schema isolation tests
1 parent f25d4f7 commit 245e0d8

7 files changed

Lines changed: 890 additions & 454 deletions

docs/plan/M01-schema-and-contract-reconciliation.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Align database schema/RPC contracts with application code expectations.
2626

2727
## Acceptance criteria
2828

29-
- [ ] Frontend no longer references non-existent schema objects.
30-
- [ ] Core RPC calls resolve at runtime.
29+
- [x] Frontend no longer references non-existent schema objects.
30+
- [x] Core RPC calls resolve at runtime.
3131
- [ ] Migration applies cleanly on a fresh database.
3232

3333
## Risks/blockers
@@ -50,3 +50,5 @@ Align database schema/RPC contracts with application code expectations.
5050
- 2026-02-11: Added follow-up migration `20260211000300_api_rate_limiting.sql` for reusable API route throttling primitives (`api_rate_limits`, `check_api_rate_limit`).
5151
- 2026-02-11: Added follow-up migration `20260211000400_agency_rls_reconciliation.sql` to align dockets/comments/legacy attachments RLS with agency membership and platform role model.
5252
- 2026-02-11: Added follow-up migration `20260211000500_security_audit_and_abuse_events.sql` to introduce immutable audit trails and abuse-event telemetry primitives.
53+
- 2026-02-11: Added automated contract test `tests/schema-contracts.test.js` validating all `.from()` and `.rpc()` references in app/edge code map to objects defined by migrations.
54+
- 2026-02-11: Attempted fresh local migration validation with `supabase db reset --local --yes`; blocked because Docker daemon is unavailable in current environment.

docs/plan/M02-auth-rbac-and-multi-tenancy.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Implement real agency membership and permission checks with tenant isolation.
1818
- [x] Update agency context to load memberships from `agency_members`.
1919
- [x] Update permissions hook to use real memberships.
2020
- [x] Ensure platform roles are loaded from `platform_roles`.
21-
- [ ] Add tests for tenant isolation assumptions.
21+
- [x] Add tests for tenant isolation assumptions.
2222

2323
## Acceptance criteria
2424

@@ -39,3 +39,4 @@ Implement real agency membership and permission checks with tenant isolation.
3939
- 2026-02-11: Replaced mocked agency context loading with real membership queries from `agency_members` joined to `agencies`.
4040
- 2026-02-11: Updated permission hook to derive role/capabilities from real membership records with legacy fallback behavior only when needed.
4141
- 2026-02-11: Updated auth context bootstrapping to load `platform_roles` during session initialization.
42+
- 2026-02-11: Added `tests/tenant-isolation-policies.test.js` to verify RLS enablement and tenant predicates exist across agency-scoped tables.

docs/plan/M03-agency-operations.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ Replace mock agency workflows with real data operations.
4141
- 2026-02-11: Replaced mock data in `src/pages/agency/DocketList.tsx` with real Supabase queries scoped to current agency membership.
4242
- 2026-02-11: Implemented real docket creation in `src/pages/agency/DocketWizard.tsx` including identity-mode, moderation/captcha settings, and best-effort supporting document persistence.
4343
- 2026-02-11: Updated moderation logic to canonical comment statuses (`under_review`/`published`) with compatibility mapping for legacy values and persisted moderation logging.
44+
- 2026-02-11: Replaced mock agency dashboard data in `src/pages/agency/AgencyDashboard.tsx` with real agency analytics, moderation queue, and docket summary queries.
45+
- 2026-02-11: Replaced mock docket detail workflow in `src/pages/agency/DocketDetail.tsx` with real Supabase reads/writes, moderation actions, supporting-document retrieval, and audit/moderation activity history.

0 commit comments

Comments
 (0)