Skip to content

Household Foundation / D: Switch between households + tenant context #116

Description

@rudingma

Parent: #111 · Milestone: Household Foundation
Implementation order: 2 of 6

User story

A user who belongs to multiple households can switch the active one. Every query, mutation, and UI they see is scoped to the active household.

Decides

  • Active-household persistence mechanism (JWT claim / HTTP header / cookie / DB column / client state — one will be chosen)
  • Switcher UX (dropdown in shell / dedicated screen / modal) — integrates with App Shell nav on mobile and desktop
  • Cross-session persistence — does the active household survive logout/relogin?
  • Tenant-context injection — request-scoped active-household context (likely nestjs-cls, per docs/data-layer-design.md)
  • Row-level scoping pattern in household-scoped repositories — every such query filters by active household
  • Service-layer guards preventing cross-tenant access

Inherits

Shared assumptions (locked by scoping session 2026-04-22)

  • Tenant-context plumbing lives here, not in a standalone infra story.
  • D is implementation-ordered second (immediately after A) so all subsequent stories (E1, B, C, E2) are written with tenant-context-aware code from inception. No retrofit.
  • The patterns D establishes (middleware shape, repo scoping style, context-access conventions) become shared assumptions inherited by later stories.

Out of scope

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew functionality

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions