Repository navigation
Give every rule a Signal: line and record each rule's size - #745
Merged
Merged
Conversation
Each of the 64 rules now states what in the written name it reads on a one-line `Signal:` above its pointer line; the hubs C1 and S2 write `Signal: hub of ...`, and a doc test holds each named rule to the hub's interacts: and to its statement's map. S2's map now names S3-S10 and its interacts: gains S9, the gap the check was written to catch. Four rules whose line needs two signals (P2, P3, P6, S10) join them with ` + ` and are split candidates, not split here. tests/v2/rules_budget.json records each rule's statement words, its except/unless count and its Accepted: clauses; test_rules_budget.py fails when a rule moves against the record, and `uv run python -m tests.v2.rules_budget --record` re-records. The rule prose a citation may quote and the prose the budget counts now come from one function, rules_doc.prose_blocks, moved out of test_doc_citations.py with its output unchanged over the tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The hub check reads the map: every rule a hub names must sit in ONE sentence of its statement, Accepted clauses aside. Deleting C8 from C1's map passed the whole-prose check, C1 naming C8 elsewhere. - A hub may state its own signals before `hub of`; S2 now does (the string-opening position and the written periods), and its map sends a word whose chunks the vocabulary knows, or an unlisted dotted word, to S3 rather than every word with interior periods. - The budget counts `Accepted, and ...:` clauses (R2, R4 were miscounted) and records Accepted-clause words, so growth inside one is seen. - Signal lines: S10 gains its case contrast, C8, C9 and T4 mark their two signals, P3 and C5 reworded; P6 and P2 cite S6 and C9 cites T4 where they read those rules' signals. Conventions written down: a cited condition stays off the line, a size gate is part of its signal. - A Signal: line outside a rule block raises; the second-Signal branch gets a test that reaches it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A hub list after any separator but '; ' now raises rather than reading as a plain signal; C5's line drops the condition it cites to C6; P3's three-word gate moves to the join it gates; P2 and P6 list the S6 their statements now cite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silent failures closed (each now raises, with a test row): - a line no rule block holds (six-space or tab-indented prose) fell out of both the quotable statement and the size budget; - a misspelled Accepted clause (`Accepted :`, `Accepted --`) counted as statement and could carry a hub's map; - `hubs of`, `Signals:`, `**Signal:**` and a fullwidth colon read as prose or as a plain signal; - `--record` could write a record from text the parser rejects or from no rules at all; measure() now parses first and refuses a mismatch, read_record() refuses a duplicated key or a non-count value, and changes() reports a measure the record holds but no longer measures. The hub check runs both ways (a rule the map names that the Signal: line leaves off is a finding), takes the sentence naming the most, and ends a sentence past a closing bracket or quote. Signal errors name the rule. New tests: main() end to end against a scratch record, ID order, the README's split-candidate grep against the parsed rules, and each bad Signal: row matched to the branch it is named for. Docs: signal kinds written as examples, not a closed list; the hub field and test docstrings allow a hub's own signals; tolerated: sits above the Signal: line; root AGENTS.md says Signal: lines are not quotable; docs/design/AGENTS.md's skip list names the new guards and no longer claims the check made S2's omission of S9 a failure by itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
derek73
force-pushed
the
feat/rule-signal-and-size-budget
branch
from
October 19, 2026 18:54
ff8e807 to
c0d7322
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #745 +/- ##
=======================================
Coverage 99.05% 99.05%
=======================================
Files 47 47
Lines 4642 4642
=======================================
Hits 4598 4598
Misses 44 44 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rules_doc.py's docstring, its Rule.tolerated comment, the misspelled- marker error and the grammar test's comment all said build_rules_corpus.py skips a tolerated rule and that the corpus enforces examples at released baselines. Neither has been true since #664: the builder harvests a tolerated rule's examples like any other's, and the snapshot only watches readings move. The refusal of a near-miss marker now gives its real cost: the rule would read as a promise, and the line would become quotable statement prose counted by the budget. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebased onto master after #743 (squash 90f6d2c) and #744 merged.
Lands the two remedies #743 deferred from the 2026-10-19 critique of docs/design: splitting S2 (#682) and C1 (#728) fixed the file granularity but did nothing to stop statements growing a clause at a time.
What changes
Signal:line in every rule (all 64). It names what in the written name the rule reads: a count, a case contrast, a shape, a neighbor, a position.signal:,Signals:,**Signal:**, a fullwidth colon), a second one, or one outside a rule block.Accepted :,Accepted --): either would otherwise fall out of the quotable statement or the budget without a word.Signal: hub of C3, …, C12. S2 writes its own two signals and then; hub of S3, …, S10.hub_findingscheck (intest_doc_citations.py) requires every rule a hub names to appear in the hub'sinteracts:and in one sentence of its statement, which is the map, and runs the other way too: a rule the map names that theSignal:line leaves off is a finding.interacts:.tests/v2/rules_budget.jsonrecords, per rule: statement words (Rationale included, Accepted clauses not), how many timesexcept/unlessappear (a proxy for carve-out clauses), the number of Accepted clauses, and their words.test_rules_budget.pyfails on any move, shrinking included, so the record follows a rule down, and asserts the record holds exactly the parsed rules.--recordparses the rules first and refuses text the doc tests reject or an empty rule set; the record loader refuses a duplicated key or a non-count value.uv run python -m tests.v2.rules_budget --recordand say so in the PR.rules_doc.prose_blocks, moved out oftest_doc_citations._statements. I verified its output is identical over the tree except S2, whose statement this PR edits.interacts:.tolerated:claims corrected (predating this PR):rules_doc.pysaid the corpus builder skips a tolerated rule and that the corpus enforces examples at released baselines, neither true since Replace the differential ledgers with a committed snapshot of corpus readings #664. The README's tolerated paragraph now says plainly what such a rule covers, with W3 as the case.Split candidates (listed, not split)
These are the rules whose Signal line has to name two signals.
grep -l '^ Signal:.* + ' docs/design/rules/*.mdlists them.Review
Ran the design-docs-reviewer three times; every finding is fixed:
Accepted, and …:clauses (R2, R4) and could not see growth inside an Accepted clause;;still parsed as a plain signal. The grammar had widened without its near-miss guard; this is the Describe each word by its readings: per-word TOML vocabulary compiled to today's sets (phase 1) #737 shape.interacts:./pr-review-toolkit:review-pr(code, tests, comments, silent failures; fixed in c0d7322):hubs of, and--recordon a bad or empty tree, all now refused;main()end to end, ID ordering, the README's grep recipe, the hub check's choice of map sentence, and each badSignal:row matched to its own error branch;tolerated:sits aboveSignal:, and the reviewer skip list names the new guards.Signal: hub C3, C4had slipped and is now a pinned row.Test plan
uv run pytest: 21,843 passed, 123 skipped, 3 xfailed (after rebasing onto master)uv run mypy,uv run ruff checkinteracts:, or C8 from C1's map, failshub_findings;🤖 Generated with Claude Code