Skip to content

Ruling audit, and rulings as checked records - #2785

Open
antonsynd wants to merge 8 commits into
devfrom
claude/quirky-planck-bpunzb
Open

antonsynd wants to merge 8 commits into
devfrom
claude/quirky-planck-bpunzb

Conversation

@antonsynd

@antonsynd antonsynd commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

What

An audit of the 460 owner rulings, and a first mechanism that holds rulings as checked data.

  • Audit (docs/audits/ruling-audit-2026-11-21.md, data beside it): which rulings a written law already decided, the 32 principles the rulings share that no law states, and where rulings contradict each other or a law. Section 6 is sixteen questions for the owner.
  • Ruling records (docs/process/rulings/): one record per charter ruling, the written laws with the text that anchors each, the audit's draft principles, five hand-listed case families, and a draft policy file. README.md there has the template for a new ruling.
  • build_tools/check_rulings.py: twelve checks across records, laws and charters. It runs nothing.
  • build_tools/ruling_evidence.py: runs a ruling's program on the compiler and on python3, derives the door from the observations, and re-runs every recorded program.

No compiler, Core or Stdlib file changes. No charter row for this work and no section 12 letter: a no-plan tooling lane.

What a reviewer should know

Measured

Run Result
The two new test files plus the licence guard @ 27363ab16 183 passed
check_rulings.py @ 27363ab16 0 new, 0 stale, 20 known findings
ruling_evidence.py recheck @ 27363ab16, CPython 3.15.2 12 programs re-run, 0 drifted
build_tools/tests/ without test_ruling_evidence.py, on the tree of 993681ab3 (before the review fixes; not re-run since) 2544 passed, 1 failed
CI @ 993681ab3 every check that ran green, review-line aside
check_commit_subjects.py origin/dev..HEAD 8 subjects, none over 72 characters, no closing keyword

The one local failure is test_every_file_a_workflow_reads_is_in_its_filter[python-build-tools.yml] ("reads .venv"). Control at the base bfbeeee6a in a worktree: 54 passed with no .venv; the same 1 failed once a .venv exists. This cloud session has one; CI does not. Posted as a cell on #2458.

The dotnet solution gate was not run locally: nothing under src/ changed.

Mutation records, each restored from a cp copy with the tests green before and after:

Mutation Result
collision sees no cases 6 failed
invariance ignores the invariant axes 7 failed
charter-mark accepts a longer id (R-CA for R-C) 1 failed
superseded rulings count as live 17 failed
owner-required never fires 2 failed
door: a kept divergence from python counted as two-way 3 failed
the sharpyc run banner counted as program output 3 failed
no diagnostic code is internal 4 failed
a run-time SyntaxError is a refusal 3 failed
raises: drops what was printed 5 failed
a law's section is the whole file 2 failed
a draft exception is never reported 1 failed
a known row ignores the case 4 failed
a schema finding can be parked 1 failed
inputs are not sanitized 4 failed
one owner cannot collide with itself 1 failed
every charter section's rows are rulings 1 failed
only the first case is judged against the policy 1 failed
the python twin is not registered as __main__ 4 failed
an emitter failure is a refusal 3 failed
an unclassified CodeGen code is a refusal 1 failed
one Active CodeGen code left unclassified 2 failed
a law runs to the next blank line 1 failed
a repeated law anchor is accepted 1 failed
__builtins__ left to exec 1 failed
a closed stdout is not tolerated 1 failed
done() uses the twin's open 1 failed

Issues

Closes none. Files no new issue: every cell found has an open class tracker (contract section 10), so each went there as a comment.

