Repository navigation
refactor(arch): move Commerce into Modules/Commerce - #1094
Merged
Merged
Conversation
move.py split: the seven Domain enums (EggUnit, ProductType, ProductUnit, PaymentMethod, SalesOrderStatus, DiscountReasonCode, ListPriceBasis) leave their aggregates, and UpdateEggUnitConversionCommand, CustomerBalance, SettlementScope and SalesOrderListFilter leave their handler and repository files, each into its own file in the same namespace. Each declaration is a verbatim slice of the original. Refs #1087
move.py move with the slice's table: Domain, Application and Api files go under Modules/Commerce, contract types (including the seven Domain enums) under Contracts, with the namespace taken from the folder. The current model snapshot follows the moved entities; historical migrations and Designer files are untouched. The rules file now names Cluckwork.Domain.Modules.Commerce and Cluckwork.Application.Modules.Commerce; Implementations stay for S9. Refs #1087
The comments on ICommerceModule, IEggOperationsModule, IFinanceModule and IInventoryModule still said adapters reach the module through the types marked [ModuleContract]; those marks are gone in moved modules. Refs #1087
The thirty-six Commerce contract types now sit in Contracts folders (Domain's seven enums, Application's twenty-nine types); the folder makes them contract, and a type with both fails. Refs #1087
mforce
force-pushed
the
refactor/1087-commerce-module
branch
from
October 5, 2026 23:02
eb8de0a to
855f2e7
Compare
This was referenced Oct 6, 2026
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
S6 of the package-by-module design: Commerce moves into
Modules/Commercein Domain, Application and Api. This is a pure move with no behaviour change. Its repositories and EF configuration stay in place until S9. Rebased onto51e9cbb5(#1093, Egg Operations) by resetting onto main and re-running the codemod per commit (split, move + prune, wording, marks); nothing was merged by hand. Proofs compare head855f2e7bwith base51e9cbb5.Review order
4124ec48split (mechanical): 11 contract types leave 7 mixed files, each a verbatim slice in the same namespace. In Domain,EggUnit,ProductType,ProductUnit,PaymentMethod,SalesOrderStatus,DiscountReasonCodeandListPriceBasisleave their aggregates. In Application,UpdateEggUnitConversionCommandleaves its handler file,CustomerBalanceleavesIPaymentRepository.cs, andSettlementScopeandSalesOrderListFilterleaveISalesOrderRepository.cs.ce2d1103move (generated; skim it): 73git mvs; namespaces from folders; references, usings, ledger strings, snapshot entity names and paths rewritten by the tool. The rules fileNamespacesnow holdsCluckwork.Domain.Modules.CommerceandCluckwork.Application.Modules.Commerce;Implementationsis unchanged (S9). No codemod fix and no fixture hand fix were needed.66fabc6efix (read this one): theICommerceModule,IEggOperationsModule,IFinanceModuleandIInventoryModulecomments said adapters reach the module "through the types marked [ModuleContract]"; they now name the Contracts folder. Those modules have all moved, so their comments were stale;IFarmModuleis left to S7.855f2e7bmarks: the 36 Commerce[ModuleContract]marks deleted.Change map
Domain/{Catalog,Sales}/**(8 files)Domain/Modules/Commerce/{Catalog,Sales}/Domain/Modules/Commerce/Contracts/Application/Features/{Catalog,Customers,Sales}/**contracts (29 types)Application/Modules/Commerce/Contracts/Application/Features/{Catalog,Customers,Sales}/**handlers, validators, modules, lookups, repository portsApplication/Modules/Commerce/{Catalog,Customers,Sales}/**Api/Endpoints/{Catalog,Customers,Sales}/*(4) andApi/Hosting/Modules/CommerceModuleServiceCollectionExtensions.csApi/Modules/Commerce/**(Platform-owned adapters)AppDbContextModelSnapshot.cs: 22 entity-name linesChecks at push time (rebased head
855f2e7b)dotnet build Cluckwork.slnArchitecture+TenantBypass+Documentation+ImagePinServingGuardCoverageTests,TrackedMutationReadTestsProofs (base
51e9cbb5vs head855f2e7b, re-run after the rebase)migrations has-pending-model-changesMigrations/diff is the 22 snapshot entity-name lines. Control:HasMaxLength(Product.MaxNameLength + 1)makes the same command exit 151e9cbb5'sAppDbContextModelSnapshot.csat the head)HasMaxLength(Product.MaxNameLength + 1), exit 1 ("Changes have been made to the model")tools/schema-docs/generate.sh --checkContracts, 29 in ApplicationContracts)Domain.{Catalog,Sales}→Domain.Modules.Commerce,Application.Features.{Catalog,Customers,Sales}→Application.Modules.Commerce), so three Farm → Commerce edges list a root once instead of twice inReferencedNamespaces. Compared as sets, every edge is identicalAddCommerceModuleis now under the adapter root, with empty reach and the persistence ban passingcoupling-matrix.mdCouplingMatrixRealTreeTestsgreen)global using Cluckwork.Domain.Common.Architecture;inCluckwork.Domain/GlobalUsings.cs, because Commerce's enums carried the last Domain[ModuleContract]marks. The design keeps that using until S10The type map covers every top-level declaration in the 73 moved files, read at the split commit. Positions (file, line) are excluded from the report comparison.
Mutations (spare worktree at the head; each case reset, built and run against the
Architecture+TenantBypassfilter)Contracts/UpdateCustomerCommand.cs(file and namespace) back toCustomers/UpdateCustomer/AdapterReachRealTreeTests(CustomerEndpointsreaches a non-contract type),CouplingMatrixRealTreeTestsUpdateCustomerCommand.Contractsnamespace keptNamespaceFolderAgreementTestsonlyContracts/SalesOrderStatus.csback toDomain/Modules/Commerce/Sales/SalesOrderStatusCustomerEndpoints.GetCustomeralso injectsICustomerRepositoryAdapterReachRealTreeTests,CouplingMatrixRealTreeTestsM1c is the case Astra raised on #1088: a contract that no adapter or peer reaches can leave
Contractswithout any guard noticing; only the per-slice contract-set comparison sees it. This slice's comparison above is identical.