fix(tick): reliably emit Closes #NN so a merged bot PR auto-closes its issue #373
No reviewers
Labels
No labels
Agent
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
2 participants
Notifications
Total time spent: 1 minute
Due date
igor
1 minute
No due date set.
Dependencies
No dependencies set
Reference
joshtronic/igor!373
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/372-ensure-closes-keyword"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Teach the harness to reliably emit a
Closes #NNkeyword so a merged bot PR auto-closes the issue it resolves (#372).The bug
bin/tick.shalready appended a bareCloses #<issue>to PR bodies, but with two holes that let an issue survive the merge of its own fix:The fix
pr_body_ensure_closes <body> <issue>inlib/checkpoint.sh: idempotent, no-dup, empty-issue-safe, and exact-issue-matched (a body mentioning#3690does not satisfy#369; a keyword for a different issue still appends). Recognizesclose/fix/resolvein any inflection, case-insensitive.elsebranch: a non-WIP existing PR now gets the keyword guaranteed, editing the body only when it's actually absent. Reuses the PR JSON already fetched for the title (no extra API call).Tests
bin/test-checkpoint.shgains 10 cases forpr_body_ensure_closes: empty-guard, append + body-preservation, dedup acrossCloses/Fixes/resolvedinflections, case-insensitivity,#3690≠#369, different-issue-still-appends, and idempotence.make testgreen;shellcheckclean on the changed lines (the one remaining SC2015 is pre-existing).Closes #372
Closes #NNso a merged bot PR auto-closes its issue🤖 Review —
APPROVE(automated)CI for
983a5567: successChange: Adds a pure
pr_body_ensure_closeshelper inlib/checkpoint.shand routes all PR-body construction paths (WIP draft, WIP finalize, new PR) through it, plus a newelsebranch that guarantees aCloses #NNkeyword on a non-WIP existing (reworked) PR. Fixes the double-append and the missing-keyword-on-rework holes behind #372. CI green.Verdict: APPROVE — correct, in scope (~40 lines), honestly described, well-tested.
Findings
(close[sd]?|fix(e[sd])?|resolve[sd]?)[[:space:]]+#${issue}([^0-9]|$)correctly covers the GitHub/Forgejo keyword inflections, is case-insensitive, and the([^0-9]|$)guard makes#3690not satisfy#369. Idempotent because the appendedCloses #NNre-matches on a second pass — verified by the round-trip test.EX_JSONis fetched once and both.titleand.bodyare extracted from it — no extra API call, as claimed.|| echo '{}'keepsjqsafe on a failed fetch.elsebranch edits the body only when the keyword is actually absent ([ "$EX_NEW" != "$EX_BODY" ]), so it won't churn PRs that already close their issue, and it preserves the existing body (including any count tag) since it appends to the JSON body rather than rebuilding it.Minor notes (non-blocking, no action required)
'#3690' does NOT satisfy #369 -> appendstest usessee #3690, which has no closing keyword at all — so it would append regardless and doesn't actually exercise the([^0-9]|$)boundary. UsingCloses #3690with issue369would validate the exact-match claim directly. The regex is correct either way; just a coverage gap.Closes: #369(colon before the space) wouldn't match the[[:space:]]+requirement and would get a secondCloses #369appended. Harmless (still auto-closes), and rare, but worth knowing.Independent review by the harness on
claude-opus-4-8(effort: high). The human reviewer is requested once Igor has reviewed; a human still merges.