Skip to content

M3 G4 prep: the laws layer, unregistered - #67

Merged
VirtualMachinist merged 4 commits into
mainfrom
m3/g4-layer
Nov 20, 2026
Merged

VirtualMachinist merged 4 commits into
mainfrom
m3/g4-layer

Conversation

@VirtualMachinist

Copy link
Copy Markdown
Member

This is the second of four PRs for M3's laws readers step. It lands the laws layer, not yet registered with the gate. Registration, with the runner's optional inputs, comes next; the report fields and the protocol text come in the step PR.

What it does

lawsLayer(catalog, readers) in src/laws/layer/:

  • Runs the readers. It runs the ESLint and compiler readers (M3 G4 prep: the laws readers #66) for the laws that map their tools, and asks ESLint once for all of them.
  • Gives each law a verdict. It emits one law/W-NN finding per mapped law, and each law's verdict is the worst of its readings.
  • Fails on what wasn't judged. A required law that no reader judged, or whose tool artifact is missing, is not-evaluated, and that ends the layer. It never passes.
  • Handles acks. A broken law of severity A is ack-missing.
  • Reads its inputs. It takes the laws from laws/W-NN.yaml through a catalog seam. It requires eslint-json and tsc-diagnostics from the hygiene layer, and treats five tool artifacts (attw, audit, dependency-cruiser, install, publint) as optional.

The tests call the layer directly, with a fake process runner and fake readers, so the gate's runner stays out of this PR's mutation scope. The end-to-end tests with real ESLint and tsc need the layer registered, so they come with the next PR.

Declared exceptions

File Change
src/gate/types.ts An optional?: boolean field on a layer's consumes entry. Types only, with no runtime code. The runner behaviour comes in the next PR
src/layers/coverage/tracked.test.ts (new) The layer lists tracked files through trackedFiles, which brought its 5 untested mutants into scope. This test kills them

The layer lives at src/laws/layer/, inside the src/laws/ path that every tool already covers. The protocol's §17 text naming it comes with the step PR.

Gate on this head

  • layers: 5 in range, 5 ran, 0 failed, 0 not-evaluated. The gate took 6 minutes on a 10-CPU machine.
  • Coverage is 99.48%, and the highest CRAP score is 4.00.
  • Mutation: 692 killed, 0 survived, 528 excluded as compile errors.

🤖 Generated with Claude Code

VirtualMachinist and others added 4 commits November 20, 2026 03:26
…e, not yet registered

The laws layer runs the ESLint and compiler readers for the laws that map their tools, takes the worst reading of each law, and ends the run on a required law that is refused, failed or not evaluated; a law whose tool has no reader is not-evaluated for it, never a pass, and a law whose tool artifact (audit, install, publint, attw, dependency-cruiser) gate 1 did not write is not-evaluated too. It reads the laws from laws/W-NN.yaml, gives every mapped law a finding of its own, and declares those artifacts as optional inputs. The registry does not use it yet, and it lives under src/laws/layer.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…, and the tracked-file listing it reads

The optional-input path (a law whose tool artifact gate 1 did not write is not-evaluated and its reader is not asked) and the artifact map are tested on the layer itself with fakes, and the coverage layer tracked-file listing, which the laws layer also uses, gets the tests that say what it passes to git and what it reports when git is missing, slow or fails.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… a law is read by its own tool only

Which of two verdicts is worse is the first of the worst-first list that is either, so two equal verdicts need no tie rule. New tests cover a law that maps two tools with one artifact missing, a reader that has no law left to read, the layer inputs and outputs, and a severity A law whose verdict is not a refusal.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@VirtualMachinist
VirtualMachinist merged commit ce6ce2a into main Nov 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant