feat(api): M8 7.15 slice 1 — container/file classification + upload gating (CLS-04) #203
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!203
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/m8-715-classification-core-1"
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 enforcement slice of the CLS lattice (#158, SRS §3.18 as amended by #199's §12).
What
folders.LevelId+files.LevelId— nullable FKs to the ladder; NULL while the tenant flag is off = byte-identical zero-deltacaller clearance ≥ folder level, else 403classification_insufficient(CLS-04)PATCH /api/folders/{id}/classification+/api/files/{id}/classification— owner/uploader-or-tenant-admin, auditedclassification_set/raised/lowered; container-constraint semantics (§12 CLS-E4): folder changes never cascade to stored files (test-pinned)Verification
12 new tests; full suite 1062 total, 0 failed, 40 skipped (known set). Flag-off zero-delta pinned by three assertions (create-with-level 409, plain flow unchanged + level null, reclassify 409).
Notes
CanReclassifyAsync's role check + the member-403 integration path; the happy-path-through-a-tenant-admin hit a test-infra seam (test-scope writes intermittently invisible to request scopes on the shared SQLite connection) — documented + filed as #202; production unaffected.AddContainerClassificationis additive (nullable columns + FKs + indexes); the #196 migrations CI leg exercises it on fresh PG17.Schema: folders.LevelId + files.LevelId (nullable FK to classification_levels, Restrict; indexed). Migration AddContainerClassification. NULL while the tenant flag is off — byte-identical zero-delta behavior. CLS-04 surface: - Folder creation accepts level_id (flag on: defaults Internal; capped at the creator's clearance per F-CLS1; flag off + level → 409) - BOTH upload paths gated (simple multipart + chunked CreateUploadUrl): caller clearance >= folder level, else 403 classification_insufficient - Per-file override at upload: raise-only (>= folder level) and capped at the uploader's own clearance; omitted = inherit folder level - EnableClassification backfill extended to containers/files (CLS-01 'existing data migrates to Internal') - PATCH /api/folders/{id}/classification + PATCH /api/files/{id}/ classification — owner/uploader-or-tenant-admin (CLS-07), audited classification_set/raised/lowered; CONTAINER-CONSTRAINT semantics per §12 CLS-E4: folder level changes never cascade to stored files (pinned by test); folder lowering with violating-grant auto-revoke lands with slice 3's lattice filter - Folder/file DTOs carry the level (name+rank) for the 7.16 UX ClassificationGates (Files module): ladder/clearance resolvers, upload gate, override resolution, reclassify permission. Null clearance reads as Internal (CLS-02 default). Fix ride-along: members joining a classified tenant via invitation now get the Internal clearance row (CLS-02 gap — UserTenant was created without clearance). Tests: ClassificationUploadGatingTests (12) — backfill, defaults, explicit-level audit, above-own-clearance 403, inherit, below-folder 403, override up/down/capped, flag-off zero-delta trio, no-cascade, member-403 + owner raise/lower audits. Suite 1062/0/40. Tenant-admin re-classify arm covered by CanReclassifyAsync role check + member-403 integration (test-infra seam documented in #202). AuthzMatrix rows added for both classification routes (Coverage test).