Skip to content

docs(claim-ticket): the empty draft now goes red by design, not green - #806

Merged
athvin merged 1 commit into
mainfrom
docs/claim-ticket-empty-pr-red
Nov 7, 2026
Merged

athvin merged 1 commit into
mainfrom
docs/claim-ticket-empty-pr-red

Conversation

@athvin

@athvin athvin commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Follow-up to #793, which inverted the behaviour this passage described.

claim-ticket/SKILL.md told the reader:

Expect the draft's first CI run to be the full gate, and ignore it. […] It is green noise

As of 6d04e4b3 that is false in both halves. An empty diff now reports code=false, the compile tier reports skipped, and the new empty pull request job fails on purpose — so the draft goes red in ~19s. A session following the old wording would read the claim procedure working correctly as the gate failing, and try to fix it. That is the "skills rot at borrowed identifiers" failure: the skill borrowed a fact about CI behaviour and the behaviour moved underneath it.

Measured on a live empty PR (#794, opened and closed for exactly this): 19s / failure, against 9m54s / success for a full run on the same base.

The old behaviour stays as a dated note rather than being deleted, because the reason the bug existed — rust.yml's is the one detect in the repo built as a denylist, and an empty path list inverts through it — is what stops it being reintroduced.

Also adds the one check that must still be green on an empty draft: agent skills (lint + drift), which is ungated and runs on everything.

Body-only edit, so no description change and no generated-block regen. skills-check all passes (28 skills, 0 errors). Being .claude/-only, this PR is itself a worked example of the detect exemption: the compile tier should skip.

`6d04e4b3` inverted the behaviour this passage described. It told the
reader to expect the draft's first CI run to be the FULL backend gate
and to ignore it as "green noise". As of that commit an empty diff
reports `code=false`, the compile tier skips, and the new
`empty pull request` job fails on purpose — so the draft goes RED in
about 19s, and a session following the old wording would read the claim
procedure working correctly as the gate failing, and try to fix it.

Measured on a live empty PR (#794, opened and closed to prove it): 19s
and `failure`, against 9m54s and `success` for a full run on the same
base.

Keeps the old behaviour as a dated note rather than deleting it, because
the reason the bug existed — this is the one `detect` in the repo built
as a denylist, and an empty path list inverts through it — is what stops
it being reintroduced.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit 2860240 into main Nov 7, 2026
36 checks passed
@athvin
athvin deleted the docs/claim-ticket-empty-pr-red branch November 7, 2026 20:15
athvin pushed a commit that referenced this pull request Nov 7, 2026
Two things a pull request here did not carry, both invisible rather than
wrong.

Post-merge work had no record. `/land-pr` already knew the merge was not the
finish line, but every observation it made lived in a session transcript — so a
merged pull request and an abandoned post-merge watch looked identical from
GitHub. The template now carries a ledger between stable
`<!-- BEGIN POST-MERGE -->` markers, and land-pr gains Phase 4: tick it in the
MERGED body, evidence inline, `n/a — <why>` where it does not apply, and leave
a box empty rather than tick something unverified. A merged pull request's body
is writable — probed, a PATCH on #806 while `merged: true` returned 200 — which
is what makes the body the right home for the record.

And a pull request need not have been tied to a ticket. The board's `Pull
request merged` automation acts on the linked issue, so a pull request closing
nothing moves no card; #806 merged the same day closing no issue at all. The
`pull request contract` check asserts both clauses from the body, reading
GitHub's own parsed `closingIssuesReferences` rather than regexing text that
may not actually close anything.

It is its own workflow because it needs `types: [… edited …]` — filling in the
ticket line must turn it green with no push, and putting `edited` on rust.yml
would re-run the backend gate on every typo fix. No `paths:` filter, so it
stays promotable. Exempt: `merge-bus/*` (a bus pull request closes nothing by
design, and merge-bus-verdict.sh reads its rollup, so a failure there would
stop every batch), Dependabot, reverts, and a `no-ticket` label.

The decision logic is pure and sourced, so pr-contract-test.sh exercises it
with no network — 22 assertions, including that the committed template passes
its own gate. It caught one real bug while being written: the END marker was
only recorded after a BEGIN, making the `inverted` verdict unreachable.

Not a required check: promoting it is a branch-protection change, and it must
come after the check has been observed failing and the open pull requests
predating the template have been swept.

Also corrects post-merge.md, which still said the `kind` probe had never
passed; its first green scheduled run on `main` was 2026-11-07.
athvin added a commit that referenced this pull request Nov 7, 2026
* feat(ci): a pull request contract — a ticket, and a post-merge ledger

Two things a pull request here did not carry, both invisible rather than
wrong.

Post-merge work had no record. `/land-pr` already knew the merge was not the
finish line, but every observation it made lived in a session transcript — so a
merged pull request and an abandoned post-merge watch looked identical from
GitHub. The template now carries a ledger between stable
`<!-- BEGIN POST-MERGE -->` markers, and land-pr gains Phase 4: tick it in the
MERGED body, evidence inline, `n/a — <why>` where it does not apply, and leave
a box empty rather than tick something unverified. A merged pull request's body
is writable — probed, a PATCH on #806 while `merged: true` returned 200 — which
is what makes the body the right home for the record.

And a pull request need not have been tied to a ticket. The board's `Pull
request merged` automation acts on the linked issue, so a pull request closing
nothing moves no card; #806 merged the same day closing no issue at all. The
`pull request contract` check asserts both clauses from the body, reading
GitHub's own parsed `closingIssuesReferences` rather than regexing text that
may not actually close anything.

It is its own workflow because it needs `types: [… edited …]` — filling in the
ticket line must turn it green with no push, and putting `edited` on rust.yml
would re-run the backend gate on every typo fix. No `paths:` filter, so it
stays promotable. Exempt: `merge-bus/*` (a bus pull request closes nothing by
design, and merge-bus-verdict.sh reads its rollup, so a failure there would
stop every batch), Dependabot, reverts, and a `no-ticket` label.

The decision logic is pure and sourced, so pr-contract-test.sh exercises it
with no network — 22 assertions, including that the committed template passes
its own gate. It caught one real bug while being written: the END marker was
only recorded after a BEGIN, making the `inverted` verdict unreachable.

Not a required check: promoting it is a branch-protection change, and it must
come after the check has been observed failing and the open pull requests
predating the template have been swept.

Also corrects post-merge.md, which still said the `kind` probe had never
passed; its first green scheduled run on `main` was 2026-11-07.

* feat(ci): stamp the session and host that closed a ledger, and gate the template

The ledger says WHAT was done; it did not say who, or where to go to read the
reasoning behind a tick. `**Closed by:**` now carries the Claude Code session id
and the machine, not just a timestamp:

  agent · session `<CLAUDE_CODE_SESSION_ID>` on `<hostname -s>` · <UTC>

The host is the part that is easy to leave out and the part that makes the id
resolvable. A transcript is a local file — `~/.claude/projects/<slug>/<id>.jsonl`
on the machine that ran it — so an id alone goes nowhere once more than one
machine is in play. With both, `claude --resume <id>` reopens months later;
`claude --from-pr <n>` is the shortcut while that link survives, and the line in
the body is what remains when it does not.

`CLAUDE_CODE_SESSION_ID` is named as the authoritative source because the
obvious alternative is wrong: a scratchpad path may carry the PARENT session's
id when `CLAUDE_CODE_CHILD_SESSION=1`, which is the state a `/clear` leaves
behind. claim-ticket stamps the same pair into its claim banner, which also
gives the worktree audit a durable answer to "which session owns this tree" —
the question `lsof` cannot answer when a session drives its worktree with
`git -C` from the primary checkout.

And `pr-contract-test.sh` joins `make check` as `pr-contract-check`. The
committed template is one of its fixtures, so without it a template edit that
drops a ledger marker would surface only as a red check on every pull request
opened afterwards, with nothing in the diff that mentions CI. The generated
gates reference picked the new step up by itself; CLAUDE.md's hand-written
`make check` line is corrected to match, including the
`tf-static-credentials-check` step it was already missing.

---------

Co-authored-by: bmoore813 <[email protected]>
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.

2 participants