Role Set CRUD Design Preview
Purpose
This page designs what config-only role-set template CRUD would require before implementation. It is not a live admin feature and does not add storage, migration files, endpoints, assignments, or accounts.
The design target is non-personal role-set template metadata only.
Why Role-Set CRUD Is The Safest First CRUD Candidate
Role-set templates are configuration metadata. They can be designed separately from people, submissions, staff decisions, exports, and workflow activation.
This remains safer only if no resident identity, no user assignment, no submissions, and no live permissions are tied to template edits.
What Role-Set Templates Are
Configuration template
A future template may define role labels, permission mappings, blocked permissions, lifecycle status, and version metadata.
Not a user roster
A role-set template must not contain people, emails, accounts, identity values, resident profiles, or assignment records.
Not live workflow authority
Template design alone cannot approve Morning Sheet placement, finalize staff review, activate submissions, or grant access.
Future Role-Set CRUD Actions
| Future action | Status | Active? | Preview behavior |
|---|---|---|---|
| create_role_set_template | design-only | no | Planning label only. It triggers no runtime behavior and writes no data. |
| duplicate_role_set_template | design-only | no | Planning label only. It triggers no runtime behavior and writes no data. |
| edit_role_set_template_metadata | design-only | no | Planning label only. It triggers no runtime behavior and writes no data. |
| edit_role_definitions | design-only | no | Planning label only. It triggers no runtime behavior and writes no data. |
| edit_permission_mapping | design-only | no | Planning label only. It triggers no runtime behavior and writes no data. |
| archive_role_set_template | design-only | no | Planning label only. It triggers no runtime behavior and writes no data. |
| restore_archived_role_set_template | design-only | no | Planning label only. It triggers no runtime behavior and writes no data. |
| publish_role_set_template_to_pilot | design-only | no | Planning label only. It triggers no runtime behavior and writes no data. |
Planning-Only Data Model
This is metadata for a possible future config-only table. No table, migration, endpoint, or storage exists.
| Field | Purpose | Classification | Implemented? |
|---|---|---|---|
| id | Future template identifier. | configuration metadata | no |
| community_id | Future link to a community configuration record. | configuration metadata | no |
| template_name | Future display name for the role-set template. | configuration metadata | no |
| template_slug | Future stable slug for internal template references. | configuration metadata | no |
| description | Future non-sensitive description of the template. | configuration metadata | no |
| roles | Future role definitions such as resident, peer-leader, staff-reviewer, and program-admin. | configuration metadata | no |
| permissions | Future allowed permission keys for the template. | configuration metadata | no |
| blocked_permissions | Future permission keys intentionally excluded from the template. | configuration metadata | no |
| status | Future lifecycle label such as draft, archived, or pilot-published. | configuration metadata | no |
| version | Future version number for rollback and audit review. | configuration metadata | no |
| created_at | Future timestamp for template creation. | configuration metadata | no |
| updated_at | Future timestamp for template update. | configuration metadata | no |
| archived_at | Future timestamp for template archive state. | configuration metadata | no |
| created_by_actor_id | Future conceptual actor reference for audit context only. | conceptual actor reference | no |
| updated_by_actor_id | Future conceptual actor reference for audit context only. | conceptual actor reference | no |
Excluded fields: real names, emails, medical details, legal details, trauma details, attendance, participation, scoring, compliance metrics, submission content.
Validation Rules
- Every role set has at least one staff-review role before live submissions are enabled.
- Resident role cannot approve Morning Sheet placement.
- Peer-leader role cannot finalize staff review.
- Export permissions require staff/privacy approval.
- AI permissions require separate AI-use approval.
- User assignment requires identity policy approval.
- No attendance tracking permissions exist.
- No participation tracking permissions exist.
- No participation analytics permissions exist.
- No scoring/ranking/compliance permissions exist.
- Archived role sets cannot be used for new pilots.
- Published pilot role sets require rollback plan and audit logging.
Permission Boundaries
Audit And Rollback Requirements
Future audit event design
All audit events are future-only and not implemented.
Rollback model
- Previous version retained.
- Active pilot cannot be changed without new version.
- Archived templates remain recoverable only by admin policy.
- Pilot-published templates require explicit rollback plan.
- No resident/submission data should be tied to template edits in the first config-only phase.
What Remains Blocked
Recommended Implementation Sequence
| Order | Future step | Status |
|---|---|---|
| 1 | D1 schema design for config-only role-set templates | future-design-step |
| 2 | migration review | future-design-step |
| 3 | read-only runtime list endpoint | future-design-step |
| 4 | protected write endpoint design | future-design-step |
| 5 | audit logging design | future-design-step |
| 6 | rollback design | future-design-step |
| 7 | manual seed data | future-design-step |
| 8 | staff/privacy approval | future-design-step |
| 9 | small pilot with config-only templates | future-design-step |
This phase only designs the sequence. No step is implemented.
Recommended Next Phase
Phase 7.12 - Role Set Template Migration Activation Review, Planning Only
Phase 7.11 adds a manual disposable local dry-run scaffold only. Next is a planning-only activation review with no production activation, preview D1 targeting, active migrations folder change unless explicitly approved, write endpoints, CRUD UI, user assignment, identity capture, or submissions.
future-only