Two mismatches measured here were already on their trackers and were not posted again: the string-backed enum ordering SPY0908 (#2680) and the spec texts that still contradict R-MH (#2427).

Refs #2486 #2487 #2733

Independent review

Independent review @ 993681a: merge after fixes; 9 applied, 0 declined; second review @ 87da778: merge after fixes; 3 applied, 0 declined; third review @ 7e9f191: merge; 3 applied, 1 declined (reasons below); fixes 7e9f191..27363ab read by the lead

One reviewer that wrote none of the code, three rounds, every finding verified by running or reading.

  • First review (87da77896 applies it): an internal compiler error was recorded as a refusal, which was in the shipped data as R-PK's evidence (SPY0908); a SyntaxError raised while running counted as python refusing the program; python exception names were parsed from stderr text; exception-in-law searched the whole source file, so it could not fail for a draft law; one known-findings row hid every finding with the same key; malformed input gave a traceback; a ruling could not collide with itself; raises: dropped prior output; three smaller points on the door, the policy class and the charter reader.
  • Second review (7e9f191e6 applies it): the first fix round's python runner did not run the twin as __main__, so a dataclass with a string ClassVar annotation printed 2 where python prints 1; the emitter's own failures in the CodeGen range were still refused:; a law's section could take in a neighbouring paragraph or table row.
  • Third review: merge, four nits. Applied in 27363ab16: the twin's __builtins__, a twin that closes stdout or replaces open, and a roster test that does not depend on how a comment is written.
  • Declined (1): a twin that installs sys.excepthook is reported without the hook's output. The reviewer rated it too obscure to act on, and a twin written for a ruling does not install an exception hook.

https://claude.ai/code/session_01LGMKZWzMqj85EP7DtKRcLz


Generated by Claude Code

Read-only audit of every ruling in section 4 of both batching charters
(R-A to R-QR). One record per ruling, then a verified pass for conflicts
between rulings, conflicts with the written laws, and the principles the
rulings share that no law states.

Measured, as model classifications checked in part by the lead:
- 275 rulings concern language, library or diagnostics; a law that
  existed at the time decides 79 of them, and 102 are owner choices.
- 32 recurring unwritten principles cover 245 rulings.
- 4 contradictions and 9 unexplained asymmetries between rulings; 9
  rulings against a law's text; 10 unmarked supersessions.
- 42 cases where a law's text does not decide (Axiom 2, Rule 7, T2, RR).

Nothing was built or run. Data is in docs/audits/ruling-audit-2026-11-21/.

Refs #2486 #2733

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGMKZWzMqj85EP7DtKRcLz
Same findings and numbers. The body now defines each project term on
first use, shows every conflict as a code example beside the two texts
that disagree, and adds a table of which slips a validated ruling
record could catch (ten of fourteen fully, two partly, two not).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGMKZWzMqj85EP7DtKRcLz
A ruling record holds what a program did, not a claim about it. This
module runs a Sharpy program with the built compiler and its python
twin with the oracle, and reduces each to one observation: runs:<stdout>,
refused:<code>, raises:<type> or no-twin.

derive_door computes, from the observation before a decision, the one
it decides and python's, two facts nobody is asked for: breaks_running
(a running program changes) and undo_breaks (taking the decision back
would break programs written under it). door is one-way when
undo_breaks. Both are reported because the charter rows use the word in
two senses: of 61 admissions the audit classified, 13 say additive, 10
two-way and 9 one-way (keyword count).

recheck re-runs every recorded program and reports drift.

Tests run the real interpreter and the real compiler; nothing is faked.
Mutations (restored from a cp copy, 96 passed before and after):
- a kept divergence from python counted as two-way -> 3 failed
- the run banner counted as program output -> 3 failed

Refs #2486 #2733

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGMKZWzMqj85EP7DtKRcLz
docs/process/rulings/ holds the 460 charter rulings as records, the
written laws with the text that anchors each, the audit's 32 draft
principles, and the closed lists a case is named from. check_rulings.py
checks them against each other and the charters, and runs nothing.

Seed records carry a model's labels under audit: and are held to the
structural checks only. A new ruling must provide: options with one
chosen and one recommended, a basis and the laws it rests on, an answer
to every ruling with a case in the same family, and for a language or
library ruling a case with measured evidence. Its door is computed
from that evidence, and policy.yaml (a draft) says which decisions an
agent may record without the owner.

On the tree as it stands the checks report 20 findings from the data
alone, the conflicts the 2026-11-21 audit verified by reading rows:
- collision: R-GV/R-LR (walrus onto a let), R-HH/R-HT (a silent spec)
- invariance: backed enums (two pairs), == against in, str of
  Optional against Result
- exception-in-law: R-MH departs from N5; N5 does not name it
- charter-mark: 13 amended rulings whose rows do not say so
They wait in known-findings.yaml, a ratchet: an unlisted finding fails,
and so does a listed one that no longer fires.

Measured @ bfbeeee, CPython 3.15.2, for the 12 recorded programs:
walrus onto a let rebinds (R-GV rules an error); a comprehension walrus
writes through (R-MH; N5 and the spec say refused); ordering a
string-backed enum is SPY0908 over CS0019 (R-PK rules a Semantic
refusal).

Mutations (restored from a cp copy, 96 passed before and after):
- collision sees no cases -> 6 failed
- invariance ignores the invariant axes -> 7 failed
- charter-mark accepts a longer id (R-CA for R-C) -> 1 failed
- superseded rulings count as live -> 17 failed
- owner-required never fires -> 2 failed

Not checked: whether a label is right. The five families are listed by
hand; #2486 #2487 #2733 are where they get derived from the compiler.

Refs #2486 #2487 #2733

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGMKZWzMqj85EP7DtKRcLz
test_no_file_names_the_retired_cpython_licence_id allows that id only
in the files it lists (the charter among them). The R-NO record in
rulings.yaml and in the audit's records.tsv restated the charter row
and named it, so the guard was red from the audit commit 23c4899 on.
Both lines now say "the narrower id used before"; the guard's allowed
list is unchanged.

Measured on this tree: build_tools/tests without test_ruling_evidence,
2544 passed, 1 failed. The one failure is
test_every_file_a_workflow_reads_is_in_its_filter[python-build-tools.yml]
("reads .venv"); control at the base bfbeeee in a worktree: 54 passed
without a .venv directory, the same 1 failed once one exists. This
cloud session has a .venv; CI does not.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGMKZWzMqj85EP7DtKRcLz
Independent review of PR 2785: merge after fixes. All nine applied.

ruling_evidence.py
1. An internal compiler error (Infra range SPY0900-0999) is a new
   observation, crashes:<code>, never refused:. R-PK's recorded
   program gives SPY0908 over CS0019 and is now recorded as a crash.
   A ruling cannot decide a crash (after).
2. python: the twin is compiled first, so only a SyntaxError of the
   file is a refusal; one raised while running is raises:.
3. python: how the twin ended comes from the exception object through
   a side file, not from names found in stderr text.
8. raises: carries what the program printed first, so a change in
   that output is a change.

check_rulings.py
4. exception-in-law searches the law's own section (anchor to the
   next law), not the whole file; a draft law must list the ruling
   under against.
