Skip to content

Commit 5180ff8

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 existing order-of-addition convention (R14 #1701 < R15 #1702 < R16 #1724): device-inventory-cutover landed in #1699, contracts-implementation-authority in #1701. 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. No docs needed changing: all twelve R11/R13 mentions across CONTEXT.md, ADR 0019 and docs/agents/testing.md already refer to the keeper rules, and both movers are described there in prose without a number.
1 parent 0fc0b69 commit 5180ff8

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

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)