Skip to content

Law rules limited to classes; W-22's Astro rules for astro-site only - #74

Merged
VirtualMachinist merged 8 commits into
mainfrom
m3/law-rule-classes
Nov 20, 2026
Merged

VirtualMachinist merged 8 commits into
mainfrom
m3/law-rule-classes

Conversation

@VirtualMachinist

Copy link
Copy Markdown
Member

A law's rule can now be limited to some of the classes the law maps. W-22's 31 Astro accessibility rules apply only to astro-site.

What it does

  • schema/law.schema.json: a rule entry takes an optional classes list: at least one entry, no repeats, launch-class names only. With no classes, the rule applies to every class the law maps, as before.
  • The catalog (src/laws/catalog/{types,schema,view}.ts):
    • LawRule gains classes.
    • A rule class that isn't one of the law's own classes fails validation, at /rules/<n>/classes.
    • laws explain marks such a rule, for example "(astro-site only)".
  • laws/W-22.yaml: the 31 astro/jsx-a11y/* rules carry classes: [astro-site]. A new test checks them against the plugin's strict accessibility config.
  • WEB_TOPS.md §8.3: the rules bullet describes the optional classes. laws sync --check reports no drift.
  • The probe (src/laws/probe/{source,types,catalog}.ts): a probe law records which rules name classes, and keeps only the proofs that apply to the class being probed.
  • New twins: fixtures/laws/W-22/{bad,clean}/astro-semantics.astro.
    • Under --class astro-site, W-22 now has to prove its 31 Astro rules.
    • The bad twin has one marked line per rule. A few lines carry two or three markers, where one snippet also fires other rules.
    • Each snippet was checked under the Astro preset to fire the rule it claims.

The gate's laws reader honours classes in the next readers PR.

Declared exceptions

  • WEB_TOPS.md §8.3, under the protocol-change label.
  • The probe-source change, in another lane's files: src/laws/probe/{source,types,catalog}.ts and their tests.
  • The two new W-22 twins.

Gate on this head

  • 4,635 tests pass.
  • layers: 5 in range, 5 ran, 0 failed, 0 not-evaluated.
  • Mutation: 255 killed, 0 unexplained survivors. The 1 explained survivor was already in the ledger.

🤖 Generated with Claude Code

VirtualMachinist and others added 7 commits November 20, 2026 07:27
…s Astro a11y rules (R106)

A rule entry in laws/W-NN.yaml takes an optional classes list, a subset of the law's
classes: without it the rule applies to every class the law maps. The schema, the loader
type and the validator (which fails a class outside the law's) carry it, laws explain
shows it, and section 8.3 describes it.

W-22 lists the 31 astro/jsx-a11y rules that eslint-plugin-astro's strict a11y config
enables, each for astro-site only; a test keeps the list equal to the plugin's.

The ESLint reader and the probe honour the field in the step that follows; until then
`laws probe` still treats the new rules as owed to every class W-22 maps.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The probe took every rule of a law as owed to every class the law maps, so
W-22's Astro rules were demanded under web-app and ui-components too. A probe
law now carries the classes of each rule whose entry names some, and the laws
of a class keep only the proofs that apply to it. The W-22 rule list test
keeps its own five rules apart from Astro's, which rule-classes.test.ts checks.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A rule that names several classes prints them comma separated; no test had
a rule with more than one, so the separator could be emptied unseen.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
W-22 now maps 31 astro/jsx-a11y rules for astro-site, so under that class
the probe owes a bad twin that fires each. One .astro bad twin carries a line
per rule with its marker, and a clean twin holds the valid forms.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@VirtualMachinist VirtualMachinist added the protocol-change Changes laws, schema, profiles, thresholds, budgets or normative spec text label Nov 20, 2026
@VirtualMachinist
VirtualMachinist merged commit 28db7a0 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

protocol-change Changes laws, schema, profiles, thresholds, budgets or normative spec text

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant