Repository navigation
refactor(arch): move repositories and EF configurations into their modules - #1097
Merged
Merged
Conversation
…dules move.py move with the slice's table: the 26 repository files go to Infrastructure/Modules/<Owner>/Repositories and the 13 EF-configuration files to Infrastructure/Modules/<Owner>/Configurations, with the namespace taken from the folder. UserRoleAssignmentRepository.cs, FlockScopeGuard included, and UserRoleAssignmentConfiguration go to Access, which owns the table. The six rules files without one gain their Cluckwork.Infrastructure.Modules.<Owner> root. The current model snapshot is untouched: configurations are not entities. This commit alone fails CW1001 on 23 references the moved types now make across modules; the next commit declares them. Refs #1087
…make The one slice that changes the dependency policy (owner-approved). Moving the 39 persistence files into their modules makes their types module-owned, so the references they already made now cross owners: - 22 edge symbols join existing cells: EF configurations' foreign keys and enum mappings into other modules' entities, repositories implementing Farm's ICurrencyBoundRowSource, EggOperationsFixture's SeedDefaults, and in Access -> Farm the UserRoleAssignment store and mapping plus FlockScopeGuard, which resolves the effective role through Farm's Roles. - One new cell, FlockManagement -> EggOperations, for BirdMovementConfiguration's foreign key to DailyEntry. The FK_BirdMovements_DailyEntries_DailyEntryId reason now names it. Every Implementations list is empty: a repository reads its tables as its own module's code. CompatibilityExceptionRealTreeTests' non-vacuity check now asserts that a moved repository's read is walked as an own-module read. The coupling matrix is regenerated: one new cell and the new symbol counts. Refs #1087
…sitories docs/architecture.md names EggLotRepository by layer-relative path, which the codemod's project-relative rewrite does not match. Refs #1087
This was referenced Oct 6, 2026
Merged
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.
Refs #1087
S9 of the package-by-module design: the 26 repository files and 13 EF-configuration files move into
Infrastructure/Modules/<Owner>/{Repositories,Configurations}. This is the one slice that changes the dependency policy, and the owner approved it. The change declares 23 edge symbols and one new cell, and empties everyImplementationslist. No runtime behaviour changes. Proofs compare this head247e259bwith the base57cdbc6b(#1096).Review order
git mvs, with namespaces taken from folders.tools/module-move/move.pyrewrote references, usings, ledger strings (edge symbols,Implementations, tenant-bypassSymbol/File) and paths, then pruned unused usings.UserRoleAssignmentRepository.csgoes to Access whole,FlockScopeGuardincluded, and so doesUserRoleAssignmentConfiguration.Cluckwork.Infrastructure.Modules.<Owner>root.CW1001on exactly the 23 references the next commit declares. The analyzer's demand is what makes the policy change explicit.src/Cluckwork.Domain/Common/Architecture/Modules/*.cs, the FK reason inRealModuleLedger.Tables.cs, the regeneratedcoupling-matrix.md, and one guard line inCompatibilityExceptionRealTreeTests.EggLotRepositorypath indocs/architecture.md.The policy change
The measured count is 23 symbols (22 in existing cells) + 1 new cell. It matches Astra's design-time attribution symbol for symbol (
pbm-astra-evidence/edges-reproduction.log).ApplicationUserConfigurationEggUnitstepper-unit columnUserRoleAssignmentConfiguration,UserRoleAssignmentRepository,FlockScopeGuardUserRoleAssignment;Roles.ResolveEffective,EffectiveAccountRoleProductEggGradeMappingConfiguration,SalesOrderItemConfiguration,SalesOrderAllocationConfigurationEggGrade,EggLotPaymentRepository,ProductRepository,SalesOrderRepositoryICurrencyBoundRowSourceEggOperationsFixtureSeedDefaultsAccountConfigurationEggUnitcolumn, ignoredDiscountCeilingExpenseRepositoryICurrencyBoundRowSourceExpenseConfigurationFlockFeedUsageConfiguration,WaterUsageConfigurationDailyEntryFeedUsageRepository,InventoryItemRepository,InventoryLotRepositoryICurrencyBoundRowSourceFeedUsageConfiguration,InventoryMovementConfiguration,WaterUsageConfigurationFlockBirdMovementConfigurationDailyEntryEach cell's reason gains one sentence naming its new symbols. New symbols are appended, so the existing lines stay unchanged apart from a trailing comma. The
FK_BirdMovements_DailyEntries_DailyEntryIdreason no longer says that no Flock Management code references Egg Operations; it namesBirdMovementConfigurationand the new cell.Implementationsis empty in every rules file, so a repository now reads its tables as its own module's code.CompatibilityExceptionRealTreeTestsasserted that at least one read was allowed through anImplementationsrow. That case cannot exist any more, so the line now asserts that a moved repository's read is walked and allowed as an own-module read.TrackedMutationReadTestsneeded no change. S0 (#1088) already selectsRepositories/andModules/<Owner>/Repositories/with an exact discovery comparison, exclusions and floor; a mutation below proves it covers the new location.Checks at the head (base measured on
57cdbc6b)dotnet build Cluckwork.sln(analyzers on)Architecture+TenantBypass+Documentation+ImagePinServingGuardCoverage,TrackedMutationRead,InsightsReadOnly,GlobalUserLookupGuard, FlockScope classes,BusinessRecordChronology*CI at
247e259b: 18 checks pass, including the four test legs, "Build, audit and schema docs", both image smoke tests and the three Playwright shards. "Publish the commit image" is skipped, as on every PR.What differs from main, and nothing else
coupling-matrix.mdUserRoleAssignment, which is on Farm'sSeam. The remaining additions are framework types the walk does not resolve (CancellationToken,Guid,EntityTypeBuilder, …).PeerContractRealTreeTestsgreenParity proofs (base
57cdbc6bvs head247e259b)migrations has-pending-model-changesMigrations/has no diff at all. Control:Flock.NameatHasMaxLength(Flock.MaxNameLength + 1)in the movedFlockConfigurationmakes the same command exit 1, which provesApplyConfigurationsFromAssemblystill finds the moved configurationstools/schema-docs/generate.sh --checkSymbol/Fileonly). NoHashorSignaturechangedFlockScopeGuardis unchanged (auth path)The source diff of
UserRoleAssignmentRepository.csis the rename plus one line:namespace Cluckwork.Infrastructure.Repositories;→namespace Cluckwork.Infrastructure.Modules.Access.Repositories;. There are no logic edits.FlockScopeGuardTestsRolesTestsFlockScopeTests,FlockScopeMiddlewareTests,AccessAuthorizationContractTests,AccessLookupTestsMutations
Each case ran in a spare worktree at the head. It was reset and built, then run against the
Architecture+TenantBypassfilter (C5:TrackedMutationReadTests). When the build itself failed, the case was rebuilt with analyzers off, so the guards still ran.ExpenseRepositorygains a read of Commerce'sdb.SalesOrders(no Finance → Commerce edge, noImplementationsrow left)CompatibilityExceptionRealTreeTests.RealSourceTree_EveryCompatibilityExceptionIsRegistered. The build and every other guard stay green, so this guard is the only one that catches a cross-module table readFlockRepositoryreferences Finance'sExpense(no FlockManagement → Finance edge)CW1001. With analyzers off: redModuleLedgerRealTreeTests,CouplingMatrixRealTreeTests(2)FlockScopeGuarddeleted from the Access → Farm cellCW1001namingFlockScopeGuard; redModuleLedgerRealTreeTests,CouplingMatrixRealTreeTestsCW1001namingBirdMovementConfiguration; redModuleLedgerRealTreeTests,CouplingMatrixRealTreeTests(2)FlockRepository.GetByIdAsyncreadsAsNoTracking()TrackedMutationReadTests.AllMutableRepositoryReads_AreTrackedandFlockRepository_GetByIdAsync_ReturnsATrackedEntity: the tracked-read guard coversModules/<Owner>/Repositories/