feat: add dependency-boundary rule and architecture import test (E00-S01-T04)
CI / Frozen lockfile install (pull_request) Successful in 38s
CI / Frozen lockfile install (pull_request) Successful in 38s
Adds a declarative dependency-boundary rule (dependency-boundaries.json) classifying workspace packages into apps/packages/extensions groups and forbidding packages/* (core) from importing extensions/* (concrete extensions); core depends only on extension contracts, never concrete extensions. Adds tests/architecture-import.test.mjs (node:test, zero new dependencies, lockfile untouched) that loads the rule, walks every workspace package's source and resolves each import/export/require specifier (bare workspace names, relative paths, dynamic import(), require(), export-from) to a group, failing on any forbidden core -> extension edge. Comment-aware scanning avoids false positives; line numbers in violation reports map to the original source. Synthetic negative cases prove detection (bare name, relative path, export-from, dynamic import, require), while the current compliant graph passes with zero violations. Verified: 10/10 tests pass; injecting a real core -> extension import makes the integration test fail with a per-file/line violation report; pnpm 11.23.0 install --frozen-lockfile passes unchanged (CI frozen-install job stays green). Closes #157
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"description": "Dependency-boundary rule for the EPPP workspace. Enforced by tests/architecture-import.test.mjs. Groups classify workspace packages by directory; boundaries declare which from-group -> to-group import edges are forbidden.",
|
||||
"groups": {
|
||||
"apps": { "path": "apps/" },
|
||||
"packages": { "path": "packages/" },
|
||||
"extensions": { "path": "extensions/" }
|
||||
},
|
||||
"boundaries": [
|
||||
{
|
||||
"from": "packages",
|
||||
"to": "extensions",
|
||||
"allow": false,
|
||||
"reason": "Core packages must not import concrete extensions. Core depends only on extension contracts (abstract APIs); concrete extensions are wired in by the app layer."
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user