- Add admin endpoint
POST /api/admin/verifiers/:userId/reinstate. - Ensure suspend/reinstate transitions correctly set verifier status and are audited.
- Block suspended/deactivated verifiers from casting milestone approvals while keeping historical votes intact.
- Add tests and documentation.
-
Admin routes (
src/routes/adminVerifiers.ts)- Add
POST /api/admin/verifiers/:userId/reinstate. - Implement reinstate semantics:
- If prior status was
approved, restore toapproved. - Else restore to
pending.
- If prior status was
- Keep
POST /:userId/suspendbut ensure it is consistent with “set deactivated verifier status”.
- Add
-
Verifier service helpers (
src/services/verifiers.ts)- Add function to reinstate based on timestamps:
- If verifier has
approved_atpresent historically => restore toapproved. - Otherwise => restore to
pending.
- If verifier has
- Add audit log actions:
verifier.reinstated(orverifier.reactivatedalready exists but ensure correct action string)- Add explicit audit metadata for lifecycle reason.
- Add function to reinstate based on timestamps:
-
Block votes (
src/services/milestones.ts)- Update
validateMilestoneMultiVerifier()to reject when the verifier issuspendedordeactivated. - Ensure it checks verifier status from DB (not the in-memory test table).
- Update
-
Audit blocked approvals
- When a blocked verifier attempts an approval in the multi-verifier flow, create audit log entry (likely from service or route).
-
Tests (
tests/**)- Add test cases:
- suspended verifier cannot approve.
- reinstate allows approvals again.
- historical approvals/votes remain in milestone_approvals table.
- audit logs are written for suspend/reinstate and for blocked attempts.
- Add test cases:
-
Docs / OpenAPI
- Ensure the RBAC spec endpoint list includes the reinstate route (or update openapi generator source if present).
- Current
validateMilestoneMultiVerifier()insrc/services/milestones.tsappears to be an in-memory implementation (milestonesTable), which likely isn’t used by the DB-backed multi-verifier flow insrc/routes/milestones.ts. - DB-backed multi-verifier approvals are handled in
src/routes/milestones.tsviarecordMilestoneApproval()andgetMilestoneApprovalProgress(). - Therefore, we may need to add the blocking logic into the DB-backed approval route path as well, or ensure
validateMilestoneMultiVerifier()is actually called there.