tenants table: add UNIQUE constraints (jail_root_path, collection) + lifecycle tests #93
Labels
No labels
first-proof blocker
hardening
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: clawdie/colibri#93
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Context
The
tenantstable is merged to main (register_tenant+export_jsonnow includes tenants — that part is done). Two hardening items remain from review.1. UNIQUE constraints (security, not hygiene)
UNIQUE(jail_root_path)— without it, two tenants could map to the same jail root → cross-tenant.envwrites. Pairs with #91's root verification.tenant_id), collection uniqueness is already implied by thetenant_idPRIMARY KEY and a separatecollection_idcolumn becomes redundant. Only addUNIQUE(collection_id)if that column survives the #88 decision.Migration note: additive, but adding UNIQUE to an existing table fails if duplicate rows exist — dedupe first (currently only a test tenant, so low risk).
2. Tenant lifecycle tests
Add: register/get, list sorted by
tenant_id, status update, invalid status rejected (CHECK), and export-includes-tenants.Acceptance
Duplicate
jail_root_path(andcollection_idif retained) are rejected at the DB layer; tenant lifecycle is test-covered.Related: #88 (collection identifier decision), #91 (jail-root verification).
🤖 Generated with Claude Code
Closing — everything #93 asked for is already on main (verified in
schema.rs+ store tests); my earlier review was of branch6b16281before these landed and greppedlib.rsinstead ofschema.rs:jail_root_path TEXT NOT NULL UNIQUE✅collection_id TEXT NOT NULL UNIQUE✅export_jsonincludes tenants ✅test_tenant_lifecycle,test_tenant_uniqueness✅No remaining work. The
collection_idmigration nuance (can't be dropped viaCREATE TABLE IF NOT EXISTS) is captured on #88.🤖 Generated with Claude Code