CRITICAL story-organization-scoped-feature-flags-coordinator-006 8 pts
8
Story Points
Critical
Priority
Organization-scoped Feature Flags
Feature

User Story

As a Coordinator
I want feature flag configurations to be strictly isolated per organization so that my flag settings never affect or are visible to other organizations
So that sensitive capability decisions (e.g., enabling encrypted assignment handling or driver honorarium) remain private to my organization and cannot be inadvertently applied organization-wide

Acceptance Criteria

  • Given user A belongs to Organization A and user B belongs to Organization B, when Organization A enables a feature flag, then the flag remains disabled for Organization B unless separately configured
  • Given the feature-flag-repository executes a read query, when inspecting the generated SQL, then an organization_id filter is always present in the WHERE clause
  • Given the feature-flag-cache stores a flag value, when the cache key is inspected, then it includes both the organization_id and the flag_key
  • Given the rollout-evaluator assigns a user to an enabled cohort, when the same user switches organizations (multi-org scenario), then their cohort assignment is re-evaluated independently for the new organization context
  • Given Supabase RLS policies are in place, when a request is made without a valid organization context, then the query returns zero rows and no flag data is exposed
  • Given a system with two organizations, when Organization A's administrator views the feature flag admin screen, then no flags or audit entries from Organization B are returned from the repository

Business Value

Data isolation is a non-negotiable requirement for a multi-tenant platform serving NHF, Blindeforbundet, and HLF simultaneously. A breach of isolation — even unintentional — where HLF's feature configuration affects NHF's users would violate trust, potentially expose sensitive capability states, and undermine the entire multi-organization product strategy. RLS-enforced isolation is the architectural foundation of the platform's commercial viability.