Skip to content

fix(conformance): stop reading header comments as receipt-key instantiations - #878

Open
gHashTag wants to merge 2 commits into
mainfrom
fix/receipt-key-comments
Open

gHashTag wants to merge 2 commits into
mainfrom
fix/receipt-key-comments

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Closes #877. Part of #851.

What was red, and why

On main, receipt-keys in trinet-portability.yml has failed on all 7 scheduled runs from 2026-09-28 to 2026-10-04. It reports two keyless instantiations of trinet_node_core in formal/tern_tc_layer_rtl_tb.v, at lines 7 and 18. Both lines are header comments that name the file fpga/portable/trinet_node_core.v. The real instantiation is at line 42, and it passes .RECEIPT_KEY(128'h0).

conformance/key_default_check.py matched module names in the raw source. This PR blanks comments and string literals before matching, keeping newlines so the reported line numbers are unchanged. The same change closes the reverse hole: a key written only in a comment inside #( … ) used to count as passed.

Measured

Every mutant ran on a copy of main's tree (57de4a1f5, 4,166 input files), in-process, on both checkers.

mutant must old checker new checker
none pass rc 1, RULE 2 at :7 and :18 rc 0, 3 instantiations
tern_tc bench drops its key fail rc 1, 3 RULE lines rc 1, one RULE 2 at :42
tern_tc key only in a comment fail rc 1, but only :7 and :18, nothing at :42 rc 1, one RULE 2 at :42
v2 bench drops its key (the workflow's own mutant) fail rc 1, 3 RULE lines rc 1, one RULE 2
non-null default (the workflow's own mutant) fail rc 1, 3 RULE lines rc 1, one RULE 1
non-null default only in a comment pass rc 1 rc 0
$display("trinet_node_core up") in the bench pass rc 1 rc 0

Old: 0 of 7 right. New: 7 of 7.

The new CI step covers the comment case. It finds the bench's instantiation line with grep rather than hard-coding 42. It checks that the mutation applied, then requires exactly one RULE 2, on that line.

The guard step mutates formal/tern_tc_layer_rtl_tb.v, so that bench is now in both paths: lists (e1b3d0a). Without it the Workflow path gate failed this PR with "BUILT BUT NOT WATCHED". The bench is the one file the new step names, and nothing more is widened here.

The new step's shell ran on Linux in this PR's own runs: receipt-keys passed, and step 7, "The guard must reject a key that is only in a comment", succeeded (job 111539931868, at 94bf141).

Not in this PR

🤖 Generated with Claude Code

…iations

key_default_check.py matched module names in raw source. The header of
formal/tern_tc_layer_rtl_tb.v names fpga/portable/trinet_node_core.v
twice, and the check read both as instantiations without a key, so
receipt-keys has been red on every scheduled run on main since
2026-09-28. The real instantiation, line 42, passes .RECEIPT_KEY(128'h0).

Blank comments and string literals before matching, keeping newlines so
line numbers still point into the file. This also closes the reverse
hole: a key written only in a comment inside #( ... ) was accepted as
passed.

Mutants, run on a copy of main's tree in-process:

  mutant                                     old checker   new checker
  clean tree (must pass)                     rc 1, 2 RULE  rc 0
  tern_tc bench drops its key                3 RULE        1 RULE, :42
  tern_tc key only in a comment              2 RULE, not   1 RULE, :42
                                             at :42
  v2 bench drops its key (workflow mutant)   3 RULE        1 RULE
  non-null default (workflow mutant)         3 RULE        1 RULE 1
  non-null default only in a comment (pass)  rc 1          rc 0
  module name in a $display string (pass)    rc 1          rc 0

Add a guard step for the comment case. It looks up the bench's
instantiation line instead of hard-coding 42, and requires exactly one
RULE 2 there.

Closes #877

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

X Brain Health Check

Score: 100.0/100
Status: 🟢 HEALTHY
Threshold: 80/100

X Brain is above merge threshold

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

🧪 Brain Stress Test Results

Score: not measured (no stress test prints a Score: line)
Status: 🟢 PASS
Threshold: 270/300

X Stress test passed

The new guard step reads and mutates formal/tern_tc_layer_rtl_tb.v, but
the workflow's paths: lists did not name it, so the Workflow path gate
(research/audit_workflow_paths.py) failed this PR with "BUILT BUT NOT
WATCHED". Add it to both the push and pull_request lists.

The comment sits on its own line: the gate's paths parser keeps a
trailing "# ..." as part of the entry and then reports it as a dead path.

Part of #877.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmitrii-f-t27
dmitrii-f-t27 force-pushed the fix/receipt-key-comments branch from e1b3d0a to b40cbbf Compare October 10, 2026 00:42
@tri-claw

tri-claw Bot commented Oct 10, 2026

Copy link
Copy Markdown

Summary by t27-bees

The PR fixes a false positive in conformance/key_default_check.py where header comments naming a module were mistaken for instantiations. It adds a code_only() filter that blanks comments and string literals while preserving newlines, so line numbers stay accurate. A new CI guard step verifies that a key written only in a comment is rejected and the error points at the real instantiation.

Worth a look

  • conformance/key_default_check.py:38 — CODE_ONLY_RE uses ordered alternation (// then /* */ then strings). This works because each alternative starts with a distinct character, but a // inside a /* */ comment is handled correctly (non-greedy .*? stops at first */). No issue found in the diff.

  • conformance/key_default_check.py:45–48 — code_only() replaces every non-newline character in a match with a space. This preserves line counts but changes column positions; the line-number calculation src.count("\n", 0, m.start()) + 1 (unchanged, line 83) still works because newlines are kept.

  • conformance/key_default_check.py:75 — The instantiation regex \b + re.escape(name) + \s*(#\s*\()? matches name #( or name at word boundaries. After comment blanking, false matches in comments are gone. The pattern assumes the module name isn't a prefix of another identifier (e.g., trinet_node_core_extra); \b protects against that.

  • .github/workflows/trinet-portability.yml:102 — sed mutation comments out all .RECEIPT_KEY(128'h0) occurrences. The preceding grep check (line 96) ensures exactly one trinet_node_core #( line exists, so multiple keys would imply multiple instantiations and the check would fail earlier. Acceptable for this bench.

  • .github/workflows/trinet-portability.yml:108 — The check grep -q "RULE 2 $tb:$inst_line:" expects the checker's exact output format (RULE 2 file:line:). If the checker's message spacing changes, this guard will break loudly (which is correct behavior).


Read: 2 files, +50 -2, the whole diff. Head b40cbbf. Model: openai-compatible/nvidia/nemotron-3-ultra-550b-a55b. Commands: @t27-bees review | summary | help | pause | resume. Free for every repository.

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.

receipt-keys gate red on main since 2026-09-28: header comments read as keyless instantiations

1 participant