Repository navigation
Description
Slice 3 of #514 (modular monolith). Track B — enforcement only, no production code. Needs #842.
Every relational table has exactly one owner, proven by walking the EF model rather than by reading a
list.
Scope
- Extend the ledger (
tests/Cluckwork.Application.Tests/Architecture/Data/module-ledger.json) with
an owner→tables mapping and a declared cross-owner foreign-key set. - A walk over
IModel.GetEntityTypes()resolving each mapped relational table to exactly one owner. - Enumerate cross-owner FKs from the model; each must be declared with a stated purpose.
Run against a model-only AppDbContext so the test needs no Docker and stays in the application
matrix leg.
Why a walk rather than a list
Today's 38 mapped tables map onto the 2026-08 design's §3.3 owner list with no gap (verified
2026-09-14 against docs/schema/). That will not stay true. #795 would add four OpenIddict tables,
and BusinessRecordModel.cs:21-34 already shows the failure mode — a Platform-side list of module
types that #819's own rule says grows with every new time-paged table. A walk fails the moment a
table is mapped with no owner. A list quietly stays green.
Done when
| Mutation | Expected |
|---|---|
remove Payments from its owner's table list |
red — table has no owner |
assign Expenses to two owners |
red — exactly-one violated |
| map a new entity with no ledger row | red |
drop FK_Expenses_Flocks_FlockId from the declared cross-owner FK set |
red — undeclared cross-owner FK |
Red output attached to the PR, mutation reverted before commit.
Explicitly not in this slice
No schema change, no migration, no InitialCreate edit (#407). Does not move any EF configuration —
ownership is recorded, not relocated.
Activity
[-]#514 slice 3: table-owner completeness, walked from the EF model[/-][+][B] #514 slice 3: table-owner completeness, walked from the EF model[/+]test(arch): walk split-table fragments and key foreign keys by table (#…
test(arch): find foreign keys on split-table fragments and reject dup…
test(arch): table-owner completeness walked from the EF model (#845)
docs(decisions): table-owner ledger decision record and AGENTS.md rule (
test(arch): walk split-table fragments and key foreign keys by table (#…
test(arch): find foreign keys on split-table fragments and reject dup…
test(arch): table-owner completeness walked from the EF model (#845)
docs(decisions): table-owner ledger decision record and AGENTS.md rule (
test(arch): walk split-table fragments and key foreign keys by table (#…
test(arch): find foreign keys on split-table fragments and reject dup…
test(arch): table-owner completeness walked from the EF model (#845) (#…
docs: restore two constraints and correct four stale record claims (#956