# Tasks: enterprise-feature-flags ## 1. Scaffold - [x] 1.1 Create `universal/config/feature-flags/` skeleton; 100/100/100/100 coverage; istanbul. - [x] 1.2 Cross-cutting guard tests; add to CLAUDE.md/README/FOLDERS.yml. ## 2. Errors + schemas - [x] 2.1 `src/errors/feature-flags-error.ts` — `FeatureFlagsError` extends `SuaveplanError`; codes `FEATURE_FLAGS.*`. - [x] 2.2 Auto-register codes via side-effect import. - [x] 2.3 Zod schemas for `FlagDefinition`, `EvaluationContext`, `JsonFlagConfig`, `FlagEvaluationResult`. ## 3. Core types + utilities - [x] 3.1 `src/types/common.ts` — all preserved type exports. - [x] 3.2 `src/utils/hash.ts` — `hashToPercentage`, `combineKeys` (FNV-1a or xxhash32 over `combineKeys(flagKey, userKey)`). - [x] 3.3 Co-located `.md` + property tests for uniformity. ## 4. Strategies - [x] 4.1 `src/strategies/percentage-strategy/*` — `PercentageStrategy`; deterministic bucketing. - [x] 4.2 `src/strategies/user-target-strategy/*`. - [x] 4.3 `src/strategies/attribute-strategy/*` — `compareValues`, `getNestedValue`, `AttributeOperator`, `AttributeRule`. - [x] 4.4 `src/strategies/schedule-strategy/*` — time-windowed rollout. - [x] 4.5 `src/strategies/composite-strategy/*` — AND/OR over child strategies. - [x] 4.6 Co-located `.md` + unit tests each. ## 5. Providers - [x] 5.1 `src/providers/provider-interface/*` — `BaseFlagProvider` abstract class. - [x] 5.2 `src/providers/memory-provider/*` — `MemoryProvider`. - [x] 5.3 `src/providers/json-provider/*` — `JsonProvider`, `parseJsonFlags`. - [x] 5.4 Co-located `.md` + tests; provider contract test suite reused across implementations. ## 6. Core evaluator - [x] 6.1 `src/core/flag-registry/*` — `FlagRegistry`; validates definitions via Zod. - [x] 6.2 `src/core/evaluator/*` — `Evaluator`; OTel histogram + counter. - [x] 6.3 `src/core/flag-manager/*` — `FlagManager` façade. - [x] 6.4 Emits `FlagChangeEvent` via `@suaveplan/events`. ## 7. Index + exports - [x] 7.1 Barrel `src/index.ts` — re-exports only. - [x] 7.2 Subpath exports per feature module. ## 8. Docs - [x] 8.1 Root `README.md`. - [x] 8.2 Co-located `.md` per `.ts`. ## 9. Benchmarks - [x] 9.1 `src/__benchmarks__/evaluate.bench.ts` — 1 / 5 / 25 strategy chain depth. ## 10. Ship gate - [x] 10.1 Verification sequence green. - [x] 10.2 Fold spec + archive.