Repository navigation
check_system advises on key shape, and the shape rules design is closed out (D64, step 5) - #39
Conversation
…solver The solver kept its own copy of "the keys in the masters of any core" and its own constant for "every rule off"; the checker needs both for the shape advice (D64, step 5). They become Config.master_keys and ShapeRules.is_off. No behavior change: the solver's output, defaults on, is identical to main's on 12 seeded runs of four fake systems. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…design (D64, step 5; D65) check_system prints a "Key shape" section, left out when every rule is off: a SHAPE line for each rule a key or control key breaks, with pin positions and never cuts. It is advice, not a problem: the exit status and the counts are unchanged, and decoded unit keys and retired keys are not checked. Apart from the new section the output is identical to before. The design document is marked Implemented, and its open questions are answered with what building it showed (a thin pinnable set can leave no key, the objective still rewards holding a master's cut). D65 records that a key with no bitting that follows the rules is left null and said so. The README, design.md and TODO.md follow. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
twilde
left a comment
There was a problem hiding this comment.
Changes requested
Reviewed head 60ae97e, two commits on main at b3772a1 (so the merge into current main is trivial). One Should fix (a docs claim that contradicts the checker) and two Optional notes. The code itself is sound.
What I ran
- The whole suite in a venv with only
.[test](ci_changes.pysaysscanner=false): 1042 passed, 16 skipped. The scanner's tests that need the extra were not run, and this PR does not touch the scanner. scripts/check_no_stray_data.py --history: clean. CI on the head is green (12 checks, the scanner job skipped).check_systemonmainand on the head, withsystem.example.json: the output differs only by the new "Key shape" section, and stderr and the exit code (0) are the same.- The same file with every
shaperule set tonull: stdout, stderr and exit code identical tomain, and no section is printed. - A fake file with a master named
unit:8, onlymax_runset and a core that makesunit:keys the masters: exit status 1 on bothmainand the head, with the same problem counts, and the new section is the only difference. - Privacy scan of the diff and commit messages: no real-looking data (the seven-digit strings are in tests and are obviously fake), and both commits have the noreply author and committer and a
Co-Authored-Bytrailer. Design prose speaks in general scenarios.
Verdict on the code and behaviour: Config.master_keys and ShapeRules.is_off() replace the solver's copies faithfully, the SHAPE lines show positions only, and the exit status and the counts are untouched, as the description says. The tests cover the exemptions, the cap, the rules-off case and the file's own settings.
What blocks: the new text in docs/design.md (and the existing line it repeats in docs/designs/key-shape-rules.md) says decoded unit keys are exempt from the shape advice "as for parity and MACS in D11". D11 exempts only retired keys, and check_system does check unit keys for parity and MACS. See the inline comment.
Review written with AI assistance (Claude).
Generated by Claude Code
Review feedback on #39. D11 exempts only retired keys from parity and the adjacent-cut limit; decoded unit keys are checked for both. The exemption of decoded unit keys from the SHAPE lines is its own choice, so design.md and the design document now give its reason (the vendor cut them) and say that parity and MACS still apply to them, with a test that pins both. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Review feedback on #39: a readability change only; the output is unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
twilde
left a comment
There was a problem hiding this comment.
Approved
Re-review of head 53c6421 (two new commits since my review of 60ae97e). main is still at b3772a1, so the merge into current main is trivial.
Earlier threads
- Should fix, D11 cited wrongly for the unit-key exemption: closed.
docs/design.mdanddocs/designs/key-shape-rules.mdnow say retired keys are history (which is also why D11 exempts them from parity and MACS), and that decoded unit keys are exempt from theSHAPElines only, with parity and MACS still applying, plus the reason. That matches whatcheck_systemdoes. The new testtest_decoded_unit_keys_are_exempt_from_shape_advice_but_not_from_paritypins both halves (aPARITYline and noSHAPEline for a wrong-parity unit key). - Optional, nested comprehension: done.
checked = {...}is named first and the comprehension reads over it. The output forsystem.example.jsonis byte-identical to the previous head's. - Optional, D65 in its own commit: declined with a reason, accepted. The entry's wording was already fine, and I would not rewrite and force-push a reviewed branch for a history tidy-up. The PR description already says it records a step-4 decision. The author plans a note in the merge commit body if it is merged that way.
What I ran on the new head
- The whole suite in a venv with only
.[test](ci_changes.pysaysscanner=false): 1043 passed, 16 skipped. The scanner's tests that need the extra were not run, and the PR does not touch the scanner. scripts/check_no_stray_data.py --history: clean. CI on53c6421is green (12 checks, the scanner job skipped).- The two new commits touch only two docs, one readability change in
check_system.pyand one test. Both have the noreply author and committer and aCo-Authored-Bytrailer. There is no real-looking data, and the new test uses an obviously fake bitting.
Nothing blocks. The author or the maintainer resolves the threads; all three already show as resolved.
Review written with AI assistance (Claude).
Generated by Claude Code
Review feedback on #39. D11 exempts only retired keys from parity and the adjacent-cut limit; decoded unit keys are checked for both. The exemption of decoded unit keys from the SHAPE lines is its own choice, so design.md and the design document now give its reason (the vendor cut them) and say that parity and MACS still apply to them, with a test that pins both. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
What and why
Step 5, the last, of the key shape rules design (D64). Two
commits, each readable on its own.
Config.master_keys("the keys in themastersof anycore") and
ShapeRules.is_off()replace the solver's own copies, because the checker needsboth. The solver's output with the defaults on is identical to
main's on 12 seeded runs offour fake systems.
check_systemprints a "Key shape" section: aSHAPEline per rule a key or control keybreaks, with pin positions and never cuts, using the file's
shapesettings. It is advice:the exit status and the counts of problems and warnings do not change. Decoded unit keys
and retired keys are not checked, and the section is left out when every rule is off.
"What building it showed": a thin pinnable set can leave no key that follows the rules
(reported, not repaired); the search never got stuck in 100 seeded solves; and the
objective's other bias is still there (a change key shares a master's cut at 26.8% of
positions against 24.7% before and 20% by chance), which the rules do not touch.
null, said so inNOT SOLVED, and the full check is skipped. That was decided while building step 4 and had nolog entry yet.
docs/design.mdandTODO.md(the objective's holding bias; exact reachabilitybounds) are updated.
Route: a pull request, because
maintakes changes by pull request and the code should pass CI.Never include real key data
None: tests and docs use the fake fixtures and invented keys; the measurements are of fake systems.
Checklist
pytestpasses. A bug fix has a regression test.docs/decisions.mdand, if it changes how things are, an edit todocs/design.md(and the feature's document indocs/designs/, if it has one).secrets,random.SystemRandom) unchanged.Behavior changes and AI assistance
check_systemoutput gains the "Key shape" section when any rule is on, which is by default.I compared it with
mainonsystem.example.jsonand the clean, pinning and five-pinfixtures: with every rule set to
nullthe output (stdout, stderr, exit code) is identical, andwith the defaults on it is identical once the new section is removed. Exit codes are unchanged.
The solver's scoring and algorithms are untouched (D6).
Tests run:
ci_changes.pysaysscanner=false, so the whole suite in a venv with only.[test]: 1042 passed, 16 skipped.Written with Claude Code (Co-Authored-By trailer on the commits).
🤖 Generated with Claude Code