refactor(domain)!: dissolve the domain bucket and put a measured tier ladder behind it - #188
Merged
Conversation
Up to standards ✅🟢 Issues
|
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.
Dissolves the
domainmodule, gives every top-level module a measured tier, and puts tripwires behind the rules that keep it that way.domain/held 52% of the crate — 138 of 222 files — behind a name that says nothing, so nothing in it had been chosen to be there. It is gone.src/now reads as the domain's own vocabulary, the waytokio/srcisfs io net sync task time.The scope law
docs/architecture/CODE-LAYOUT.md§1 gains an eight-tier ladder: imports may only point up it, and two tripwires hold the code to that — one for direction, one for cycles.Eight, not four, because eight is what the graph has. Four put sixteen of twenty-three modules in a single tier, which is a tier doing no work. Levelling the import graph by longest path yields seven strata; the eight tiers verify against all 40 production edges with zero upward imports and an empty baseline.
The ladder is a dependency ordering, not a taxonomy of behaviour. That distinction was earned:
schemashad been filed under "policy" because it decides whether data conforms, when it imports exactly one module and sits second from the bottom.What moved
domain/enums/battery/, two toelectronics/, one tocommon/, two tocarbon_footprint/instrument/catalog/, which is now nine files and genuinely carries no lawidentifier/serdeandthiserror— see #187field_error/error/, which resolved a real import cyclefacility/manufacturer/material/passport/, which never contained them in any real sensearchive/, andports/mod.rsis a pure inventoryBehaviour changes
Passport::validate()is wasm-clean. The schema pass needed the versioned registry —jsonschema, and through it a blocking HTTP client — so an aggregate could not state its own invariants without a network stack in its dependency tree. That block moved tovalidation::validate_passport, which runs both halves. The#[cfg(not(target_arch = "wasm32"))]insidevalidateis gone; the method now means one thing on every target. A companion test fails if the dependency creeps back.validation::rulesis available on wasm32 for the first time. The module carried a blanket gate because one submodule needsjsonschema; thedpp-rulesadapters are pure and were being withheld for no reason of their own.ports/no longer re-exports model types.ports::sealandports::compliancecarried shims whose own doc said "re-exported here so existing paths keep resolving" — a second path to the same type, which is what let a composition tier import the boundary tier in the first place.Conservation
Verified against
mainbefore publishing, per the pre-publish audit:validate_passport,ProductGroupPayload).mod …;. An undeclared.rsis not compiled, so it does not fail — it vanishes, and the suite still reports green. The count would have missed it (1149 on both refs, because six new tripwires replaced them one-for-one); only the sorted leaf-name diff exposed it.CarbonFootprintClassis deliberately not an enumeration. Restored.Gates added
Rules 0 and 11–15, each proven red before being allowed green, plus rule 7 widened to catch test modules named for their subject rather than
tests— it was missing five.Two of the new gates were wrong on first run and the red output is what showed it: rule 11 flagged every
foo_tests.rssibling, punishing compliance with rules 4 and 7; rule 15 counted textual mentions rather than distinct siblings, so one importer looked like two.Breaking
Module paths move, so the platform repository's imports break. That is accepted rather than hidden: compatibility re-exports would leave two ways to reach every type, which is the condition this change exists to end. Zero external users, so the break is paid once. The consumer update is a separate, coordinated change and is not in this PR.
just checkgreen — 1171 tests.