generated from eblume/project-template
v1 prep: multi-tenancy seam (resolve_owner) + hub-setup how-to #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/v1-hub-prep"
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?
The final v1.0.0 prep for the distributed/hub story — the cheap seam we agreed on (resolve the request's owner instead of a single-owner gate) plus the hub-setup how-to.
The seam (no behavior change)
Replaces
Store::authorize_owner_sub(sub) -> boolwithresolve_owner(sub) -> Option<owner_id>. The hub auth middleware now resolves the token's identity to the owner it may act as (Some→ allow,None→ 403). For the single-owner hub this is byte-for-byte the same behavior (claim-on-first; a stranger's token still 403s), but the contract no longer bakes in "one global owner" — so multi-tenancy later is additive, not a rewrite. The exact line where per-request owner scoping will wire through is marked.Why this is the right v1 move: multi-tenancy is a code concern, not a data one (every row already carries
owner_id), so deferring it carries zero data-migration risk. Full multi-tenancy (one-DB-vs-per-owner fork, provisioning, cross-tenant isolation hardening + adversarial tests) stays deferred until a 2nd user exists. Decision recorded in theAdoption + multi-tenanttask's context doc.The how-to
docs/how-to/set-up-sync-hub.md— stand up the canonical hub (indri) and connect an existing device (gilbert) as an offline-capable spoke, the data-safe way: Path A, where the hub adopts the device's identity (sameowner_id+ data) rather than rewriting the device. Covers the hub-and-spoke model, Tailscale-vs-Authentik (transport vs. identity), thehephdflags, andheph auth login.It honestly flags two enabler gaps (filed as Hephaestus tasks):
heph daemondoesn't yet bake hub/spoke flags into the generated service, and Path-A seeding is still manual (snapshot + origin reset).Testing
cargo test --all— 228 passed, 0 failed (incl. the renamed/strengthenedresolve_owner_claims_first_then_requires_match+ the existing hub-auth adversarial battery, which still 403s strangers through the new path)clippy -D warnings+fmt+prek run --all-filescleanReady to merge ahead of cutting v1.0.0.