Skip to content

Move the correctness-rule database into the Typhon repo #747

Closed
1 of 1 issue completed
Closed

Description

@nockawa

Done 2026-08-10. Log2n-io/Typhon#749 → c011a7f9 · Log2n-io/Typhon-Claude#75 → b22c3151. rules/ is on Typhon main.

Follow-up split out: #751 (revoke TYPHON_CLAUDE_TOKEN) — kept as its own Task so a live credential does not close with this issue.

Parent epic: #418

Why

claude/rules/ is a code artifact that happens to be written in markdown, and it was stored in the private docs repo (Log2n-io/Typhon-Claude):

Direction Count
scope: lines naming C# symbols ~185 (of 191 rules)
[VerifiesRule] attributes in test/ 70
Source/test files citing a rule id in comments (RB-01, LOG-06, CP-04…) 75 files
Markdown links from rules/ → rest of claude/ 4 (3 design, 1 adr)
Markdown links from rest of claude/ → rules/ 32 sites across 64 files

Rules point at code ~330 times and at the rest of the knowledge base four times. claude/ holds prose about code; rules/ was the only directory in it that is mechanically checked against code. Its correct home is wherever its verifier lives.

What the split cost

  1. A PAT in a public repo's CI. Two jobs checked out the private repo with secrets.TYPHON_CLAUDE_TOKEN. merge-gate.yml's own comment: "a capability, not a fence."
  2. 19 forks got no audit — secrets are withheld from fork PRs, so --skip-if-no-rules skipped.
  3. The path filter could not see rule edits, with the admission in-file that the database lived elsewhere. Editing a rule ran no audit at all.
  4. Two ~15-line steps guessed the companion docs branch by matching its NAME.
  5. A merge deadlock — 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.
  6. Two workarounds built to survive it: a docs-first human protocol, and --baseline-rules, which materialised a git worktree in CI to tell "drifted" from "hasn't landed yet".

Publishing the rules was a deliberate decision taken 2026-08-10: the code is already public, and 191 machine-checked invariants are the best contributor documentation the project has.

Acceptance criteria

  • rules/ (six domain files + README.md + tla/) at the Typhon repo root, deleted from Typhon-Claude. History stays reachable in Typhon-Claude; a filter-repo graft over the public DAG for 21 files was not worth it.
  • check-rule-scopes.py and its self-tests move here; --repo-root and --baseline-rules deleted.
  • audit-rule-coverage.py loses --skip-if-no-rules and can no longer skip. Amended: --rules-dir is kept but retargeted — it is the fixture hook the self-tests use, like --tests-dir / --baseline / --matrix, not cross-repo plumbing.
  • merge-gate.yml: both cross-repo checkouts, both "companion docs branch" steps, and every use of secrets.TYPHON_CLAUDE_TOKEN are gone.
  • changes.rules includes rules/**; tla gains rules/tla/**.
  • Rule-scope checking is a blocking PR job, in invariants, unconditional — deliberately not gated on rules/**, since an unresolved scope: symbol is a source-side defect a rules-path gate would never see.
  • Exactly one TLA+ workflow, path-gated on rules/tla/**, inheriting the docs-repo *.cfg glob and jar cache in place of a hardcoded three-spec list.
  • doc-drift.yml keeps only the doc-drift half; tla-check.yml deleted.
  • 32 inbound links repointed to absolute URLs; check-doc-drift.py reports no drift in enforced docs. Stale prose rewritten in overview/ + design/ (55 across 29 files), left alone in adr/ (immutable), research/, scratch/, blog/ (dated snapshots).
  • Root CLAUDE.md and claude/CLAUDE.md describe the new location and why.
  • Partially demonstrated, honestly. The rebase produced the real case: docs main had added IXW-03 to rules/indexing.md while this branch deleted it, and the naive resolution would have dropped a [fatal] rule silently. IXW-03 and the rules_total 191→192 bump it causes landed in one commit — PR #740 Compare the insert lower-bound guard against the previous leaf's HighKey, not the leaf's own first key #745 could not touch the rule, PR Epoch Phase 3: Caller Migration — B+Tree, Transaction, CRUD to epoch-based API #73 could not touch the counter, and this was the first change that could hold both. What is not yet demonstrated is the full shape: a rule plus its [VerifiesRule] test plus the code it scopes in one commit. That awaits a natural PR; nothing structural stands in its way now.
  • → #747 Revoke TYPHON_CLAUDE_TOKEN — a live cross-repo credential with no consumer #751 Revoke TYPHON_CLAUDE_TOKEN. Nothing references it (git grep on main returns nothing), which is exactly why it must not be left.

Found while doing it (both fixed)

  • A guard that would have been silently dropped. check-doc-drift.py had ENFORCED_DIRS = {"overview", "rules"} — it validated the src/… paths and links inside rule files, which is not what check-rule-scopes.py does. scripts/check-doc-links.py now covers rules/, with build-docs.yml gated on rules/**.
  • Latent bug in check-doc-drift.py: its link checker never skipped absolute URLs while its regex matches any .md target, so every https://…/rules/durability.md read as a missing file.

Verification at merge

Scopes 186 lines, all resolve · audit 0 blocking · doc-links 335 files / 1865 links, PASS · doc-drift no drift in enforced docs · 100 script self-tests OK · build 0 warnings, 0 errors · suite 5117 passed, 3 failed.

The 3 failures (PayloadAxes_SurviveACrash, DirtyCounter_IsConservedAtQuiesce, ParallelOperations_AreLinearizable) fail identically on unmodified 3958c154 and on main head a464cf75, baselined in a throwaway worktree. The C# diff was thirteen comment lines.

Only rules_total moved in the ratchet baseline; the three figures it protects are unchanged.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added theissue type on Aug 10, 2026
  2. updated Priority P1-High, Area Observability, Product CI and Estimate M on Aug 10, 2026
  3. added this to the pre-alpha milestone on Aug 10, 2026
  4. moved this to In Progress in Typhonon Aug 10, 2026
  5. added 3 commits that reference this issue on Aug 10, 2026
  6. moved this from In Progress to Done in Typhonon Aug 10, 2026
  7. added 2 commits that reference this issue on Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Priority

    P1-High

    Estimate

    M

    Area

    Observability

    Start date

    None yet

    Target date

    None yet

    Product

    CI

    Projects

    • Status
      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions