Skip to content

Turn drafter-core PR rules off unless CATSTACK_DRAFTER_CORE=1 - #742

Open
EdbertChan wants to merge 2 commits into
mainfrom
stack/EdbertChan/drafter-core-flag-readme/turn-drafter-core-pr-rules-off-unless-catstack--3014f5c0
Open

EdbertChan wants to merge 2 commits into
mainfrom
stack/EdbertChan/drafter-core-flag-readme/turn-drafter-core-pr-rules-off-unless-catstack--3014f5c0

Conversation

@EdbertChan

@EdbertChan EdbertChan commented Sep 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

The PR drafting tools now skip the outside PR rule package unless a new setting turns it on. When skipped, they print a clear "unchecked" line.

The repo's own summary checks still run. The template tool stops with an "unchecked" exit so nobody mistakes an empty template for a real one.

Review Claim

With the new setting off, the PR drafting tools skip the outside rule package and say so, and turn it back on when the setting is on.

Review Lane

behavior

Review Unit

engine-runtime

Safety Invariant

With CATSTACK_DRAFTER_CORE=1 every script runs the same drafter-core rules as before; with it off, no check reports clean for rules it skipped.

Slice Rationale

The flag and every script that reads it change together, so the setting means one thing. The README flag row is its own docs PR stacked on this one.

Non-goals

  • Does not remove drafter-core from package.json or CI.
  • Does not change preflight.py review-unit rules, which read drafter.config.json directly.
  • Does not change the preflight parity test, which still calls drafter-core.

Test Plan

Test Plan
  • New tests fail on the old scripts: python3 -m unittest -k flag_off engine/skills/draft-pr/tests/test_draft_pr_scripts.py tests/test_validate_pr_body_local.py → FAILED (failures=3)
  • Same files with the change, plus preflight tests: Ran 60 tests ... OK
  • bash scripts/test/run_all_tests.sh → exit 0, no FAILED lines
  • Flag off by hand: lint-diff-atomicity.mjs prints UNCHECKED: drafter-core rules skipped (CATSTACK_DRAFTER_CORE is off; ...) exit 0; pr-body-template.mjs same line, exit 3
  • Flag on by hand: Diff atomicity validation passed. exit 0; template prints ## Summary exit 0
  • python3 engine/skills/make-pr/scripts/preflight.py --base origin/main --body-file <this body>

Revert Plan

Revert Plan
  • Safe to revert? Yes
  • Revert command: git revert <sha>
  • Post-revert steps: None
  • Data migration? No

🤖 Generated with Claude Code


Note

Medium Risk
Changes when PR bodies and diff atomicity are enforced locally; misconfiguration could skip drafter-core schema checks while local summary rules still fail or pass, so reviewers should know the flag defaults off.

Overview
Draft PR tooling now treats @neko-catpital-labs/drafter-core as opt-in in catstack. Unless CATSTACK_DRAFTER_CORE=1 (same env lookup as other catstack flags via drafter-core-flag.mjs → flags.py), validate-pr-body.mjs, lint-diff-atomicity.mjs, and pr-body-template.mjs skip the package, log UNCHECKED: drafter-core rules skipped, and avoid implying a clean bill of health for rules they did not run.

Local checks still apply when the flag is off. validate-pr-body.mjs keeps summary reading grade, word cap, and code-name checks; pr-body-template.mjs exits 3 when core is skipped; lint-diff-atomicity.mjs exits 0 after printing the skip line. validate-pr-body-local.mjs maps a successful validator run that printed the skip message to exit 3, matching “rules not fully checked.”

Docs and tests cover the default-off behavior (.env.example, draft-pr/SKILL.md, draft-pr script tests, preflight parity expectations, local validator tests).

Reviewed by Cursor Bugbot for commit 8099af0. Bugbot is set up for automated code reviews on this repo. Configure here.

@EdbertChan

Copy link
Copy Markdown
Owner Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 Turn drafter-core PR rules off unless CATSTACK_DRAFTER_CORE=1 #742 👈
2 README: list the CATSTACK_DRAFTER_CORE flag #743

mergify Bot pushed a commit that referenced this pull request Sep 23, 2026
* pr-schema-gate: find the validator in catstack, report UNCHECKED when a repo has none

Scope now comes from the .git boundary, not scripts/create-pr.mjs. The
validator is scripts/validate-pr-body.mjs, then
engine/skills/draft-pr/scripts/validate-pr-body.mjs. A PR-publishing
command in a git repo with neither reports UNCHECKED instead of staying
silent.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* invoker: wf-1790182316514-5/implement-hook-finds-catstack-checker — Review claim: pr-schema-gate checks PR descriptions in a repo whose validator lives at engine/skills/draft-pr/scripts/validate-pr-body.mjs, and reports UNCHECKED instead of staying silent when a PR-publishing command runs in a repo where no validator can be found.
Review lane: behavior
Safety invariant: The change can only add a failure or an UNCHECKED notice; a PR description that passes engine/skills/draft-pr/scripts/validate-pr-body.mjs today is never newly blocked.
Effectiveness measurement: Hook tests replay the three commands that stayed silent in the incident: `mergify stack push` in a catstack-shaped repo (fires or UNCHECKED, never silent), `gh pr create --body-file <body failing the validator>` in a catstack-shaped repo (fires with the validator's errors), and a passing body in the same repo (clean). The existing Invoker-shaped cases keep their current results.
Slice rationale: One hook, one claim: where the hook looks for the validator and what it says when it finds none.
Architectural effect: pr-schema-gate stops depending on scripts/create-pr.mjs to decide whether a repo is in scope.
Goal: Make the PR-description guard fire in catstack.
Motivation: A reflect pass found PR descriptions on catstack PRs #780-#789, #793 and #795 failing the required PR Body check after publication, and the user had to ask for a manual fix of every PR. In catstack the guard stayed silent: fed `mergify stack push` and `gh pr create --body-file <failing body>` it exited 0 with no output, while the same stack push in the Invoker checkout fired. Read at origin/main: engine/hooks/pr-schema-gate/detect.py scopes itself by walking up for scripts/create-pr.mjs (repo_root_with_create_pr_tool) and expects the validator at scripts/validate-pr-body.mjs (VALIDATOR_RELATIVE_PATH); catstack has neither.
Alternative considerations: Adding a scripts/create-pr.mjs shim to catstack was set aside because it makes scope depend on an unrelated file again. Copying the validator to scripts/ was set aside because there are already too many copies.
Implementation details: In engine/hooks/pr-schema-gate/detect.py, find the repo root from the .git boundary, then look for the validator in a short ordered list: scripts/validate-pr-body.mjs, then engine/skills/draft-pr/scripts/validate-pr-body.mjs. A repo with either is in scope. When a PR-publishing command (gh pr create/edit with a body, gh api PATCH on pulls with a body, mergify stack push) runs in a git repo where no validator is found, return the existing unchecked outcome with a one-line reason instead of None. Keep the existing hit / clean / unchecked outcomes and messages for Invoker-shaped repos unchanged.
Non-goals: No change to the validator, preflight, install.sh, or any other hook. Do not edit engine/skills/draft-pr/scripts/validate-pr-body.mjs, scripts/pr/validate-pr-body-local.mjs, or any other file open PR #742 changes; call the validator as it is. If a change would overlap an open PR, stop and report instead.
Layer: domain
Feature state: active
Files:
- engine/hooks/pr-schema-gate/detect.py
- engine/hooks/pr-schema-gate/tests/test_hooks.py
- engine/hooks/pr-schema-gate/README.md
Change types:
- engine/hooks/pr-schema-gate/detect.py: modify
- engine/hooks/pr-schema-gate/tests/test_hooks.py: modify
- engine/hooks/pr-schema-gate/README.md: modify
Acceptance criteria:
- `python3 -m unittest discover -s engine/hooks/pr-schema-gate/tests -v` exits 0.
- `python3 scripts/check_hook_test_coverage.py` exits 0.
- `python3 scripts/check_no_silent_hook_except.py` exits 0.
- `python3 scripts/check_no_new_comments.py` exits 0.

Exit code: 0

* invoker: wf-1790182316514-5/verify-hook-finds-catstack-checker-3 — Review claim: `python3 scripts/check_no_silent_hook_except.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_no_silent_hook_except.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 0

* invoker: wf-1790182316514-5/verify-hook-finds-catstack-checker-1 — Review claim: `python3 -m unittest discover -s engine/hooks/pr-schema-gate/tests -v` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 -m unittest discover -s engine/hooks/pr-schema-gate/tests -v`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 0

* invoker: wf-1790182316514-5/verify-hook-finds-catstack-checker-4 — Review claim: `python3 scripts/check_no_new_comments.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_no_new_comments.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 1

* invoker: wf-1790182316514-5/verify-hook-finds-catstack-checker-2 — Review claim: `python3 scripts/check_hook_test_coverage.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_hook_test_coverage.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 1

* invoker: wf-1790182316514-5/verify-hook-finds-catstack-checker-2 — Review claim: `python3 scripts/check_hook_test_coverage.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_hook_test_coverage.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 1

* invoker: wf-1790182316514-5/verify-hook-finds-catstack-checker-4 — Review claim: `python3 scripts/check_no_new_comments.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_no_new_comments.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 1

* invoker: wf-1790182316514-5/verify-hook-finds-catstack-checker-2 — Review claim: `python3 scripts/check_hook_test_coverage.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_hook_test_coverage.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Solution:
  Review claim: `python3 scripts/check_hook_test_coverage.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_hook_test_coverage.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

* invoker: wf-1790182316514-5/verify-hook-finds-catstack-checker-4 — Review claim: `python3 scripts/check_no_new_comments.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_no_new_comments.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Solution:
  Review claim: `python3 scripts/check_no_new_comments.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_no_new_comments.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

* invoker: wf-1790182316514-5/verify-hook-finds-catstack-checker-2 — Review claim: `python3 scripts/check_hook_test_coverage.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_hook_test_coverage.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 0

* invoker: wf-1790182316514-5/verify-hook-finds-catstack-checker-4 — Review claim: `python3 scripts/check_no_new_comments.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_no_new_comments.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 0

* invoker: wf-1790182316514-5/scrub-handoff-artifacts — Review claim: No ephemeral inter-task handoff files remain in the worktree before the merge gate.
Review lane: cleanup
Safety invariant: The scrub script only checks for known handoff artifact names and never touches source, tests, or other repository files.
Effectiveness measurement: The script exits non-zero if any handoff artifact remains.
Slice rationale: Required terminal scrub for every implementation workflow.
Architectural effect: None; hygiene only.
Goal: Leave the branch free of handoff artifacts.
Motivation: Handoff files must not reach the PR.
Alternative considerations: Manual cleanup was set aside as non-deterministic.
Implementation details: Run scripts/scrub-handoff-artifacts.sh.
Non-goals: No product edits.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 0

* wrong-check-reflect: one shot per reply, and scope the reflect scan to the turn (#796)

* wrong-check-reflect: one shot per reply, and scope the reflect scan to the turn

Two independent lockouts kept this hook from speaking on Claude Code.

One: `already_prompted` was keyed on the transcript path, so the Stop of the
reply BEFORE a correction spent the session's single shot. The correction
itself then hit an already-prompted key. The key is now the transcript path
plus a hash of the reply text, so each distinct reply gets its own chance and
the same reply is still judged only once.

Two: `user_already_asked_reflect` scanned the whole transcript. One `/reflect`
typed at the start of a session switched the detector off for every later
reply. The scan is now scoped to the user messages of the turn that produced
the reply being judged, which is the case the skip was written for.

An unreadable transcript now says so on stderr instead of silently reading as
"the user did not ask".

The harness-parity test asserts the same reply is judged under both `Stop` and
`stop`. It passes before this change too: this hook compares no event name
anywhere, so event-name case cannot be what split its hits by harness. The
test pins that, rather than leaving the parity unstated.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Change-Id: Idb90d55fa90496fcab44e1f0255b303b5cf0b514

Three: the suppression matched any prose containing the word. A sentence
ABOUT the hook switched the hook off. `"Claim I made was wrong" is a trigger
for /reflect` describes when the detector fires; it asks for nothing, and
nothing is in flight to avoid duplicating. It now matches the harness's own
record of an invocation, the `<command-name>/reflect</command-name>` envelope.
That envelope starts with `<command-`, which the meta filter drops, so the one
unambiguous signal was being discarded while vague prose was kept; the window
now includes meta rows for this check.

Four: a missing assistant row no longer reads as "no request found". A Stop
payload can carry the reply before its row lands, and a session's first turn
has none at all; in both cases every row belongs to this turn, and bailing out
meant a real request went unhonoured.

tests/scenarios/self-correction.json: the scenario pinning this said the user
"already asked for /reflect" while its user field only mentioned the word --
its stated intent and its data disagreed. The request case now uses a real
invocation; the mention case is its own scenario and must still fire. Both
were folded into this commit rather than a later one so no commit in the stack
leaves the scenario suite red.

Erring toward asking is the safe direction: this detector recorded 1,682
Claude Code invocations and spoke 0 times.

  Ran 27 tests in 18.811s  OK   (wrong-check-reflect)
  Ran  6 tests in  0.098s  OK   (scenario suite)

Change-Id: I60c5103d0541efd34f49e2401d50f4c5e312ddf0

* wrong-check-reflect: anchor the reflect scan on the person's message, not the last assistant row

The same-turn /reflect skip read the wrong turn. It took the last
text-bearing assistant row as the reply under judgment and scanned only
back to the assistant row before it.

A Stop payload carries the reply before its transcript row is written, so
that "last assistant row" was usually the previous turn's reply. The
window then sat one turn behind: a /reflect from the turn before
suppressed this reply (the session lockout, one turn wide), and the
/reflect the person had just typed sat past the window and was ignored, so
the hook nagged for a reflect already in flight. A turn also writes more
than one assistant row -- mid-turn narration, a subagent's sidechain rows
-- and each one pushed the window's start past the message that opened
the turn.

The window now runs from the person's own last message to the end of the
file, so it does not depend on assistant rows at all. A typed slash
command counts as that message, so <command-name> leaves the harness
prefix list; <local-command stdout, which is harness echo, joins it.

Four tests, each failing before this change: reflect this turn before the
reply row lands, last turn's reflect while the reply is still being
written, mid-turn narration, and a subagent's rows.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* invoker: wf-1790174651006-232/repair — Resolve bot review thread on PR #796

Exit code: 0

* wrong-check-reflect: drop the banned code comment, keep the why in the README

scripts/ci/check_no_new_comments.py fails the test job on the three comment
lines this branch added above META_USER_PREFIXES. The point they made -- a
typed slash command is the person, not harness text -- now sits in the hook's
README next to the harness-rows paragraph it belongs with.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* draft-pr: pin that a changed file's stem is a code name even when it reads like English

The PR body validator failed this branch on "self-correction" in the Summary,
because tests/scenarios/self-correction.json is a changed file. The suite
covered changed folder names and plain hyphenated English separately, but not
the overlap, which is what a person hits: an everyday phrase that happens to
be a file's name. Both directions are now tested -- it fails, and the
reworded Summary passes with the same changed files.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* invoker: wf-1790175683747-249/repair — Repair PR #796 (failed check validate)

Exit code: 0

* wrong-check-reflect: a tool result is not the person opening a turn

Claude Code files every tool result as a `type: "user"` row, and unlike
its other injections it marks that row with neither `isMeta` nor
`isSidechain`. The turn window anchors on the newest real user row, so
the first tool call of a turn became the anchor: a `/reflect` typed at
the top of the turn fell outside the window and the hook nagged for a
reflect already asked for. A tool result quoting the word the other way
round could also suppress the nudge.

`_is_tool_result_line` reads the record the harness does write -- a
`tool_result` content block, or the `toolUseResult` field beside the
message -- the same way `engine/hooks/agent-relay-attribution/detect.py`
does, and `_is_meta_line` now files those rows under the harness rather
than the person.

Two tests: a tool result mid-turn no longer hides the turn's own
`/reflect`, and `/reflect` printed inside a grep result does not count
as a request. Both fail without the detect.py change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* invoker: wf-1790177409884-260/repair — Resolve bot review thread on PR #796

Exit code: 0

---------

Co-authored-by: CI Bot <ci@invoker.dev>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

* prove-it-ship-gate: the user's machine is a live surface, a PR link is not proof (#779)

* Make the done-gate the real path, not the layers under it

cat-mode's two e2e bullets were deleted in #68 as a duplicate of the
global Named constraints text. That text is narrower: it fires on
"UI/layout work" or on a test the user asked for. Work that was neither
-- an agent running a CI Playwright shard on the user's own Mac and
opening Electron windows on their desktop -- had no trigger left, and a
"Shipped" claim went out with no end-to-end run behind it.

Restore the gate in a form that names the surface rather than the kind
of work: any surface the repo's fixtures cannot stand in for, including
the user's own machine, session, or screen. Add the clause that failed
hardest in the incident -- "I chose not to run it" is not a blocker --
and make "admit what was not exercised" an enumeration against the
done-gate instead of a recollection.

The full text and the end-to-end argument it rests on (Saltzer, Reed &
Clark, ACM TOCS 2(4) 1984) live in the reference; SKILL.md keeps every
trigger condition, because a pointer narrower than the text it replaces
is exactly what failed here. Four tests pin the surfaces, the
not-a-blocker clause, the enumeration, and the citation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Change-Id: Ie690ba84bc28698b6e528c9598479e1d541633ec

* Count the user's own machine as a live surface, and a PR link as no proof

Replayed against this gate unchanged, both of the incident's own ship
messages return SILENT. Two defects stack, and either one alone keeps
them silent.

The live-noun list held only external services, so "the popups are
stopped on your machine" matched nothing and the gate returned before it
ever looked at evidence. Add the surfaces an agent can disturb without
leaving the desk: the user's machine, Mac, laptop, desktop, screen or
session, plus end-to-end, e2e, Playwright, Electron and popup.

The evidence scan then accepted any URL, so the two links to this
change's own pull requests discharged the gate -- while the gate's own
block text already said the PR number of this change does not prove the
live path ran. Blank a pull-request link's span before the scan, so the
two agree. Only that span: a sha, an exit code, or a fenced block beside
the link still counts, and an Actions-run URL is still a receipt.

Both incident messages are fixtures, verbatim. The negatives keep the
near neighbours silent: a mention with no claim, a link beside a real
sha, an Actions-run URL, and the follow-up message that pasted the
suite's own output.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Change-Id: I3a816e04b2241f38ba7069f61176807bbf50b1fc

* Stop the end-to-end idiom from counting as a live surface

The gate needs two parts within 240 characters: a ship claim and a live
noun. Listing bare `end-to-end` and `e2e` as live nouns broke that, because
`working end-to-end` and `confirmed end-to-end` are already claim phrases --
so the claim always sat on top of a live noun and the two parts collapsed
into one. "Done. The parser now works end-to-end" was blocked for showing no
live evidence it never needed.

Drop the bare idiom. It says how a check ran, not where. The surface in the
incident was the desktop the windows opened on, and `your machine`, `your
Mac`, playwright, electron and popup already name it -- every incident
fixture still fires on one of those, and `end to end on your laptop` still
fires on the laptop.

Two tests pin it: the idiom-only messages stay silent, and no claim phrase
may consist entirely of live nouns.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* invoker: wf-1790174635085-231/repair — Resolve bot review thread on PR #779

Exit code: 0

* Keep the end-to-end rationale out of code comments

The no-comments CI twin fails any diff that adds `#` comment lines to a
code file. The two blocks explaining why bare "end-to-end" and "e2e" are
not live nouns went in as plain comments, so the test job's last step
failed with "10 new comment line(s)".

Move the detect.py rationale into the module docstring, which the
detector skips by design (engine/hooks/no-comments/detect.py), and drop
the test-file comment: test_silent_when_only_the_idiom_names_the_surface
already carries the same reasoning in its own docstring. No behaviour
change -- LIVE_NOUN_RE and every fixture are untouched.

The gate is its own repro:
  python3 scripts/ci/check_no_new_comments.py --base origin/reflect/done-gate-real-path
before: fail  10 new comment line(s) ... (exit 1)
after:  ok      no new comments        (exit 0)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* invoker: wf-1790177084312-254/repair — Repair PR #779 (failed check test)

Exit code: 0

* invoker: wf-1790182337423-299/repair — Repair PR #779 (failed check validate)

Exit code: 0

* prove-it-ship-gate: let a qualifier sit between the possessive and the surface noun

The local-surface pattern required the noun to sit immediately after
`your`, `their`, or `the user's`, so `your own machine` and `the
user's own screen` never matched. That is the exact wording the block
message, the README, and the skill all use, which meant the gate stayed
silent on a done-claim phrased the way the gate itself recommends: same
sentence, one extra word, opposite verdict.

The noun scan now accepts one optional qualifier (own, real, actual,
personal, local) after the possessive. Tests cover each qualifier and
assert the block message's own phrasing trips the scan, so the gate can
never again describe a surface it cannot detect.

* invoker: wf-1790184149094-309/repair — Resolve bot review thread on PR #779

Exit code: 0

---------

Co-authored-by: Edbert Chan <chanedbert@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: CI Bot <ci@invoker.dev>

* llm-judge: leave out a runner that cannot answer (#799)

* llm-judge: leave a runner that cannot answer out of the table for 6 hours

A runner that is not installed or exits non-zero is skipped by later
asks until the window ends. Timeouts and non-JSON replies do not count.
If every runner is skipped the whole table is tried, and an answer
clears the marker.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Change-Id: I9db64c4f2d23e801a3f0b7ca729f39fca7e6adaf

* draft-pr: pin the Review Claim half of the code-name check

CODE_NAME_SECTIONS covers Summary and Review Claim, but every code-name
test edited the Summary, so nothing exercised Review Claim. PR #799's
validate job failed there: "A judge runner that cannot answer ..." names
judge.py, a changed file, even though it reads as plain English.

Add both directions on a Review Claim -- the stem fails and names itself,
and the reworded claim passes -- so a later change cannot quietly exempt
file stems that happen to be English words.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* invoker: wf-1790179585073-282/repair — Repair PR #799 (failed check validate)

Exit code: 0

* draft-pr tests: name the fixture instead of commenting it

The no-comments CI gate rejected the `# A changed-file list whose stem
("judge") is also an ordinary English word.` line added above JUDGE_FILES.
Comments are banned in code in this repo, so the note moves into the
constant's own name: FILES_WHOSE_STEM_IS_AN_ORDINARY_ENGLISH_WORD. The
two tests that use it read the same, and the test that needed the note
already states the reasoning in its docstring, which the gate allows.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* invoker: wf-1790182343006-301/repair — Repair PR #799 (failed check test)

Exit code: 0

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: CI Bot <ci@example.com>
Co-authored-by: CI Bot <ci@invoker.dev>

* pr-schema-gate: a skipped sub-check is not a vacuous pass

A PR body the repo's validator accepted was reported to the agent as
"could not check", and an owed stack follow-up stayed armed.

The hook treats exit 0 alongside an UNCHECKED/SKIPPED/not-installed line
as a vacuous pass, so the validator gets no credit for a run that never
judged the body. The catstack validator prints exactly such a line for a
sub-check it skipped -- "Summary reading grade unchecked: Summary has N
words; under 30 the score is too noisy to trust" -- while still accepting
the body and exiting 0. Every accepted body with a short Summary was
therefore reported unchecked.

check_body_file now lifts the vacuous reading when the run states its own
verdict on the body (VALIDATOR_PASS_VERDICT_RE, "PR body validation
passed"). Only a pass verdict counts, so a "failed" banner beside exit 0
stays unchecked. The scan also reads the whole output rather than the
first VALIDATOR_OUTPUT_MAX_LINES: truncation shortens what the agent is
shown, never what is judged.

Two tests in tests/test_advisory.py drive a stub validator with the
catstack shape (skip note on stderr, verdict on stdout, exit 0): one
asserts the write is silent, one asserts it clears the pending follow-up.
Both fail before this change. test_validator_exit_zero_with_an_unchecked_
line_is_not_clean still passes, so the guard against a validator that
really did not run is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* invoker: wf-1790193889047-345/repair — Resolve bot review thread on PR #840

Exit code: 0

* draft-pr tests: pin the changed-folder-name half of the code-name check

PR #840's own body gate failed on `Review Claim: "draft-pr" (changed
folder name)`, and no test covered that kind. Every existing code-name
test uses a changed *file* stem, so deleting the folder loop in
changedFileNames kept the whole suite green.

Adds the real failing Review Claim as a repro plus its reworded,
passing twin. Removing `for (const folder of parts) add(folder,
'changed folder name')` now fails the new test with `0 != 1`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* invoker: wf-1790200429814-416/repair — Repair PR #840 (failed check validate)

Exit code: 0

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: CI Bot <ci@invoker.dev>
Co-authored-by: Edbert Chan <chanedbert@gmail.com>
Co-authored-by: CI Bot <ci@example.com>
mergify Bot pushed a commit that referenced this pull request Sep 24, 2026
…841)

* make-pr: preflight runs the PR-body validator on --body-file

description_check only read the description's prose for claims about the
repo's past, so preflight printed "ok preflight passed" for a body the
required PR Body check then rejected after publication (#780-#789, #793,
#795). describe() now also runs
engine/skills/draft-pr/scripts/validate-pr-body.mjs on the same file and
prints its errors under the gate line.

Exit 1 from the validator fails preflight. No node, a missing validator,
a timeout, or any other exit code prints "description unchecked: ..." and
fails too -- a check that could not run is not a pass.

The #795 description lands as a fixture: it exits 1 with Test Plan and
Revert Plan outside <details> and code names in the Summary, and the new
tests show preflight failing on it and still passing a valid body.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* invoker: wf-1790182452439-6/implement-preflight-runs-validator — Review claim: make-pr preflight runs the PR-description validator on --body-file and fails when it fails, so it no longer prints 'preflight passed' for a description the required PR Body check rejects.
Review lane: policy
Safety invariant: The change can only add a failure or an UNCHECKED notice; a PR description that passes engine/skills/draft-pr/scripts/validate-pr-body.mjs today is never newly blocked.
Effectiveness measurement: A preflight test feeds the original #795 description (Test Plan and Revert Plan not inside <details>, code names in Summary), which the validator rejects with exit 1, and asserts preflight exits non-zero and prints the validator's errors; a passing description still gives 'ok preflight passed'; a validator that cannot run gives an unchecked failure, not a pass.
Slice rationale: One script, one claim: preflight's description step also runs the schema validator.
Architectural effect: preflight's describe() step covers the same rules as the required PR Body check.
Goal: Stop preflight from approving a PR description the required check will reject.
Motivation: A reflect pass found PR descriptions on catstack PRs #780-#789, #793 and #795 failing the required PR Body check after publication, and the user had to ask for a manual fix of every PR. In catstack the guard stayed silent: fed `mergify stack push` and `gh pr create --body-file <failing body>` it exited 0 with no output, while the same stack push in the Invoker checkout fired. Read at origin/main: engine/skills/make-pr/scripts/preflight.py describe() only runs description_check, then main() prints 'ok preflight passed'; the session that opened #795 got that line and then ran gh pr create.
Alternative considerations: Leaving the validator to CI was set aside because the failure then shows up only after publication. Reimplementing the rules in Python was set aside because it would drift from the validator.
Implementation details: In engine/skills/make-pr/scripts/preflight.py describe(), after description_check, run `node engine/skills/draft-pr/scripts/validate-pr-body.mjs --body-file <file>` from the repo root with a timeout. Print its output lines indented like the other gates. Exit 1 from the validator fails preflight; a missing node binary, a timeout, or any other exit code prints 'description unchecked: <reason>' and fails preflight. Add the tests to engine/skills/make-pr/tests/test_preflight.py with the #795 body as a fixture file under engine/skills/make-pr/tests/fixtures/.
Non-goals: No change to the validator, the hook, or the make-pr SKILL.md rules. Do not edit engine/skills/draft-pr/scripts/validate-pr-body.mjs, scripts/pr/validate-pr-body-local.mjs, or any other file open PR #742 changes; call the validator as it is. If a change would overlap an open PR, stop and report instead.
Layer: domain
Feature state: active
Files:
- engine/skills/make-pr/scripts/preflight.py
- engine/skills/make-pr/tests/test_preflight.py
- engine/skills/make-pr/tests/fixtures/pr795-failing-body.md
Change types:
- engine/skills/make-pr/scripts/preflight.py: modify
- engine/skills/make-pr/tests/test_preflight.py: modify
- engine/skills/make-pr/tests/fixtures/pr795-failing-body.md: create
Acceptance criteria:
- `python3 -m unittest discover -s engine/skills/make-pr/tests -v` exits 0.
- `python3 scripts/check_skill_test_coverage.py --base origin/main --head HEAD` exits 0.
- `python3 scripts/check_skill_file_refs.py` exits 0.
- `python3 scripts/check_no_new_comments.py` exits 0.

Exit code: 0

* invoker: wf-1790182452439-6/verify-preflight-runs-validator-1 — Review claim: `python3 -m unittest discover -s engine/skills/make-pr/tests -v` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 -m unittest discover -s engine/skills/make-pr/tests -v`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 0

* invoker: wf-1790182452439-6/verify-preflight-runs-validator-4 — Review claim: `python3 scripts/check_no_new_comments.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_no_new_comments.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 1

* invoker: wf-1790182452439-6/verify-preflight-runs-validator-2 — Review claim: `python3 scripts/check_skill_test_coverage.py --base origin/main --head HEAD` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_skill_test_coverage.py --base origin/main --head HEAD`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 0

* invoker: wf-1790182452439-6/verify-preflight-runs-validator-3 — Review claim: `python3 scripts/check_skill_file_refs.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_skill_file_refs.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 0

* invoker: wf-1790182452439-6/verify-preflight-runs-validator-4 — Review claim: `python3 scripts/check_no_new_comments.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_no_new_comments.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 1

* invoker: wf-1790182452439-6/verify-preflight-runs-validator-4 — Review claim: `python3 scripts/check_no_new_comments.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_no_new_comments.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Solution:
  Review claim: `python3 scripts/check_no_new_comments.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_no_new_comments.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

* invoker: wf-1790182452439-6/verify-preflight-runs-validator-4 — Review claim: `python3 scripts/check_no_new_comments.py` passes on the finished branch.
Review lane: proof
Safety invariant: Verification is read-only and alters no repository file.
Effectiveness measurement: The command's exit code is the direct measurement.
Slice rationale: One check per proof task.
Architectural effect: None; verification only.
Goal: Prove the slice.
Motivation: Running the check is the proof.
Alternative considerations: The full suite was not required because the slice touches one component with its own tests.
Implementation details: Run `python3 scripts/check_no_new_comments.py`.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 0

* invoker: wf-1790182452439-6/scrub-handoff-artifacts — Review claim: No ephemeral inter-task handoff files remain in the worktree before the merge gate.
Review lane: cleanup
Safety invariant: The scrub script only checks for known handoff artifact names and never touches source, tests, or other repository files.
Effectiveness measurement: The script exits non-zero if any handoff artifact remains.
Slice rationale: Required terminal scrub for every implementation workflow.
Architectural effect: None; hygiene only.
Goal: Leave the branch free of handoff artifacts.
Motivation: Handoff files must not reach the PR.
Alternative considerations: Manual cleanup was set aside as non-deterministic.
Implementation details: Run scripts/scrub-handoff-artifacts.sh.
Non-goals: No product edits.
Layer: app_regression
Feature state: active
Layer exception: allowed. Verification and the terminal scrub run after the docs commit so they check the final branch the PR will carry.
Acceptance criteria:
- The command exits 0.

Exit code: 0

* make-pr: preflight hands the validator the changed files

The required PR Body check passes --changed-files-file, which is how the
validator rejects changed file and folder names in the Summary and a
Review Unit that does not match the diff. Preflight passed only
--body-file, so those descriptions passed locally and failed after
publish. describe() now takes the changed paths preflight already
computed and writes them to a temp file for the validator.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Change-Id: Id36a64869b7cfb2b76b912fd3cf81a88a39dd344

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Edbert Chan <edbertchantech@gmail.com>
EdbertChan and others added 2 commits September 27, 2026 05:20
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Change-Id: I3014f5c0e39f0455d272929d35482b1dedc80557
…ub reports a merge conflict against main;

Exit code: 0
@EdbertChan
EdbertChan force-pushed the stack/EdbertChan/drafter-core-flag-readme/turn-drafter-core-pr-rules-off-unless-catstack--3014f5c0 branch from 359f49d to 8099af0 Compare September 27, 2026 05:23
@cursor

cursor Bot commented Sep 27, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_774fe84d-385f-4efc-b33c-3851b8f2c8f6)

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