Repository navigation
refactor(domain): Consolidate Flag mutation methods by concern — Phase 2 - #63
Merged
Merged
Conversation
Replace SetEnabled / UpdateStrategy / Update with a single concern-named mutation Flag.Reconfigure(bool, RolloutStrategy, StrategyConfig). The two field-shaped methods had no production callers; deleting them removes a partial-mutation bug class (toggle enabled with a now-mismatched strategy left behind). The atomic Update method is renamed to Reconfigure to declare full replacement, not partial patching. UpdateName and Archive are unchanged. No public API change: IBanderasService signatures, request/response DTOs, controller routes, and HTTP status codes are byte-for-byte identical to before. Only BanderasService.UpdateFlagAsync (one line) adopts the new method name. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the archived-guard and success tests for the deleted SetEnabled and UpdateStrategy methods; rename the surviving rollout-mutation tests from Update* to Reconfigure*. Remove the redundant UpdateStrategy mismatch test in StrategyConfigTests — the rule is now exercised once on Reconfigure. FlagConcurrencyTokenTests races flagA.Reconfigure against flagB.UpdateName to demonstrate the optimistic concurrency contract unchanged. Unit test count drops from 158 to 153; integration test count is unchanged at 54. Observable coverage of the success and invariant paths is preserved on the surviving methods. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…acement Add spec and implementation notes for the Flag mutation consolidation. Update foundation docs: - architecture.md: Domain Integrity principle names Reconfigure / UpdateName / Archive as the canonical mutation surface, organized by concern rather than by field; adds a subsection ratifying EnvironmentRules.RequireValid as the canonical environment-sentinel guard, with the GET-vs-mutating-endpoint asymmetry explicitly documented. - current-state.md: marks the consolidation phase complete; updates the archived-terminal note (3 methods, not 5); refreshes the test counts (153 unit, 54 integration); adds the 2026-05-11 Lessons Learned entry on concern-named mutations. - roadmap.md: checks off the consolidation item under the Phase 2 Flag-invariants list; removes the resolved env-validation decision from Current Focus. - flag-ddd-analysis-backlog.md: checks off the consolidation item with a provenance note pointing back to this PR. Spec: Docs/Decisions/refactor-flag-mutation-consolidation/spec.md Co-Authored-By: Claude Opus 4.7 (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
Replaces the trio
Flag.SetEnabled/Flag.UpdateStrategy/Flag.Updatewith a single concern-named mutationFlag.Reconfigure(bool, RolloutStrategy, StrategyConfig). The two field-shaped methods had no production callers — deleting them removes a partial-mutation bug class (toggle enabled while leaving a now-mismatched strategy behind). The atomicUpdatemethod is renamed toReconfigureto declare full replacement, not partial patching.UpdateNameandArchiveare unchanged. Public HTTP API, DTOs, andIBanderasServicesignatures are byte-for-byte identical to before.Changes in this PR
Flag.csdeletesSetEnabledandUpdateStrategy; renamesUpdate→Reconfigurewith a concern-named XML doc.BanderasService.UpdateFlagAsyncadopts the new method name (one line).Update*test methods toReconfigure*, remove the redundantUpdateStrategymismatch test, and update the optimistic concurrency integration test to raceReconfigureagainstUpdateName.Docs/Decisions/refactor-flag-mutation-consolidation/. Foundation docs updated:architecture.md(Domain Integrity principle + GET-query environment-validation ratification),current-state.md(phase status, archived-terminal note, test counts, 2026-05-11 Lessons Learned),roadmap.md(Phase 2 checkbox + progress sentence),flag-ddd-analysis-backlog.md(backlog item checked off).Spec
Docs/Decisions/refactor-flag-mutation-consolidation/spec.mdImplementation Notes
Docs/Decisions/refactor-flag-mutation-consolidation/implementation-notes.mdDefinition of Done
SetEnabledandUpdateStrategyremoved fromFlag.csUpdaterenamed toReconfigure; XML doc rewritten to name the concernBanderasService.UpdateFlagAsynccallsflag.Reconfigure(...)flag.SetEnabled(,flag.UpdateStrategy(, orflag.Update(— verified by grepFlagArchivedInvariantTestscoversReconfigure,UpdateName,Archive; deleted method tests removedStrategyConfigTestsreferencesReconfigureonly; redundantUpdateStrategymismatch test removedFlagConcurrencyTokenTestscontinues to demonstrate the optimistic concurrency contractdotnet build -p:TreatWarningsAsErrors=truesucceeds across all projects (0 warnings / 0 errors)dotnet csharpier check .reports no violations (104 files checked)Requests/smoke-test.httpunchanged; PUT/api/flags/{name}returns the same200 OKFlagResponseConsolidate SetEnabled() + UpdateStrategy() + Update()checked off inDocs/Decisions/flag-ddd-analysis-backlog.mdTesting
Domain unit tests (cover AC-1 through AC-5):
Expected: all archived-guard, success, and config-mismatch tests pass; no test references
SetEnabledorUpdateStrategy.Integration suite (covers AC-6 byte-for-byte API parity and AC-7 optimistic concurrency):
dotnet test Banderas.Tests.Integration/Banderas.Tests.Integration.csprojExpected: 54/54 green.
FlagConcurrencyTokenTests.ConcurrentUpdate_SecondSave_ThrowsFlagConcurrencyExceptionAsyncdemonstrates the optimistic concurrency contract viaReconfigure+UpdateName.Manual smoke (no expected change vs. baseline):
Expected:
200 OKwithFlagResponsebody, identical to the pre-refactor baseline.Static check that no caller revived a deleted method:
Expected: zero hits.