Skip to content

Commit 11e7639

Browse files
committed
refactor(layering): give each colliding rule id its own number
R11 and R13 each named two unrelated rules. report() groups violations by the rule string and titles every annotation `Layering drift (${rule})`, so a shared number made the guard's output ambiguous about which rule fired. Reference counts decided which rule keeps its number. R11 package-boundaries is named in ~30 places (CONTEXT.md, ADR 0019, testing.md, the mutation and affected-check configs, four package source comments, its own tests) against one for the contracts rule; R13 platform-package-substrate is the RULE in three policy files plus CONTEXT.md, ADR 0019 and model.ts against two for the devices cutover. Both keepers stay put and the two newest rules move up: R11 contracts-implementation-authority -> R18 R13 device-inventory-cutover -> R17 R17/R18 follow the namespace's order-of-addition convention (R14 #1701 < R15 #1702 < R16 #1724): device-inventory-cutover landed in #1699 and contracts-implementation-authority in #1701. #1656 took R19 for selector-pipeline-ownership on the same reading. The rule-map header in check.ts is renumbered and reordered back into numeric order, and gains the R18 entry the contracts rule never had -- without it a reader looking up an R18 violation finds nothing where they used to find the wrong rule. deviceInventoryCutoverSummary() was also the only OK-line summary not leading with its rule number, which is what made the number unreadable from the success line in the first place. Also corrects a normative ADR reference. ADR 0019's platform-package import rules -- contracts-to-platform, sibling-platform, root/daemon, raw-process -- are R13's, as CONTEXT.md:420 already says. The R11 attribution predates platform-package-policy (#1697, a day before #1699), when R11 was the only package rule.
1 parent 97c87ee commit 11e7639

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

docs/adr/0019-request-bound-platform-runtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ only that composition module may import a concrete platform package; reusable ty
111111
through type-only platform imports. Platform packages may import contracts, kernel/domain packages,
112112
and explicitly injected host capabilities; they may not import daemon requests or responses, mutable
113113
session state, command catalogs/grammar, root implementation files, sibling platform packages, or raw
114-
process primitives outside the shared host-command port. R11 applies these rules to static, type-only,
114+
process primitives outside the shared host-command port. R13 applies these rules to static, type-only,
115115
dynamic, and re-export edges; package-owned tests may import their own public façade. Contracts may
116116
depend on kernel vocabulary but never on concrete platform packages or daemon implementation types.
117117

scripts/layering/check.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@
3333
// owner" shape as R7's SessionState ownership, applied to bin.ts's `--help` fast path.
3434
// - Over PLATFORM PACKAGE COMPOSITION: six private metadata façades meet at the exact root
3535
// composition file; premature implementation loading and forbidden cross-boundary edges fail (R13).
36-
// - Over the DEVICES COMMAND CUTOVER: the handler calls the neutral inventory gateway and no
37-
// superseded inventory module, import, or identifier remains in production (R13).
3836
// - Over COMMAND-ATOMIC RUNTIME CUTOVERS: retired logs, network, and record routes/admission cannot
3937
// coexist with their operation-fact-derived descriptor and handler paths (R14-R16).
38+
// - Over the DEVICES COMMAND CUTOVER: the handler calls the neutral inventory gateway and no
39+
// superseded inventory module, import, or identifier remains in production (R17).
40+
// - Over CONTRACTS PRODUCTION SOURCE: contracts owns vocabulary only — host, process, and timer
41+
// mechanics belong in capture-kit or an adapter (R18).
4042
// Only `(root)` is unranked among src/ zones (see `UNRANKED_ZONES` in model.ts):
4143
// it holds entrypoints and composition roots. Extracted workspace package zones
4244
// are classified separately and held behind R11 instead of the src folder spine.

scripts/layering/contracts-implementation-policy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { LayeringViolation } from './model.ts';
33

44
export type ContractsProductionSource = Readonly<{ path: string; source: string }>;
55

6-
const RULE = 'R11 contracts-implementation-authority';
6+
const RULE = 'R18 contracts-implementation-authority';
77
const FORBIDDEN_HOST_MODULES = /^(?:node:)?(?:child_process|fs|timers)(?:\/|$)/;
88
const FORBIDDEN_TIMER_CALLS = new Set([
99
'clearImmediate',

scripts/layering/device-inventory-cutover-policy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { parseSync } from 'oxc-parser';
22
import type { LayeringViolation } from './model.ts';
33

4-
const RULE = 'R13 device-inventory-cutover';
4+
const RULE = 'R17 device-inventory-cutover';
55
const HANDLER_FILE = 'src/daemon/handlers/session-inventory.ts';
66
const INVENTORY_IMPORT_SOURCES = new Set([
77
'../../core/device-inventory-context.ts',
@@ -253,5 +253,5 @@ export function checkDeviceInventoryCutover(
253253
}
254254

255255
export function deviceInventoryCutoverSummary(): string {
256-
return 'the devices command has one gateway-owned inventory route and no legacy route';
256+
return 'R17 holds the devices command to one gateway-owned inventory route with no legacy route';
257257
}

0 commit comments

Comments
 (0)