Repository navigation
#747 Move the correctness-rule database into this repo - #749
Merged
Merged
Conversation
The rule database was in the private Typhon-Claude repo because it is markdown, and everything markdown lived there. But it is not prose about code, it is checked against code: ~185 `scope:` lines name C# symbols, 70 `[VerifiesRule]` attributes name rule ids, 75 source files cite rule ids in comments, and the ratchet baseline counting all of it already lived here. It pointed at code roughly 330 times and at the rest of the knowledge base four times. Living across the boundary cost a PAT in a public repo's CI (the workflow's own comment called it "a capability, not a fence"), an audit that fork PRs silently skipped, a path filter that could not see rule edits at all, two ~15-line steps that guessed the companion docs branch by matching its NAME, and a merge deadlock where each repo's gate demanded the other merge first — three consecutive merges left main red for twelve hours. All of that is deleted rather than tuned, because a rule, its verifying test and the code it scopes now land in one commit. `rules/` sits at the repo root: it is a contract, not documentation output. `check-rule-scopes.py` comes with it, minus `--repo-root` and minus the whole `--baseline-rules` regression-only mode, which existed only to tell "drifted" from "hasn't landed yet" — a distinction with no meaning once both halves travel together. The audit keeps `--rules-dir` as the fixture hook its self-tests use, alongside `--tests-dir` and `--baseline`, but loses `--skip-if-no-rules`: a gate that can decline to run is one a reader must check the logs to trust. The scope check runs in `invariants`, unconditionally, not in the `rules/**`-gated job. An unresolved `scope:` symbol is a source-side defect — someone renames a type in src/ and a correct rule quietly becomes false, with no rule file in the diff — so gating it on rule paths would miss the failure mode it exists to catch. This is the direction that previously could only be caught by a nightly sweep in the other repository, a day late. Moving the database out of `claude/` would have silently dropped a guard: check-doc-drift.py had rules/ in its ENFORCED_DIRS, validating the src/ paths and links inside rule files, which is a different check from scope-symbol resolution. check-doc-links.py already does exactly that job for doc/ and now covers rules/ too, with build-docs.yml gated accordingly. That work also surfaced a latent bug in check-doc-drift.py: its link checker never skipped absolute URLs while its regex matches any .md target, so every https link to a rules file read as a missing file. Verified against the untouched baseline: 185 scope lines all resolve, the coverage audit is clean at 191/26/21/4 with 22 non-blocking mutant advisories, doc-links passes over 335 files and 1865 links, and 100 script self-tests are green. The three engine tests failing here (PayloadAxes_SurviveACrash, DirtyCounter_IsConservedAtQuiesce, ParallelOperations_AreLinearizable) fail identically on unmodified 3958c15 and on current main; the C# diff in this change is thirteen comment lines.
…ommit Rebasing onto main hit the one conflict this move can produce: `rules/indexing.md` was deleted on this branch and modified on the docs repo's main, where #740 added IXW-03 (a leaf's lower bound is the previous leaf's HighKey). Resolving it the obvious way — deletion wins, the file is going away — would have dropped a `[fatal]` rule added a few hours earlier. So the resolution is main's version of the file, with this branch's link change re-applied on top, not the version this branch started from. That IXW-03 exists at all is worth noting here, because it is the same failure mode from a different angle: the guard shipped in PR #737 was strictly stronger than the invariant it protected, and nothing could see the contradiction because the guard and the consistency check that disagreed with it never met. A rule deleted by a clean merge resolution would be invisible in exactly the same way. Its `scope:` resolves — `KeyBelowLeafLowerBound` and `InsertIterative` in `BTree.Insert.cs` — because the fix landed in PR #745 meanwhile. Worth stating plainly, since this branch deletes the `--baseline-rules` mode that used to demote a not-yet-landed citation to a warning: had the rule arrived before its fix, the scope check would now fail, and that is the intended behaviour rather than an oversight. The window in which a rule can outrun its code is the width of one commit. `rules_total` goes 191 to 192. The three coverage figures are untouched — IXW-03 is covered by its `verified:` line but carries no `[VerifiesRule]` attribute, so nothing the ratchet protects moves. That the count and the rule it counts can be corrected together is the whole point: PR #745 could not touch the rule, PR #73 could not touch the counter, and neither was wrong to leave it.
nockawa
force-pushed
the
feature/move-rules
branch
from
August 10, 2026 09:47
67984e3 to
5c9509a
Compare
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.
Companion:
Log2n-io/Typhon-Claude#feature/move-rules. Deliberately order-independent — that the two used to require a merge order is the defect this closes, so please do not reintroduce one. Either can land first.Why
claude/rules/was in the private docs repo because it is markdown, and everything markdown lived there. But it is not prose about code, it is checked against code:scope:lines naming C# symbols[VerifiesRule]attributes intest/coverage/rule-coverage-baseline.json, counting all of itrules/→ rest ofclaude/Roughly 330 references to code, four to the rest of the knowledge base. A directory's home is wherever its verifier lives.
What the boundary was costing
secrets.TYPHON_CLAUDE_TOKEN.merge-gate.yml's own comment: "a capability, not a fence: anyone with push access here could print the private knowledge base from a workflow step."--skip-if-no-rulesskipped.continue-on-error, announcing the fallback so a green run could be told from the wrong green run.scope:cites an unlanded symbol); code PR red until the docs merged (unknown rule id + ratchet regression). Test suite as a defect detector #702, Bug bash: eight defects fixed, two filed with measurements #717, #631 #662 #582 #710 #569 #672 #688 Bug bash round two: seven fixes, and the view bug underneath one of them #719 — main red for twelve hours, two runs never re-run.--baseline-rulesmode that materialised a git worktree in CI to tell "drifted" from "hasn't landed yet".All deleted, not tuned. A rule, its verifier and the code it scopes land in one commit now, so there is nothing left to sequence.
Decisions worth reviewing
rules/at the repo root, notdoc/rules/. It is a contract, not documentation output.The scope check runs in
invariants, unconditionally — not in therules/**-gated job. An unresolvedscope:symbol is a source-side defect: someone renames a type insrc/and a correct rule quietly becomes false, with no rule file in the diff. Gating it on rule paths would miss the entire failure mode it exists to catch. This is precisely the direction that previously could only be caught by a nightly sweep in the other repo, a day late.--rules-dirsurvives;--skip-if-no-rulesdoes not. The first is the fixture hook the self-tests use, alongside--tests-dir/--baseline/--matrix. The second is the one that could manufacture a false green — a gate that can decline to run is one a reader must check the logs to trust.The TLA job inherits the docs-repo version's
*.cfgglob and jar cache, replacing a hardcoded three-spec list. When the two copies disagreed, the hardcoded one silently checked less.Found while doing it
A guard that would have been silently dropped.
check-doc-drift.pyhadENFORCED_DIRS = {"overview", "rules"}— it validated thesrc/…paths and links inside rule files.check-rule-scopes.pydoes not do that job; it resolvesscope:symbols, which is a different check. Moving the database out without noticing would have left those unguarded.scripts/check-doc-links.pyalready does exactly this fordoc/and now coversrules/, withbuild-docs.ymlgated onrules/**.A latent bug in
check-doc-drift.py(fixed in the companion PR): its link checker never skipped absolute URLs while its regex matches any.mdtarget, so everyhttps://…/rules/durability.mdread as a missing file. Harmless only because no enforced-tier doc had an https link ending in.md— until these citations became absolute.Verification
check-rule-scopes.pyaudit-rule-coverage.pycheck-doc-links.pycheck-doc-drift.pyThe 3 failures are pre-existing and unrelated.
PayloadAxes_SurviveACrash,DirtyCounter_IsConservedAtQuiesceandParallelOperations_AreLinearizablefail deterministically on unmodified3958c154(this branch's base) and on currentmainheada464cf75— baselined in a throwaway worktree. The C# diff here is thirteen comment lines across twelve files; a comment cannot change runtime behaviour.The coverage baseline is deliberately untouched: changing it during a move would hide whether the move was faithful.
Follow-up, not in this PR
TYPHON_CLAUDE_TOKENshould be revoked at the org once this merges. Nothing references it any more, so it becomes a standing capability with no consumer.🤖 Generated with Claude Code
https://claude.ai/code/session_01WdANiVsrwEwuZd3Zdygu9J