Skip to content

tri kinds drift: the arm's comment names a case the pattern omits - #2876

Merged
gHashTag merged 2 commits into
masterfrom
w728
Aug 29, 2026
Merged

tri kinds drift: the arm's comment names a case the pattern omits#2876
gHashTag merged 2 commits into
masterfrom
w728

Conversation

@gHashTag

@gHashTag gHashTag commented Aug 29, 2026

Copy link
Copy Markdown
Owner

In two passes the same defect was found four times, in four emitters, and every one is a fixed list of node kinds with a case absent:

list missing cost
Verilog test-block statements StmtIf a test that could not fail, reported PASSED
Rust has_body StmtAssign 53 functions emitted as { unimplemented!() }
Rust expr_is_bool ExprFieldAccess !x.flag became (x.flag) == 0, E0308
compound_binop /= x /= 2 emitted as x = 2, three backends

None is a subtle algorithm. Each is one identifier absent from a matches! — and two of the four are findable mechanically, because the comment beside the arm enumerates the cases and the pattern does not match the enumeration:

NodeKind::StmtForRange | NodeKind::StmtWhile | NodeKind::StmtFor => {
    // Control flow in a test block: a `for`/`while`/`if` was dropped

if is in the sentence and not in the pattern. That is a diff, not a judgement.

The command

tri kinds drift reads the comment inside an arm's body, never the one above its pattern — a comment above belongs to the previous arm as often as to this one, and reading it as this arm's claim hits every second arm in the file. That is one of the five tests.

Silent on master, and it says so rather than printing nothing:

0 arm(s) whose comment names a construct the pattern does not cover.

Zero is a result here and not a silence: 57 arms were read and each
one's comment was compared against its own pattern.

Historical control — run against the commit before #2871:

NodeKind::StmtForRange | NodeKind::StmtWhile | NodeKind::StmtFor => {
  comment names : Control flow in a test block: a `for`/`while`/`if` was dropped...
  NOT in pattern: StmtIf

1 arm(s) whose comment names a construct the pattern does not cover.

It finds the defect it was written after, on the commit where that defect still existed.

The word assignment unquoted was in the vocabulary and produced two hits on master, both prose"the declaration was already emitted at the assignment site". A backticked word is a name; the same word in a sentence is not. Requiring the backtick took the false positives to zero and left the control firing.

Skill sections 317–318 land with it: the four-lists table, and why a peer backend is the cheapest oracle this project has — four languages from one source means three oracles per construct, at one command each. Also where that fails: while (c) : (step) was wrong in all four, so no comparison could see it.

Refs #2844, #2871

In two passes the same defect was found four times, in four emitters,
and every one is a fixed list of node kinds with a case absent:

    Verilog test-block statements   StmtIf           a test that could not fail
    Rust has_body                   StmtAssign       53 functions became a stub
    Rust expr_is_bool               ExprFieldAccess  !x.flag became (x.flag)==0
    compound_binop                  /=               x /= 2 became x = 2

None is a subtle algorithm. Each is one identifier absent from a
`matches!`, and two of the four are findable mechanically, because the
comment beside the arm ENUMERATES the cases and the pattern does not
match the enumeration:

    NodeKind::StmtForRange | NodeKind::StmtWhile | NodeKind::StmtFor => {
        // Control flow in a test block: a `for`/`while`/`if` was dropped

`if` is in the sentence and not in the pattern. That is a diff, not a
judgement.

The command reads the comment INSIDE an arm's body, never the one above
its pattern: a comment above belongs to the previous arm as often as to
this one, and reading it as this arm's claim hits every second arm in
the file. That is a test.

Silent on master, and it says so rather than printing nothing: "Zero is
a result here and not a silence: 57 arms were read and each one's
comment was compared against its own pattern."

Historical control: run against the commit before #2871 it reports
exactly one arm, `StmtForRange | StmtWhile | StmtFor` missing `StmtIf` --
the defect it was written after, on the commit where it still existed.

The word `assignment` unquoted was in the vocabulary and produced two
hits on master, both prose. Requiring the backtick took the false
positives to zero and left the control firing.

5 tests. Skill sections 317-318.
@gHashTag
gHashTag enabled auto-merge (squash) August 29, 2026 19:54
@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-29 19:54:21 UTC

Summary

Status Count
Total Open PRs 8
PRs with Failing Checks 8
PRs with All Checks Green 0
READY 0
FAILING 8
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=95f7168a9594 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

The PR body carried no `Refs`, so `check-linked-issue` and
`Check L1 TRACEABILITY` were both red -- law L1 requires every change to
name the issue it belongs to, and I wrote a PR about a detector for
"the comment claims something the code does not" without linking it to
either defect it was written after.

Refs #2844, #2871
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-29 20:00:06 UTC

Summary

Status Count
Total Open PRs 8
PRs with Failing Checks 7
PRs with All Checks Green 1
READY 0
FAILING 7
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=95f7168a9594 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@gHashTag
gHashTag merged commit 73f3a04 into master Aug 29, 2026
25 of 27 checks passed
gHashTag added a commit that referenced this pull request Aug 29, 2026
§317 ended with "That is a five-line script, not an audit -- and it
would have found all four." No such script existed when I wrote that.

Built and measured:

  naive diff of constructed variants against each list
      -> 10 lists of 10 flagged. Almost every list is a legitimate
         subset, so it finds everything, which is finding nothing.

  the same grouped into families (control flow / binding / exit),
  flagging a list that covers PART of a family
      -> 3 of 10, and on the commit before #2875 it points at the exact
         `has_body` line. But all three of its hits on a clean tree are
         correct code: `StmtLocal | StmtAssign` collects NAMED bindings
         and `StmtExpr` has no name; the loop arm at 10979 excludes
         `StmtIf` on purpose.

  two of the four are not NodeKind lists at all: `compound_binop` maps
  operator strings and `expr_is_bool` is a match whose missing arm
  nobody enumerated.

So: 1 of 4, three false positives. `tri kinds drift` also finds 1 of 4
and costs zero false positives, which is why that is the one that
shipped. §317 now carries these numbers instead of the prediction.

319 is the general form. A sentence in the conditional tense, inside a
document whose purpose is to hold measurements, takes authority from the
numbers around it -- and unlike a wrong claim about existing code, it
cannot be checked until somebody builds the thing. Either build it and
write the number, or write "untested" beside it.

Refs #2876
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant