feat(api): M8 7.14 — classification ladder + groups entity (CLS-02/03 + §12 amendments) #200
No reviewers
Labels
No labels
epic
phase-0
phase-1
phase-2
phase-3
phase-4
phase-5
phase-6
phase-7
phase-8
phase-9
priority/P0
priority/P1
priority/P2
type/backend
type/client
type/docs
type/ops
type/security
type/spike
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/failsulit!200
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/m8-714-groups-clearance"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
First code of M8 — Groups & Classification Lattice (#158), under the amended §3.18 (PR #199's STRIDE amendments, adopted by silence).
Scope (7.14 server slice)
classification_levels— name+rank unique per tenant, platform-provisioned at flag-enable (§12 CLS-T1 binding: no tenant edit surface; one-way enable, no disable endpoint)tenants.ClassificationEnabled(CLS-01) — default off = byte-identical behavioruser_tenants.ClearanceLevelId(CLS-02) — per-tenant personal clearance, backfilled to Internal on enablegroups+group_memberships(CLS-03) — floor FK (Restrict), unique (tenant,name) + (group,user)group_membership_auto_removed) + in-app notification;GET /membersnow carries clearanceDeliberate scope call
Share-to-group targeting moves to 7.15 — it is intrinsically tied to the lattice filter + per-principal access-time resolution (encrypted-key distribution mechanics) and has no flag-off behavior; landing the Share schema changes without consumers adds risk for zero behavior. Noted on epic #158.
TDD notes (3 EF gotchas hit and encoded as comments)
ExecuteUpdateAsyncbackfill must run after SaveChanges — the FK target (Internal row) must exist in the DBclearance < newFloorRank); clearance-downgrade is a group-side check (floorRank > newClearance) — the two directions have different predicate homesVerification
ClassificationGroupsTests(ladder + backfill, 409s, no-self-change, floor rule both directions with audit + notification assertions)GET /membersgaining an additiveclearancefieldCloses the 7.14 server portion of #158 (admin-portal UI = next slice; share-target = 7.15).
Schema: - classification_levels: per-tenant ordered ladder, name+rank unique per tenant, platform-provisioned at flag-enable (§12 CLS-T1 — no tenant edit surface) - tenants.ClassificationEnabled (CLS-01, default off = zero delta) - user_tenants.ClearanceLevelId (CLS-02: per-tenant personal clearance, NULL until enable + backfill to Internal) - groups + group_memberships (CLS-03): floor FK with Restrict, unique (tenant,name) and (group,user); membership cascade on group/user Admin surface (F-CLS4, SuperAdmin-gated; AuthzMatrix rows added): - POST /tenants/{id}/classification/enable — provisions the 4-row ladder + backfills members to Internal; one-way (no disable endpoint, §12) - GET /tenants/{id}/classification — flag + ladder - PUT /tenants/{id}/members/{uid}/clearance — CLS-E2 no-self-change (setter != target), assigned-vs-changed audit, downgrade auto-removal - groups CRUD + member add/remove/list — floor rule at add-time (classification_insufficient 400), floor raise auto-removal (§12 CLS-E3, member-side rank check), floor lowering refused - GET /tenants/{id}/members now carries clearance (F-CLS4 column) Auto-removal engine (ClassificationRules): both directions — clearance downgrade (group-side rank filter) and floor raise (member-side rank filter) — each removal audited (group_membership_auto_removed) + in-app notification. EF gotchas encoded in comments: ExecuteUpdate backfill must follow SaveChanges (FK target must exist); DB-side rank queries must run after the triggering mutation is saved (context vs DB). Share-to-group targeting is deliberately deferred to 7.15 — it is intrinsically tied to the lattice filter + per-principal resolution (encrypted-key distribution mechanics) and has no flag-off behavior. Tests: ClassificationGroupsTests (11) — ladder provisioning + backfill, double-enable 409, flag-off 409s, clearance raise/audit, self-change 403, unknown level 404, group lifecycle + dup-name + unknown floor, below-floor 400 / at-floor 200, already-in-group 409, downgrade auto-removal with audit+notification, floor-raise auto-removal + lowering refusal. Full suite 1049/0/39.