Repository navigation
tri gates preview reads PASS on check-linked-issue for a reference the gate strips from the body #5744
Description
tri gates preview asks the required context check-linked-issue in fn ask_linked_issue (cli/tri/src/gates.rs, as restructured by #5732). It reads the reference pattern out of .github/workflows/issue-gate.yml (fn issue_pattern) and matches it against the pull request's title and body from gh pr view --json title,body.
The gate does not grep the body as written. Its step "Check for linked issues in PR" first runs the body through an awk program (BODY_PROSE=$(printf '%s\n' "${PR_BODY:-}" | awk '...'), added under #3388): it toggles a fence state on lines matching ^[[:space:]]* followed by three backticks and skips fenced lines, and it drops lines matching ^[[:space:]]*>. Only the title and the remaining prose are grepped. So a pull request whose only Closes #N sits inside a code fence or a > quote is refused by the gate and reads PASS in the preview: a false PASS on a required context, which is the reading this command exists to prevent.
A smaller difference of the same kind: the gate's grep reads one line at a time, while the preview's regex runs over the whole text, where \s* crosses a newline. A body with refs at the end of one line and #N at the start of the next is refused by the gate and passes the preview.
Measured 2026-10-03 on PR #5732's head (ad43b60): the gate's own step run with bash (PR_TITLE="feat: x", PR_NUMBER=1), against the preview's matcher (its regex over title + newline + body):
- body = a summary line, then
Closes #1inside a three-backtick fence: gate exit 1, preview PASS - body =
> Closes #1: gate exit 1, preview PASS - body =
This refs/#1on two lines: gate exit 1, preview PASS - body =
Closes #1: gate exit 0, preview PASS (the control)
Wanted:
- the row asks what the gate asks: the title as written, the body through the gate's own awk program (read out of issue-gate.yml at run time and run with the system
awk), each matched one line at a time; - if the program, or the shape around it, cannot be read, the row reads UNAVAILABLE, never PASS;
- tests: a reference only inside a fence and only in a quote do not pass, plain prose still passes, and the program is read out of the real issue-gate.yml.
Not in scope: whether the gate itself should also strip ~~~ fences or four-space indented code. It does not today, and the preview follows the gate.
Original file list
.github/workflows/issue-gate.ymlcli/tri/src/gates.rs
Queen-runnable restatement (2026-10-05)
The fix as asked lives in cli/tri/src/gates.rs (hand-written Rust) and the original boundary names a workflow .yml; under the only-t27 rule (specs/policy/own_language.t27) a bee may edit neither. What a bee can do in t27 is state, in one place, the rule both the gate and the preview must follow, with the measured cases of 2026-10-03 as tests, so a generated or owner-approved preview has a contract to match.
Boundary
specs/policy/linked_issue_prose.t27
User Scenarios & Testing
- Given master has no t27 statement of what
check-linked-issuereads, whenspecs/policy/linked_issue_prose.t27lands, then modulePolicyLinkedIssueProseclassifies each body line as fence marker, fenced, quoted or prose (the gate's awk program: a line matching optional spaces then three backticks toggles the fence; a line starting with optional spaces then>is dropped) and decides PASS only when the title or a prose line carries a reference on that one line. - Given the four measured bodies (reference only inside a fence; only in a
>quote;refsand#1split over two lines; plainCloses #1), when the spec's tests run, then the first three read FAIL and the control reads PASS; and when the gate's program cannot be read the reading is UNAVAILABLE, never PASS.
Requirements
- FR-001: The spec MUST define line-kind codes and
pub fn line_kind(starts_fence: bool, in_fence: bool, starts_quote: bool) -> u8, andpub fn body_passes(...)that counts a reference only on a prose line or the title, one line at a time. - FR-002: The spec MUST define
pub fn preview_reading(program_read: bool, passes: bool) -> u8returning PASS, FAIL or UNAVAILABLE, with UNAVAILABLE whenever the program could not be read. - FR-003: Tests MUST encode the four bodies measured on PR fix(tri): gates preview asks the contexts the ruleset requires, parse-ratchet among them (Closes #5725) #5732's head (ad43b60) with their gate results.
- FR-004: The change MUST NOT add or modify non-t27 hand-written code (specs/policy/own_language.t27);
cli/tri/src/gates.rsand.github/workflows/issue-gate.ymlare not edited.
Success Criteria
grep -c 'module PolicyLinkedIssueProse' specs/policy/linked_issue_prose.t27prints1grep -cE 'pub fn (line_kind|body_passes|preview_reading)\(' specs/policy/linked_issue_prose.t27prints3grep -cE '^[[:space:]]*test ' specs/policy/linked_issue_prose.t27prints at least5t27c spec-status specs/policy/linked_issue_prose.t27printsIMPLEMENTEDt27c test-report specs/policy/linked_issue_prose.t27 2>&1 | grep -c BLOCKEDprints0
Activity
Merge pull request #5745 from gHashTag/fix/preview-linked-issue-prose
gHashTag commentedon Oct 5, 2026
The branch queen-5744 carries cli/tri/src/gates.rs (+260/-10 lines of hand-written Rust: gate_awk_program and a re-implemented awk filter), which cannot land under the only-t27 rule (specs/policy/own_language.t27). A t27 version needs specs/policy/linked_issue_prose.t27: line-kind codes for fence/quoted/prose, body_passes one line at a time, and preview_reading with UNAVAILABLE, tested on the four bodies measured on PR #5732. The issue was restated so a fresh bee can do that part; the branch is not deleted.
fix(tri): gates preview reads the PR body the way the issue gate does (…
Merge pull request #5745 from gHashTag/fix/preview-linked-issue-prose
t27b ledger: specs/policy/linked_issue_prose.t27 is expected to pass (C…
Merge origin/master into spec/linked-issue-prose (Refs gHashTag#5744)
seal: reseal linked_issue_prose with t27c from the merged tree, gen_h…