Skip to content

CI cite check: every rule ID in DiagnosticExplanations, the spec, the charter and plans resolves to a rule-table row, and every row is cited #2489

Open

Description

@antonsynd

Sub-issue 3 of #2486 (owner request 2026-11-08): the programmatic answer to "how do we prevent drift between the model and the code".

What

A build_tools/check_rule_cites.py (shape of check_plan_refs.py / check_spec_blocks.sh / check_allowlist_issue_state.sh), run in CI beside them, that:

  1. Loads the rule tables from sub-issues 1 and 2 (binding/scoping; narrowing lattice) and the rule IDs they define (N1…N7, S1…S3, D10…D22, R-xx, plus the narrowing rows' IDs).
  2. Scans for cites: src/Sharpy.Compiler/Diagnostics/DiagnosticExplanations.cs (today 0 rule cites — grep N[1-7]\b), docs/language_specification/*.md, docs/design/*.md, docs/process/rounds/*.md and docs/process/plans/*.md, docs/deviations.yaml, the harness Families.cs (today 9 cites).
  3. Fails when: a cite names an ID no table defines (a ruling written in prose that never became a row); a row is cited by nothing (a verdict the compiler cannot be enforcing); a diagnostic code that a row names as its refusal has no DiagnosticExplanations entry citing that row; a table row's rule ID does not appear in name-resolution.md / type_narrowing.md (the normative text and the table disagree on what rules exist).
  4. Prints the three lists (undefined cites, uncited rows, missing explanation cites) in the check_* scripts' format; exit 1 on any.

Falsifiability (contract §2)

  • Positive control committed with the script: a fixture table + fixture docs under build_tools/tests/ with one of each defect, each producing exactly its line.
  • Mutations in the commit body: delete one row's cite from DiagnosticExplanations → red (1); add N8 to the spec without a row → red (1); add a row with a fresh ID cited nowhere → red (1); restore → green.
  • Inert-fix check: the script must be wired into the CI workflow that runs the other check_* scripts (name the job), not only present in build_tools/.

Done when

Script + tests + CI wiring landed; the first run's three lists are either empty or every entry is on an allowlist row citing an open issue (gap-discovery convention, drained on fix). The initial DiagnosticExplanations backfill (adding the cites) is the one code change this sub-issue carries; it changes no diagnostic text.

Placement

With #2486 at the next /batch-issues; depends on sub-issue 1's table existing (can land with a table of the rules already ruled, before the narrowing table).

Activity

  1. added
    lane:tooling
    reach:probe
    on Nov 8, 2026
  2. antonsynd commented on Nov 8, 2026

    @antonsynd
    OwnerAuthor

    Batching 2026-11-08 @ 10e1c1b — charter docs/process/rounds/remediation-round-2026-09-20-batching.md §3.0, chores band (order 0, one commit, no plan), after the first rule table exists (R-LO a): the cite check has nothing to check until #2487 or #2488 lands. Lane / reach: tooling · probe. Guard: a planted rule ID with no table row → the check fails (mutation recorded). Tracker: #2486.


    Generated by Claude Code

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

    lane:toolingreach:probe

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions