Skip to content

fix(pr-triage): skip the job for a title or body edit and another label - #264

Merged
bketelsen merged 3 commits into
mainfrom
lucilla/pr-triage-skip-noop-edits
Nov 15, 2026
Merged

bketelsen merged 3 commits into
mainfrom
lucilla/pr-triage-skip-noop-edits

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #237.

The PR triage caller runs on pull_request_target types opened, synchronize, reopened, edited and labeled. Two kinds of event started a runner for no result:

Each such run costs 1 billed minute in a private repository.

The fix is 1 job-level if: in the reusable workflow .github/workflows/pr-triage.yml:

if: ${{ (github.event.action != 'edited' || github.event.changes.base != null) && (github.event.action != 'labeled' || github.event.label.name == 'ready-for-human') }}

In a reusable workflow, github.event is the caller's event. So no caller changes, and the baseline checks of the caller lines in other repositories need no change. Each repository gets the fix when it moves its core SHA pin. A skipped job starts no runner. Its check pr-triage / pr-triage shows as skipped. It is not a required check, and the readiness step already leaves out check runs whose name starts with pr-triage.

Kept: an edited event with a base change (changes.base is in the payload) still runs levels at the new base SHA, as risk-paths rule E needs. opened, synchronize, reopened and labeled with ready-for-human are unchanged. A title edit is skipped too: neither library reads the PR title or body. A new test fails if one starts to.

Docs: docs/specs/pr-triage.md (interface row, a short table, rule A, readiness rules), docs/specs/risk-paths.md rule E, docs/design/pr-triage-rollout.md. ADR-0077 lists the caller's 5 types; the caller still has them, so it stays true.

Risk tier

Risk tier: highest (risk:high, L2).

Matched risk path (.github/risk-paths.json at the base, levelOfFile):

Path Level Glob Why it is safe
.github/workflows/pr-triage.yml L2 .github/workflows/** 1 added if: line on the job, plus 4 comment lines. No permission, token, action, trigger, step or embedded library changes (npm run sync:risk-paths-workflow: already in sync). The condition only skips events; it never runs the job on an event that ran no job before. It reads only the caller's event payload, no PR head content.

The other 4 files are at L3 (default).

Docs housekeeping

  • Specs changed with the code that implements them; design doc updated in place.
  • No new doc, no new ADR (the specs record the contract change).

Verification

  • make ci green locally: 953 tests pass at the head, docs, corrections and risk-paths gates ok.
  • Workflow changed: no new action; every action stays SHA-pinned; permissions: {} unchanged.
  • Tests in test/pr-triage.test.mjs:
    • A small evaluator for the GitHub expression subset that the workflow uses (GitHub's truthiness and == coercion rules; any unknown token or function throws), with its own unit test.
    • "the job if: skips a title or body edit and a label other than ready-for-human": each of the 4 expected conditions (job, levels, readiness, Dependabot shadow) must be in the workflow as 1 exact line; the test evaluates them over 9 events × 2 authors × 2 dependabot-shadow values. The job runs exactly when some step would run and the event is not a title or body edit. Named cases: body-only edit, title-only edit and labeled documentation skip; base edit runs levels; labeled ready-for-human runs readiness. It does not claim that the workflow has no other condition.
    • "no step reads the PR title, the PR body or the event changes, so the job can skip those events": a behavioral guard. Each step (levels on opened, synchronize and a base edit; readiness on synchronize and labeled; shadow) runs on an event wrapped in a Proxy that records reads of pull_request.title, pull_request.body and event.changes (get, in, descriptor and enumeration), after its expected outcome is asserted. A self-test shows that computed, destructured, in and spread reads are recorded. Checked on purpose: a destructured body read added to runReadinessStep in a scratch worktree makes this test fail.
    • The existing job-header test now expects the exact if: line.
  • Correction record: .memory/corrections/2026-11-15-pr-264-behavioral-field-guard.json (the cross-review findings below; check-corrections: 56 records ok).
  • Revert test: scratch worktree at origin/main (workflow without the fix) with the new test file, node --test test/pr-triage.test.mjs: 2 fail on assertions, "the workflow has the input, the job, the permissions and no checkout" and "the job if: skips a title or body edit and a label other than ready-for-human" (at "the workflow has the line if: ${{ (github.event.action != 'edited' ... }}").
  • make ci at head 33da635: 953 tests pass.
  • Not tested: a live run on GitHub. The evaluator models GitHub's documented expression rules, not the runner itself. Core's own caller runs the workflow from the base branch (pull_request_target), so this PR still runs the old job; the first live skip shows on a body edit of a core PR after this merges.

Cross-review

Reviewer openai/gpt-6.1-sol; coder deepseek/deepseek-flash (primary), with edits by anthropic/claude-opus-5-5. Base cc6caf0bf37c0772bdd58654dd2d9825d2fc8371.

Round Head Result Action
Review a12c225 Not ready: 2 blocking (medium). The library guard was a source regex that missed pr["body"], const { body } = pr and event["changes"]; the if: extraction read YAML by indentation with no input-shape cases. Workflow condition and docs confirmed correct. Agreed. Behavioral Proxy guard; exact conditions as constants; correction record.
Re-review 1 dc6354c Not ready: 1 blocking (medium). The closed list of if: lines missed an escaped key ("\u0069f":), so its fail-closed claim was false. Guard finding resolved. Agreed. Narrowed the claim (AGENTS.md: 2nd gap in the same reader): exact-line presence only, no completeness claim; record updated.
Re-review 2 33da635 Ready, no findings, Blocking: none. —

The reviewer ran no tests (read-only); the test results above are the author's.

The caller runs on edited and labeled. An edited event that changes only the title or the body, and a labeled event with a label other than ready-for-human, change no triage result, but each started a runner and cost 1 billed minute in a private repository. A job-level if: in the reusable workflow now skips both, so no caller changes. An edited event with a base change still runs the levels step at the new base SHA.

Closes #237.
@github-actions github-actions Bot added level:L2 Read the diff risk:high Touches a path in .github/risk-paths.json labels Nov 15, 2026
…lines exactly

The source-regex guard missed bracket and destructured reads. Each step now runs on an event wrapped in a Proxy that records reads of pull_request.title, pull_request.body and event.changes. The matrix test evaluates the expected conditions, and a closed list matches the 5 if: lines of the workflow exactly, instead of a reader by indentation.
…eteness

A line scan of YAML cannot prove that the workflow has no other condition (an escaped key decodes to if). The test now checks that each of the 4 expected conditions is in the workflow as 1 exact line, and evaluates them; the behavioral guard checks what the steps read.
@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 15, 2026
@bketelsen
bketelsen added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 6c4aa17 Nov 15, 2026
6 checks passed
@bketelsen
bketelsen deleted the lucilla/pr-triage-skip-noop-edits branch November 15, 2026 20:46
This was referenced Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L2 Read the diff ready-for-human Reviewed, CI green: ready for Brian to review and merge risk:high Touches a path in .github/risk-paths.json

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pr-triage: the caller runs a job for every edited event, also when only the title or body changed

2 participants