Repository navigation
refactor(arch): move Insights into Modules/Insights - #1089
Conversation
…iles move.py split: the seven report records leave IReportQueries.cs and ExportDataset leaves IExportQueries.cs, 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: Application, Infrastructure and Api files go under Modules/Insights, contract types under Contracts, with the namespace taken from the folder. References, usings, ledger strings and paths are rewritten by the tool; the Insights rules file now names Cluckwork.Application.Modules.Insights and Cluckwork.Infrastructure.Modules.Insights. The tool added no unused using. Refs #1087
…e moved files InsightsReadOnlyTests and ExportSnapshotSourceTests read the Insights read session by path. Two comments name moved files. src/AGENTS.md now says where a moved module's contract and registration live. Refs #1087
The eleven Insights contract types now sit in Modules/Insights/Contracts; the folder makes them contract, and a type with both fails. Refs #1087
|
Approve this slice at The independent rename-aware comparison confirms all 24 moves. All eight extracted declarations are verbatim, including comments, and the original files retain exactly their remaining content apart from blank-line compression. Beyond namespace/import changes, the moved files contain only:
No other moved-file content changes. The eight declarations are ProductionDay, GradeTotal, ProductionReport, SalesSummary, ExpenseCategoryTotal, ExpenseSummary, ProfitReport and ExportDataset.
The adapter count increase from 402 to 403 is benign. The two edited guards retain their assertions and floors and read the same moved implementations.
All mutations compiled before testing and were restored. The restored solution build and affected guards passed. In total, 145 existing targeted tests passed at head, with classes run individually, polling enabled, and integration tests through No structural or overengineering finding meets the requested threshold. Ponytail-review: Lean already. Ship. Local evidence is preserved in |
Refs #1087
S1 of the package-by-module design: Insights moves into
Modules/Insightsin Application, Infrastructure and Api. This is a pure move with no behaviour change. The S0 codemod (tools/module-move/move.py) produced it from a finite table, and every proof below compares this head with the base29f6003e.Review order
ea9bab23split (mechanical): the seven report records leaveIReportQueries.cs, andExportDatasetleavesIExportQueries.cs, each into its own file in the same namespace. Each declaration is a verbatim slice of the original, and the remainder equals the original minus those slices.03ae000amove (generated; skim it): 24git mvs, namespaces taken from the folders, and references, usings, ledger strings and paths rewritten by the tool. The Insights rules file is the only hand-fed input (see below). The tool added no unused using.64b7e5a2fix (read this one): the two path-pinned guards (InsightsReadOnlyTests,ExportSnapshotSourceTests), two comments that name moved files (web/src/i18n/en.ts,reports-range.spec.ts), and threesrc/AGENTS.mdsentences that say where a moved module's contract and registration live.41a99ed6marks: the 11 Insights[ModuleContract]marks deleted. Their types now get contract status from theContracts/folder.No re-key commit: the tenant-bypass rows changed only
Symbol/Filestrings, and the 40 allow-list hashes still verify.Change map
Application/Features/{Audit,Export,Insights,Reports}Application/Modules/Insights/Contracts/(11 contract types:IInsightsModule,AuditEventRead,EntityProvenance,ExportDataset, 7 report records)Application/Modules/Insights/Reports/IReportQueries.cs,Export/IExportQueries.cs,Audit/IAuditEventRepository.cs(outsideContracts, as src/AGENTS.md requires)Infrastructure/Insights/*(4)Infrastructure/Modules/Insights/Repositories/*Api/Endpoints/{Audit,Export,Reports}/*(5)Api/Modules/Insights/{Audit,Export,Reports}/*(still Platform-owned adapters)Api/Hosting/Modules/InsightsModuleServiceCollectionExtensions.csApi/Modules/Insights/InsightsModuleServiceCollectionExtensions.csNamespaces: 5 feature namespacesCluckwork.Application.Modules.Insights,Cluckwork.Infrastructure.Modules.InsightsThe six Insights edge cells keep their reasons. Their
Symbolsnow nameCluckwork.Infrastructure.Modules.Insights.Repositories.*.Proofs (base
29f6003evs head41a99ed6)dotnet build Cluckwork.sln(analyzers on, warnings are errors)migrations has-pending-model-changesMigrations/difftools/schema-docs/generate.sh --checkModules.Insights.ContractsWalkedAdapterCount402 → 403, becauseInsightsModuleServiceCollectionExtensions.AddInsightsModulenow sits under the adapter rootCluckwork.Api.Modules. Its reach is empty and the persistence ban passesSymbol/Filestrings follow the move; no hash changed (no Insights query spells a namespace)coupling-matrix.mdCouplingMatrixRealTreeTestsgreen)The type map covers every top-level declaration in the 24 moved files, read at the split commit. Positions (file, line) are excluded from the report comparison.
Test counts (measured at base and head)
Architecture+TenantBypass+Documentation+ImagePin(includesNamespaceFolderAgreementTests)ServingGuardCoverageTests7,TrackedMutationReadTests2,SchemaDocsTests4,ReportsConcurrencyLimitTests1,ExportTests11,AuditProvenanceTests48,ReportQueryBoundingTests2,FlockScopeTests16,ListChronologyTests1The full integration suite and e2e-smoke run only in CI.
Mutations (scratch worktree at the head; each case reset, built and run)
Contracts/EntityProvenance.cs(file and namespace) back toModules/Insights/Audit/AdapterReachRealTreeTests(endpoints reach a non-contract Insights type),CouplingMatrixRealTreeTestsEntityProvenanceAudit/but keeps the.ContractsnamespaceNamespaceFolderAgreementTestsonlyReportEndpoints.SalesinjectsIReportQueriesinstead ofIInsightsModuleAdapterReachRealTreeTests,InsightsReadOnlyTests.Endpoints_DoNotUseTheReadSessionPortsDirectly,CouplingMatrixRealTreeTestsReportEndpoints.Salesalso injectsIAuditEventRepositoryNotes for the next slices
Api/Modules/<Owner>/becomes an adapter and is subject to the persistence ban. None of today's registration files resolvesAppDbContextin a factory. A slice whose registration does must handle that.