Skip to content

Refactor/remove isseeded from flag - #60

Merged
amodelandme merged 4 commits into
devfrom
refactor/remove-isseeded-from-flag
May 4, 2026
Merged

amodelandme merged 4 commits into
devfrom
refactor/remove-isseeded-from-flag

Conversation

@amodelandme

Copy link
Copy Markdown
Owner

Removes IsSeeded from the Flag domain entity and relocates the bookkeeping
to an EF Core shadow property on FlagConfiguration. The seeder's
"I touched it last, I'll clean it up" safety guarantee is preserved — SEED_RESET=true
still deletes only previously-seeded rows and leaves manually-created flags untouched —
but the domain layer no longer leaks an infrastructure concern.

Changes in this PR

  • refactor(domain) — remove IsSeeded property and the second constructor from Flag
  • refactor(infra) — map IsSeeded as a shadow property; rewrite DatabaseSeeder call sites; add non-destructive migration
  • test — delete obsolete FlagTests cases; rewrite seed-startup assertion via EF.Property; add SeedReset_DoesNotDeleteManuallyCreatedFlags
  • docs — Phase 2 progress in current-state.md, tick the backlog item, ship the spec

Spec

Docs/Decisions/remove-isseeded-from-flag - PR# 60/spec.md

Implementation Notes

Not authored as a separate file — the spec's Design Decisions, Technical Notes,
and Definition of Done sections together cover the implementation record. Key
deviations from spec: none. The migration was generated as expected with no
destructive Up/Down content; BanderasDbContextModelSnapshot.cs did not
require regeneration because the snapshot already represented the property in
shadow-equivalent form.

Definition of Done

  • IsSeeded property removed from Banderas.Domain/Entities/Flag.cs
  • Second Flag constructor (isSeeded overload) removed
  • FlagConfiguration configures IsSeeded as a shadow property (Property<bool>("IsSeeded"))
  • DatabaseSeeder updated at all four call sites:
    • Insert path in SeedMissingAsync
    • Insert path in ResetSeedAsync
    • Reset query (Where(f => EF.Property<bool>(f, "IsSeeded")))
    • Manual-slot conflict check (!EF.Property<bool>(f, "IsSeeded"))
    • SeedRecord.ToFlag() no longer passes isSeeded: true
  • EF migration RemoveIsSeededFromFlagEntity generated and committed; verified non-destructive
  • BanderasDbContextModelSnapshot.cs reconciled
  • FlagTests.Constructor_WithoutIsSeededParameter_DefaultsToFalse deleted
  • FlagTests.Constructor_WithIsSeededParameter_SetsSeededState deleted
  • SeedDataStartupTests IsSeeded assertion rewritten via EF.Property<bool> in the LINQ query
  • New integration test SeedReset_DoesNotDeleteManuallyCreatedFlags added and passing
  • dotnet build -p:TreatWarningsAsErrors=true clean
  • dotnet csharpier check . clean
  • All previously-passing tests still pass (165 minus 2 deleted, plus 1 new = 164)
  • Docs/current-state.md updated — Phase 2 progress reflects this change
  • Docs/Decisions/flag-ddd-analysis-backlog.md — Remove IsSeeded from Flag checkbox ticked, with PR reference

Testing

  • dotnet build -p:TreatWarningsAsErrors=true — clean
  • dotnet test against Banderas.Tests and Banderas.Tests.Integration — full suite green (164 passing)
  • dotnet csharpier check . — no formatting violations
  • SeedReset_DoesNotDeleteManuallyCreatedFlags exercises AC-4 end-to-end: a manually inserted flag survives a SEED_RESET=true cycle while seeded rows are deleted and re-inserted

@amodelandme
amodelandme merged commit dca4739 into dev May 4, 2026
9 checks passed
@amodelandme
amodelandme deleted the refactor/remove-isseeded-from-flag branch May 4, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant