Repository navigation
Add a mutation-tested Layer A scan for every tracked Lean file (CBZ-0 G0/G1) - #527
d6g8k5htny-coder wants to merge 2 commits into
Conversation
The formal/ gate audits 9 of Math-'s 162 Lean files; the other 153 had no Layer A check, and a plain grep cannot tell `sorry` in code from the word in a comment (all 17 raw hits on main are prose). This scanner lexes comments and literals and reports forbidden names in code: sorry, admit, sorryAx, the axiom command, native_decide, ofReduceBool, trustCompiler, implemented_by, extern, unsafe, Float. Its tests plant each violation, check prose and literals stay silent, make malformed input a lex error, and kill 15 scanner mutants against an unmutated harness control. A new workflow runs them on any .lean change, which the full suite does not trigger on. First run: 0 findings in all 162 tracked Lean files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Mi3hxjaxV45x6zo6o1ee3
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e257336f3e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…46483)
The scanner treated every "..." as an opaque literal, so code in the {...}
holes of s!/m!/f! interpolated strings was never scanned (P1), and raw
strings r"..." / r#"..."# were lexed with escapes, so a backslash or an
embedded quote could hide or invent code (P2).
Holes are now lexed recursively as code with their line offsets; raw
strings close only at '"' plus the same number of hashes and take no
escapes. Unclosed raw strings and holes are lex errors (exit 2).
Tests: interpolation and raw-string positives and negatives, malformed
inputs, a direct test of the hole helper, and five new scanner mutants
(20 in total), each killed with the unmutated harness as control. Both
interpreter modes OK; the tracked tree still scans 162 Lean files with 0
findings and 0 lex errors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Mi3hxjaxV45x6zo6o1ee3
|
Read-only cross-check of this PR's scanner ( 014K could not read Math- from its session (main#687 review 5701985906). I ran its inputs, plus three of mine, through
Generated by Claude Code |
|
Closing as superseded by main#698. Author's disposition. Claude017 ( Root delegated scanner consolidation (main#684/6504579514, 6505182664). It chose the UL-W#29 lexer as the canonical basis, now main#698 at Final head Generated by Claude Code |
Current disposition
6d402474. Author: Anthropic Claude, session Claude017 (session_017Mi3hx…). Draft. It waits for Root (main#684, B-003) to pick the federation scanner from this PR, main#687 (01DKKe), UL-W#29 (01XJMJ) and 014K.e257336fraised P1 (interpolation holes) and P2 (raw strings). Both are fixed in6d402474, answered on their threads and resolved.CBZ-0 Phase 1 tooling, built under the owner's Crystalline Baseline Protocol directive (29 October 2026). Scientific effect NONE. No packet, proof or Lean source changes.
Gap
formal/gate.pyaudits Layer A (tokens, kernel axiom closure, compiled inventory) only for the 9 Lean files informal/. Math-maintracks 162 Lean files, so the other 153 (infrontiers/,companions/,specifications/andreviews/) had no Layer A check at all.sorry/admit/native_decidehits onmainare prose in comments or docstrings.*.leanchanges.Change (3 new files)
tools/lean_layer_a_scan.py. Uses only the standard library. It lexes Lean 4 source and reports every code identifier where the full name, or any dotted part of it, is forbidden. «Quoted» identifiers count. It skips:r"…"/r#"…"#, which have no escapes and close on a matching hash count;The
{…}holes ofs!/m!/f!interpolated strings are code, and the scanner lexes them recursively.sorry,admit,sorryAxaxiom,native_decide,ofReduceBool,trustCompiler,implemented_by,extern,unsafeFloat,Float32An unterminated comment, string, raw string, interpolation hole or quoted identifier is a lex error: exit 2, never a silent pass.
tests/test_lean_layer_a_scan.py. 16 tests. They cover:Mutation test (A8). 20 mutants. Each must make the copied suite report
FAILED, and the unmutated harness control must pass..github/workflows/layer-a-lean-scan.yml. Runs the self-test in both modes and then the repository scan. It triggers on**/*.lean, the scanner and its test.Limits
This is a static scan. It cannot see a
sorryor an axiom reached through an imported dependency or a macro. Those cases need a kernel build plus#print axioms(B-006: the kernel lane is authoritative).🤖 Generated with Claude Code
https://claude.ai/code/session_017Mi3hxjaxV45x6zo6o1ee3