refactor(domain): Typed StrategyConfig Value Object - Phase 2 - #62
Merged
Merged
Conversation
… registry StrategyConfig is now a sealed record with ValidatedFor and RawJson. Flag enforces config/strategy type consistency at construction and mutation — mismatches throw FlagDomainException. IStrategyConfigValidator registry mirrors the IRolloutStrategy dispatch pattern. Adding a new strategy requires: implement IRolloutStrategy, implement IStrategyConfigValidator, register both in DI.
ValueConverter<StrategyConfig, string> handles persistence without schema changes. Flag uses a backing field with lazy reconciliation to set ValidatedFor from StrategyType after EF Core materialization. DatabaseSeeder uses the trusted internal constructor.
43 new tests: StrategyConfig construction and equality (5), Flag guard clause mismatch rejection (3), PercentageConfigValidator (12), RoleBasedConfigValidator (9), NoneConfigValidator (7), StrategyConfigFactory dispatch (7). All existing tests updated for typed StrategyConfig signatures. 158/158 passing.
…workflow /implement: Step 0 creates an isolated git worktree for all implementation work. Worktree cleanup instructions added to HITL gate. /git-workflow: rewritten to produce a single self-destructing bash script instead of copy-paste command blocks. All skills: docs/ references corrected to Docs/ to match repo structure.
Spec: Docs/Decisions/refactor-typed-strategy-config/spec.md
…ll test data Replace 11 var usages with explicit StrategyConfig type to comply with .editorconfig csharp_style_var_elsewhere=false (IDE0008). Fix two integration tests passing null for StrategyConfig in Flag constructors, which caused NullReferenceException on the ValidatedFor guard clause. 212/212 tests passing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…w-up Record integration test fix, IDE0008 var compliance, and lessons learned about auditing test files after introducing typed VOs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Flag.StrategyConfigwas converted from a rawstringto a typedStrategyConfigsealed record Value Object. TheFlagentity now enforces that config and strategy type are always consistent — aFlagwith mismatched strategy type and config shape cannot exist. AnIStrategyConfigValidatorregistry pattern validates raw JSON into typed VOs at the application boundary, and an EF Core Value Converter handles persistence without schema changes.Changes in this PR
StrategyConfigVO withValidatedFor/RawJsonandinternaltrusted constructorIStrategyConfigValidatorinterface + three implementations (None, Percentage, RoleBased)StrategyConfigFactoryregistry dispatch keyed onRolloutStrategyFlagconstructor/Update/UpdateStrategy enforce config/strategy type matchStrategyConfigConverter— no migration needed/implement,Docs/casing fix,/git-workflowscript automationSpec
Docs/Decisions/refactor-typed-strategy-config/spec.mdImplementation Notes
Docs/Decisions/refactor-typed-strategy-config/implementation-notes.mdDefinition of Done
StrategyConfigsealed record inBanderas.Domain/ValueObjects/internaltrusted constructor for EF Core and seed dataIStrategyConfigValidatorinterface inBanderas.Domain/Interfaces/Banderas.Application/Validators/StrategyConfigFactorywith registry dispatchFlag.StrategyConfigproperty type isStrategyConfigUpdate(),UpdateStrategy()flag.StrategyConfig.RawJsonFlagMappings.ToResponse()maps.RawJsonBanderasServicecalls factory beforeFlagconstruction/updateDatabaseSeederuses valid VOsFlagBuilderupdateddotnet build -p:TreatWarningsAsErrors=true— 0 warningsTesting