5. Only charter-mark, exception-in-law, collision and invariance
   findings can wait in known-findings.yaml, and a collision or
   invariance row names its case in where: one row, one finding.
   Duplicate rows are refused.
6. Malformed entries are one schema finding each and are dropped
   before the other checks; no traceback.
7. One ruling giving one case two verdicts collides with itself.
9. Every case is judged against the policy, not the widest alone; the
   same refusal is no_change; only section-4 charter rows are rulings
   and a second row for one id is refused.

Mutations (restored from cp copies; 150 passed before and after):
no code is internal -> 4 failed; a run-time SyntaxError is a refusal
-> 3; raises drops what was printed -> 5; a law section is the whole
file -> 2; a draft exception is never reported -> 1; a known row
ignores the case -> 4; a schema finding can be parked -> 1; inputs
are not sanitized -> 4; one owner cannot collide with itself -> 1;
every section's rows are rulings -> 1; only the first case is judged
against the policy -> 1.

On the tree: check_rulings 0 new, 0 stale, 20 known; recheck 12
programs, 0 drifted (CPython 3.15.2).

Refs #2486

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGMKZWzMqj85EP7DtKRcLz
Second independent review of PR 2785: the nine first-round findings
are confirmed by re-running their probes; merge after fixes, three
new findings, all applied.

1. Introduced by the first fix round: the python runner executed the
   twin in a bare dict, so sys.modules['__main__'] was the runner. A
   dataclass with a string ClassVar annotation printed 2 where python
   prints 1; typing.get_type_hints, pickle and `import __main__`
   failed or read the wrong module. The twin now runs as a real
   __main__ module registered in sys.modules. Each test also runs the
   same file under the interpreter directly as its control.
2. Left open: the emitter's own failures in the CodeGen range
   (SPY0500 0501 0508 0510 0518 0519 0524 0599) were still refused:.
   The range is now classified code by code; a code in neither set is
   an EvidenceError. A test holds the two sets to the 18 Active
   CodeGen codes of DiagnosticCodes.cs.
3. law_section: an anchor that is not a heading is its own line and
   the indented lines after it, so the next list item, an adjacent
   bold paragraph or the next table row is not read as the law.
   law-anchor now fails an anchor that occurs more than once.

Mutations (restored from cp copies; 163 passed before and after,
recheck test deselected):
the twin is not registered as __main__ -> 4 failed; an emitter
failure is a refusal -> 3; an unclassified CodeGen code is a refusal
-> 1; one Active code left unclassified -> 2; a law runs to the next
blank line -> 1; a repeated anchor is accepted -> 1.

Refs #2486

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGMKZWzMqj85EP7DtKRcLz
Third independent review of PR 2785: merge. Four nits; three applied.

1. The twin's __builtins__ is the builtins module, as in a script
   (exec inserted the dict).
2. done() tolerates a twin that closed or replaced stdout, and uses
   an open bound before the twin ran, so a twin that patches
   builtins.open is still measured.
4. The roster test reads every SPY05nn constant of DiagnosticCodes.cs
   and drops those marked Retired or Reserved, so an Active code is
   seen however its comment is written.

Declined: 3, a twin that installs sys.excepthook is reported without
the hook's output. The reviewer rated it too obscure to act on; a
twin for a ruling does not install an exception hook.

Mutations (restored from a cp copy; 10 passed before and after on
the affected tests): __builtins__ left to exec -> 1 failed; a closed
stdout is not tolerated -> 1; done() uses the twin's open -> 1.

Refs #2486

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGMKZWzMqj85EP7DtKRcLz

This branch has not been deployed

No deployments
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.

2 participants