lvd-lint: Enforcing Layer Rules Automatically
How lvd-lint turns LVD's dependency rules into an automated check: cycle detection, layer violations and an alignment score, run from the command line or CI.
Tooling, testing, migration and the anti-patterns that quietly undo good architecture.
How lvd-lint turns LVD's dependency rules into an automated check: cycle detection, layer violations and an alignment score, run from the command line or CI.
lvd-diagram draws layer diagrams from the real dependency graph, and its heatmap overlays git history to show where code changes more than its layer predicts.
lvd-metrics condenses architectural health into five numbers, with gates for CI and trend reports that warn you before a threshold is actually crossed.
Where LVD's checks belong in the delivery flow: pre-commit hook, pull-request pipeline with differential metrics comments, and editor feedback as you type.
LVD gives each layer its own rung on the test pyramid and its own coverage target. Here is the reasoning, and why layering makes testing easier.
How to test Schema, Utils, Resources and Tools in LVD: exhaustive rule checks, property-based tests, containers for adapters and mocks at the resource boundary.
API and UI code translate between worlds, so test the translation, not the business rules: contract tests, UI outcome tests and where end-to-end fits.
The plumbing behind LVD test suites: test data patterns, four ways to fake a dependency, and a parallel run order that follows the layer graph.
Tests that punish refactoring teach teams to stop refactoring. Two traps layered code invites: mocking inside a layer and snapshotting a volatile one.
Before moving any file, measure: extract the dependency graph, compute volatility from history, find the gaps against the target layers, and plan bottom-up.
A tour of the book's nine-step migration roadmap: extract the stable layers first, add the AI-facing layers last, and gate every step on checks you can run.
A long migration branch loses to a main branch that keeps moving. Two LVD migration patterns on a ticketing codebase: strangler signposts and temporary flags.
A monolith lacks boundaries; a microservice estate may have the wrong ones. How LVD migration differs for each.
How to staff and train a layered migration, answer resistance with data, and handle four recurring obstacles from cycles to stranded UI logic.
A utility function that quietly calls the database breaks Axiom A2. See how upward imports creep in, what they cost, and the small refactor that undoes them.
A shared enum pulled from a tool and a tool that calls another tool: two one-line imports that quietly break the dependency rules of LVD.
Every import points downward and the lint run is green, yet a layer is doing the wrong job. Three anti-patterns where purpose, not direction, is the problem.
Over-layering, under-layering and misplaced volatility are system-level mistakes. Here is how to recognise each and test it against evidence.
The UI is where shortcuts are most tempting. Three anti-patterns that break Axiom A6 or the UI's own ordering rules, and how each one is caught.
Why one upward import costs more than it looks, and why a gate should fail the build only on the few violations a machine can judge with certainty.