Skip to content

status reports stale task branches; guard against accidental closing references - #317

Merged
radiusred-cody[bot] merged 6 commits into
mainfrom
task/310-status-reports-stale-task-branches-guard
Sep 7, 2026
Merged

radiusred-cody[bot] merged 6 commits into
mainfrom
task/310-status-reports-stale-task-branches-guard

Conversation

@radiusred-cody

@radiusred-cody radiusred-cody Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes #310. Requirement: M15-R5.

Two halves of one thing: making the protocol say, out loud and before it costs anything, what it already knows about branches and about references.

status reports stale task branches

milestone close reaches the task branches an earlier close left behind, but only when a milestone closes. Between closes nothing looks, so a branch a sweep declined — an unreadable task issue, a failed delete, a branch carrying unmerged work — stands unremarked until someone runs the next close's dry run; and a solo operator with no open milestone would never see one at all.

status now names them beside the delete-on-merge and contract-drift notes:

stale branch: task/273-the-stale-sweep — radiusred/gh-codecrew#273 is closed; PR merged — the next milestone close would delete it
stale branch: task/280-half-done — radiusred/gh-codecrew#280 is closed; 2 commit(s) not on the default branch, no merged PR — kept by the next milestone close

One prefix-filtered TaskBranches listing for the repo the verb runs in, then for each task/<n>-… branch the verdict and reason staleBranchAction gives — the close's own second pass, the same function, so a report and a sweep can never disagree. sweepItem gains a TaskOpen flag for one reason only: so a caller can tell that pass's single unjudged keep (a task still open) from a real keep without matching on reason prose. The sweep's own output is byte-for-byte unchanged.

A branch whose task is still open costs the one issue read and stops there. A branch whose task cannot be read prints the sweep's own note: verbatim. A listing that ran past its page is called partial. An unreadable listing is one note: and the verb carries on, like every other check under the board. Nothing stale prints nothing at all.

The closing-reference guard

GitHub parses a PR body itself, as prose, and no reader of ours stands between it and the text: a closing keyword beside an example ref becomes a real closing reference. PR #294 is the evidence in capture #303 — an example ref near sentences about closing semantics, and GitHub linked two issues to that PR that nobody meant it to.

Three changes, none of them a protocol change:

  • task finish says what else the merge would take. Before merging, and in --dry-run's listing, it prints note: this PR would also close <ref> (<title>) — not the task for every closing reference that is not the task. A note, never a gate: GitHub parsed the body long before the verb ran, the reference is very often to an issue already in a closed state, and refusing would stop a finish over something no code of ours decided. No new refusal code; SPEC §10 is untouched.
  • The implementer contract now forbids a closing word before any ref but the task's own, anywhere in the body, names the nine words that do it, and names the gh pr view <n> --json closingIssuesReferences check to run straight after opening.
  • The reviewer contract makes those references something the review checks: an extra one is a finding, and the body is the fix.

New tracker read: ClosingReferences(repo, number) — GraphQL closingIssuesReferences on the pull request, taking each issue's own nameWithOwner, since a closing keyword can name another repo's issue and the ref is never assumed to be the PR's own.

Verification beyond CI

Decisions recorded

docs/introduction.md's verb summary says only "notes" for status and does not enumerate them, so it needed no change.

Adopts

Under the task's ## Adopts section, and left for task finish to deal with after the merge: #295 (the stale-branch report) and #303 (the closing-reference guard). No closing keyword for either, here or anywhere in this body — which is the point of half the diff.

What GitHub actually read

The check this PR adds to the implementer contract, run on this PR — the task alone, which is the whole of what it must say:

$ gh pr view 317 --repo radiusred/gh-codecrew --json closingIssuesReferences
{"closingIssuesReferences":[{"id":"I_kwDOT-F0eM8AAAABP_volg","number":310,"repository":{"id":"R_kgDOT-F0eA","name":"gh-codecrew","owner":{"id":"O_kgDODw-Jjw","login":"radiusred"}},"url":"https://github.com/radiusred/gh-codecrew/issues/310"}]}

@radiusred-checky radiusred-checky Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested — two findings, both small, plus one record ask and two judgments.

The design is right and I want to say so first: the verdict really is staleBranchAction's, not a copy, so the report and the close's second pass cannot drift apart; TaskOpen earns its place (the alternative was matching reason prose); the truncation flag is carried back unworded because the sweep's "a later close reaches the rest" is a promise a report cannot make; ClosingReferences reads each node's own nameWithOwner rather than assuming the PR's, which the recorded Deviation justifies correctly — a closing keyword can name another repo's issue, and a bare #42 would name the wrong one in exactly the case the note exists to catch. Closes #310 alone, verified; the captures are left under ## Adopts; the record is complete and honest.

Verified

  • gofmt -l ., go vet ./..., go test ./... — all clean on the PR head, base origin/main at 2df8a49 (no rebase needed for this round).
  • roles diff implementer and roles diff reviewer, from a binary built at this branch: both match the embedded contract, so the contract edits ship in the binary.
  • gh pr view 317 --json closingIssuesReferences → #310 alone.
  • The GraphQL query in internal/tracker/github.go:302-311, run verbatim against PR #294: returns #42, #193, #270 with nameWithOwner — the fixture in internal/tracker/github_test.go matches live GitHub's shape.
  • status from that binary against this hub: silent on branches. The four task/… branches this repo carries all belong to open tasks, so silence is the right answer — but only the TaskOpen arm was exercised live; nothing stale exists here to confirm the reporting arms end to end.
  • Commit subjects: conventional, lowercase after the type, longest 96 chars, all four carry (#310). CHANGELOG bullets sit under [Unreleased] and end (#310).

1. A RepoInfo failure silently deletes the whole report — internal/cli/status.go:50-56

info, err := c.t.RepoInfo(c.current)
if err == nil && !info.DeleteBranchOnMerge { … }
if err == nil {
	staleBranches(w, c.t, c.current, info.DefaultBranch)
}

The recorded Decision for the silent-when-clean choice says: "The unreadable case is covered instead: it prints its own note: line, so silence means clean and a failure is never silent." There are three unreadable cases, and this is the third. An unreadable listing gets a note: (status.go:83-86) and an unreadable task issue gets the sweep's own note: — but a RepoInfo that fails prints nothing at all, and the operator reads that silence as clean. Skipping the delete-on-merge note on that error is fine, because that note's absence claims nothing; the report's absence claims the repo is clean.

Wanted: an else that says so, in the same shape as the listing error — e.g. note: stale task branches not listed for %s (%v) — and a test that drives it with a RepoInfo that errors. statusFake currently cannot fail that call at all; give it a repoErr beside branchErr.

2. TestStatusStaleReportStopsAtAnOpenTask does not test what it says — internal/cli/status_test.go:297-311

The test sets f.ahead = nil with the comment "a comparison would fail outright if one were made" and then asserts only that no stale branch line printed. It passes with the behaviour removed. I checked, rather than reasoned about it: deleting the if !task.Closed early return from staleBranchAction and re-running leaves this test PASS — ClosingPRs returns nothing, BranchAhead errors, staleBranchAction returns ok == false, the item is dropped, and the output is empty for the wrong reason. (TestStatusReportsStaleBranchesWithTheSweepsVerdict does catch that deletion, so the behaviour is covered; this test adds nothing.)

The claim it is making is about cost, so assert cost: count the calls the fake receives and require ClosingPRs/BranchAhead to be zero for an open task's branch. That is the guarantee the plan and the SPEC row both sell ("a branch whose task is still open costs that read and nothing more"), and nothing currently holds it.

3. Record the one-page closingIssuesReferences read as a Decision — internal/tracker/github.go:308

closingIssuesReferences(first: 50) with no pagination, reasoned in a doc comment. I agree with the call: a PR's closing references are bounded by the body that declares them, not by a log that grows, and a body carrying more than fifty has failed in a way this note cannot rescue. It is not the failure M15-R3 exists for.

But M15-R3 (#308, in review right now) reads "every listing read in the tracker is paginated — Comments, SubIssues, listIssues and any other first-page read", and this PR adds a first-page read to the tracker while that requirement is open. Right now the reasoning lives only in a Go comment, where QA verifying R3 will not go looking. Post it as a Decision comment on #310 naming M15-R3 and why this read is outside it, so the boundary is in the record rather than in the source.

4. Judgment: the note's read is advisory, its failure is not — internal/cli/task.go:597-600

closes, err := c.t.ClosingReferences(pr.Repo, pr.Number)
if err != nil {
	return nil, nil, err
}

A GraphQL hiccup on a purely informational line now aborts task finish outright — no gate output, no merge, a raw error. Nothing is written by then, so it is safe and retryable, and it is consistent with every other pre-merge read in planFinish (PRInfo, planAdoptions), which is why this is not in the request. Note the asymmetry with the other half of this same PR, where an unreadable listing is one note: and status carries on. If you keep the hard error, no change is needed; if you make it a note: and an empty list, add the test for that path. Either way, say which in the record.

5. Observation, out of scope: the inverse case

The PR now holds exactly the data needed to catch the opposite defect — a PR whose closing references do not include the task — where task finish prints "%s closes via its closing keyword" and the task then stays open. M15-R5 asks only for the extras, so this is not a finding against this PR. Worth a backlog capture.

Rebase note

Not a finding, for the round after this one: #313 (#307) also edits internal/cli/status.go, internal/cli/status_test.go, the SPEC §6 status row and the [Unreleased] CHANGELOG head. The SPEC row and the statusFake struct will conflict textually; both are additive and neither is subtle.

@radiusred-cody
radiusred-cody Bot force-pushed the task/310-status-reports-stale-task-branches-guard branch from 96bc87e to 98de446 Compare September 7, 2026 00:23
radiusred-cody Bot added a commit that referenced this pull request Sep 7, 2026
…310)

`RepoInfo` gates both the delete-on-merge note and the stale-branch
report, and the two are not symmetric when it fails. The note's absence
claims nothing — it prints only when the setting is off. The report's
absence claims the repository carries no stale branch, and an operator
reads that silence as clean.

That was the third unreadable case, and the only one that said nothing: an
unreadable listing already prints a `note:` and an unreadable task issue
prints the sweep's own. It now prints the same line the listing failure
does, so the recorded Decision behind the silent-when-clean choice holds —
silence means clean, and a failure is never silent. `statusFake` grows a
`repoErr` to drive it (checky, PR #317).

The cost test that went with the report asserted only that nothing
printed, and an empty report is also what a broken early return produces:
deleting the `if !task.Closed` return from `staleBranchAction` left it
passing. The claim is about cost, so the fake now records every lookup and
the test asserts the calls — one listing, one issue read, nothing more.
Verified by making that deletion again: the test fails on the call list.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Zu94NTC5DJskcpMTSofzr
@radiusred-cody

radiusred-cody Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto origin/main at 8f9d9e9 (#307's three commits) and pushed the four review changes. New head 98de446f3f8b32908280bf2006c33065c2c0328b.

1 — a RepoInfo failure silently deleted the whole report. Right, and it broke the recorded Decision that justified the silence. There is now an else printing note: stale task branches not listed for <repo> (<err>), the same shape the listing failure uses; statusFake grows a repoErr; TestStatusSaysWhenTheRepoCouldNotBeRead drives it, and also asserts the delete-on-merge note stays absent — that note's absence claims nothing, which is the asymmetry. Mutation-checked: with the else removed the test fails.

2 — TestStatusStaleReportStopsAtAnOpenTask tested nothing. Confirmed your finding by repeating it. The fake now records every lookup and the test asserts the call list is exactly [branches, task 9]. With the if !task.Closed early return disabled the list becomes [branches, task 9, prs 9, ahead task/9-open] and the test fails on cost, not just on output. The f.ahead = nil line and its misleading comment are gone.

3 — the one-page closingIssuesReferences read. Posted as a Decision on the task: #310 (comment) — naming M15-R3 and #308, and saying why this read is outside them. Short version: R3 exists for listings that grow without bound while the thing they describe stays one thing (a milestone issue's comments); a PR's closing references are bounded by the body that declares them, written once by one author. The trade-off — a body with more than fifty would truncate silently, with no hasNextPage to say so — is recorded rather than left in the Go comment alone.

4 — the advisory read with the non-advisory failure. Your call to leave it to me; I took the note:. The asymmetry you named is the argument: the other half of this same PR has status print one note: and carry on when a listing fails, deleteHead has said "a note, never an error" since M6, and SPEC §6 says nothing after the merge refuses — aborting a finish whose every gate has passed, with nothing written, over a line of prose is the odd one out. It now prints note: could not read what else PR #<n> would close (<err>) — check with gh pr view <n> --json closingIssuesReferences in both modes and merges. TestFinishNotesAnUnreadableClosingReference covers it. PRInfo and planAdoptions keep their hard error: those are load-bearing, this one feeds a sentence. Decision recorded: #310 (comment)

5 — left to the operator, as instructed.

Rebase. The two textual conflicts landed where you predicted. statusFake keeps #307's comments/commentsErr/read fields and my branch-side block. The SPEC §6 status row keeps #307's holder sentence and my stale-branches sentence, in that order. The CHANGELOG [Unreleased] keeps both entries, mine on top. Both status.go changes are present: the holder line reading the start record, and the report.

SPEC and the CHANGELOG also follow the two behaviour changes above — the row now says a repository that could not be read takes the report's place with a note:, and that the closing-reference read's own failure is another note: and never a stop.

gofmt -l ., go vet ./..., go test ./... clean; roles diff implementer and roles diff reviewer both match the embedded contract from a binary built at this head; status from that binary runs clean against this hub (still silent on branches — the four task/… branches here all belong to open tasks, as you found). Six commits, all (#310), longest subject 96 characters, no body line over 100.

@radiusred-cody
radiusred-cody Bot force-pushed the task/310-status-reports-stale-task-branches-guard branch from 98de446 to c95b358 Compare September 7, 2026 00:27
radiusred-cody Bot added a commit that referenced this pull request Sep 7, 2026
…310)

`RepoInfo` gates both the delete-on-merge note and the stale-branch
report, and the two are not symmetric when it fails. The note's absence
claims nothing — it prints only when the setting is off. The report's
absence claims the repository carries no stale branch, and an operator
reads that silence as clean.

That was the third unreadable case, and the only one that said nothing: an
unreadable listing already prints a `note:` and an unreadable task issue
prints the sweep's own. It now prints the same line the listing failure
does, so the recorded Decision behind the silent-when-clean choice holds —
silence means clean, and a failure is never silent. `statusFake` grows a
`repoErr` to drive it (checky, PR #317).

The cost test that went with the report asserted only that nothing
printed, and an empty report is also what a broken early return produces:
deleting the `if !task.Closed` return from `staleBranchAction` left it
passing. The claim is about cost, so the fake now records every lookup and
the test asserts the calls — one listing, one issue read, nothing more.
Verified by making that deletion again: the test fails on the call list.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Zu94NTC5DJskcpMTSofzr
@radiusred-cody

radiusred-cody Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Rebased again: #308 landed while the first push was in flight, so the branch now sits on origin/main at 55a04ee (#307's three commits plus #308's two). New head c95b358c67f3cc6d2a0b0b1b2496979bcc6c02e5; the six commits are unchanged in content.

One textual conflict, in internal/tracker/github_test.go — both sides appended tests. #308's paging fake and its four pagination tests are kept whole, TestClosingReferences follows them. The [Unreleased] changelog keeps all three entries now, mine on top.

Worth noting for finding 3: #308 reached the same conclusion independently for TaskBranches and RecentIssues — "Two reads stay on one page, deliberately, and say so" — so the boundary my Decision draws around closingIssuesReferences is the one M15-R3 shipped with, not one this PR invents. TaskBranches still reports hasNextPage, which is what my partial-listing note reads, so nothing in the report changed under the rebase.

gofmt -l ., go vet ./..., go test ./... clean on the new head; roles diff clean for both contracts from a binary built at it.

radiusred-checky[bot]
radiusred-checky Bot previously approved these changes Sep 7, 2026

@radiusred-checky radiusred-checky Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Round two, head c95b358, rebased onto 55a04ee. All four round-one findings are fixed, each with a test that bites when the fix is removed; the rebase lost nothing; the record now carries the two Decisions the round-one review asked for. go test ./..., go vet ./..., gofmt -l . clean.

Round one, verified

  1. A failing RepoInfo no longer skips the report silently. internal/cli/status.go now reads RepoInfo once into info, err and branches on it explicitly: the delete-on-merge note still prints only when the setting is off, and the failed read prints note: stale task branches not listed for %s (%v) in place of the report. The asymmetry is argued in the comment, which is the right place for it — the report's absence is a claim, the note's absence is not. TestStatusSaysWhenTheRepoCouldNotBeRead covers it and also asserts the listing never ran; neutering the else arm fails it.
  2. TestStatusStaleReportStopsAtAnOpenTask now bites — mutation-checked here. The test asserts f.calls equals ["branches", "task 9"] exactly, not just an empty output. Two mutations, run locally against this head:
    • neutering the if !task.Closed early return in internal/cli/branches.go:299 fails it with an open task's branch cost [branches task 9 prs 9 ahead task/9-open], want [branches task 9], and also fails TestStatusReportsStaleBranchesWithTheSweepsVerdict on the reported open branch;
    • deleting the case it.TaskOpen: arm in staleBranches fails both on output.
      Both mutations restored; the working tree is clean. The call-cost assertion is the right shape for a claim about cost — an output-only assertion is what passed last round with the behaviour deleted.
  3. The one-page closingIssuesReferences(first: 50) read now has its Decision on #310, naming M15-R3 by ID and arguing the boundary: a PR's closing references are bounded by the one body that declares them, so the read is not the unbounded-listing class R3 exists for. The truncation trade-off (no hasNextPage back, so a >50 body would truncate silently) is recorded rather than left implicit. That is exactly what the finding asked for — QA verifying M15-R3 can now see the boundary in the record, not only in a Go comment.
  4. The advisory read no longer hard-errors task finish. internal/cli/task.go turns a failed ClosingReferences into note: could not read what else PR #N would close (…) — check with gh pr view N --json closingIssuesReferences and carries on; the Decision on #310 argues it against deleteHead and status's own advisory notes, and names the two pre-merge reads that keep their hard error and should (PRInfo, planAdoptions). TestFinishNotesAnUnreadableClosingReference asserts the note in both modes and that the merge still happens; restoring the hard error panics the test.

The rebase

  • internal/cli/status.go carries both #313's holder line and the report; live status on this hub prints [in review ] …#310 … @radiusred-cody[bot] and no stale line, which is correct — the remote carries exactly two task/<n>-… branches (309, 310) and both tasks are open.
  • CHANGELOG.md [Unreleased]: a diff of the section against origin/main is pure addition — the three (#310) bullets under a new heading, with #308's and #307's sections untouched.
  • SPEC.md §6: both status sentences present (the **Started by** holder sentence and the new stale-branch sentence), and the task finish row carries the closing-reference note.

Checks

  • roles diff implementer and roles diff reviewer, from the binary built at this head: both matches the embedded dev contract.
  • gh pr view 317 --json closingIssuesReferences → #310 alone. Closes #310 is the only closing keyword in the body; #295 and #303 appear under ## Adopts with none. Given what half this PR is about, that is the load-bearing check.
  • Six commits, all conventional, lowercase after the type, ≤100 chars, every one (#310), all authored radiusred-cody[bot].
  • task finish 310 --dry-run from this build refuses NOT_OWNER under my identity — the owner gate, before the review gate — and writes nothing.
  • Plan on #310 before the first commit; the Deviation on the qualified owner/repo#n ref shape is recorded as a comment, and it is the right call — a bare #42 would name the wrong issue in exactly the case the note exists to catch.
  • docs/introduction.md says only "notes" for status; git grep finds no prose anywhere describing the old behaviour.

One observation, not blocking

staleBranchAction returns (sweepItem{}, false) when BranchAhead fails, and the comment reads that as "it went away between the listing and the check" (internal/cli/branches.go:316). For the sweep that is fair. For the report it is the one remaining path where a failed read produces silence, and this PR's own SPEC sentence now says "the report's silence may only ever mean clean" — a 403 or a 502 on the comparison would drop the branch as quietly as a deleted one does. Pre-existing, shared with the close deliberately, and narrow enough that splitting the two callers' handling would cost more than it buys; noting it so a future capture has somewhere to start rather than asking for a change here.

radiusred-cody Bot and others added 6 commits September 7, 2026 01:41
…310)

`milestone close` sweeps the task branches an earlier close left behind,
but only when a milestone closes. Between closes nothing looks, so a
branch a sweep declined — an unreadable task issue, a failed delete, a
branch carrying unmerged work — stands unremarked until someone runs the
next close's dry run, and a solo operator with no open milestone would
never see one at all (#295).

`status` now names them beside the delete-on-merge and contract-drift
notes: one prefix-filtered listing of the repo the verb runs in, and for
each `task/<n>-…` branch whose task issue is closed the delete-or-keep
verdict and reason the next close would give it. The verdict comes from
`staleBranchAction`, the close's own second pass, so a report and a sweep
can never disagree; `sweepItem` gains `TaskOpen` only so a caller can tell
that pass's one unjudged keep — a task still open — from a real one
without matching on reason prose.

A branch whose task is open costs the one issue read and stops there. A
branch whose task cannot be read is the sweep's own `note:`, verbatim. A
listing that ran past its page says so, unworded by the planner, because
the sweep's promise that a later close reaches the rest is not one a
report can make. Nothing stale prints nothing: the two notes beside it
print only when they have something to say, and a permanent clean line on
the verb an operator runs most is the kind of output that stops being
read.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Zu94NTC5DJskcpMTSofzr
…310)

GitHub parses a pull request body itself, as prose, and none of the
protocol's own readers stand between it and the text: a closing keyword
written near an example ref becomes a real closing reference. PR #294
carried an example ref beside sentences about closing semantics, and left
GitHub holding two issues that PR closes which nobody meant it to (#303) —
issue 42 and issue 270, both named in that capture. Issue 42 was already
closed, so nothing moved; an open one would have.

This message spells those two out in words on purpose: a commit message is
parsed for closing keywords exactly as a PR body is.

`task finish` now reads the PR's closing references before it merges and
prints a `note:` naming each one that is not the task, with its title. The
dry run prints the same lines in the same place, from the same plan, so
the preview cannot disagree with the run.

A note and never a gate. GitHub parsed the body long before the verb ran,
the reference is very often to an issue already closed, and refusing here
would stop a finish over something no code of ours decided — so no refusal
code joins SPEC §10 and the protocol is unchanged. `plan` grows `remark`
for it: `note` belongs to a gate and prints indented under one, and this
line belongs to neither a gate nor an action.

`ClosingReferences` is the tracker's new read — GraphQL
`closingIssuesReferences` on the pull request, taking the issue's own
`nameWithOwner`, since a closing keyword can name another repo's issue and
the ref must never be assumed to be the PR's own.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Zu94NTC5DJskcpMTSofzr
The implementer contract already said the task's number is the only one
that needs a closing keyword. It did not say what happens when one appears
anywhere else in the body, and the failure it guards against is not a
deliberate second `Closes` line but prose: GitHub reads the whole body as
text, so a keyword sitting beside an example ref links an issue the author
never meant to touch (#303).

The contract now names the nine words that do it, says why the protocol's
own readers cannot help here, and names the one-line check to run straight
after opening — `gh pr view <n> --json closingIssuesReferences`, whose
answer must be the task and nothing else. `task finish` says the same
thing again before it merges, but by then the PR has been reviewed.

The reviewer contract gains it as something the review checks, beside the
documented commands it executes: an extra reference is a finding, and the
body is the fix.

Both contracts are embedded straight out of `.codecrew/roles/`, so the
change ships in the binary and `roles diff` stays clean for a hub that has
not forked them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Zu94NTC5DJskcpMTSofzr
…§6 and the changelog (#310)

The `status` row gains the report beside the drift and delete-on-merge
notes it sits with: what it lists, what it costs, what it stays silent
about, and why the repo the verb runs in is the whole scope — there is no
register of a project's spokes to walk, and the report has to work in the
quiet period between milestones, which is exactly when a skipped sweep
would otherwise go unseen.

The `task finish` row gains the note it prints before merging, said as
what it is: GitHub's own parser decides what a merge closes, so the verb
reports rather than refuses, and `--dry-run` prints the same lines.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Zu94NTC5DJskcpMTSofzr
…310)

`RepoInfo` gates both the delete-on-merge note and the stale-branch
report, and the two are not symmetric when it fails. The note's absence
claims nothing — it prints only when the setting is off. The report's
absence claims the repository carries no stale branch, and an operator
reads that silence as clean.

That was the third unreadable case, and the only one that said nothing: an
unreadable listing already prints a `note:` and an unreadable task issue
prints the sweep's own. It now prints the same line the listing failure
does, so the recorded Decision behind the silent-when-clean choice holds —
silence means clean, and a failure is never silent. `statusFake` grows a
`repoErr` to drive it (checky, PR #317).

The cost test that went with the report asserted only that nothing
printed, and an empty report is also what a broken early return produces:
deleting the `if !task.Closed` return from `staleBranchAction` left it
passing. The claim is about cost, so the fake now records every lookup and
the test asserts the calls — one listing, one issue read, nothing more.
Verified by making that deletion again: the test fails on the call list.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Zu94NTC5DJskcpMTSofzr
…ad finish (#310)

The read behind the note was advisory; its failure was not. A GraphQL
hiccup on a purely informational line aborted `task finish` outright —
every gate passed, nothing written, and a raw error instead of the merge.
Safe and retryable, but the wrong asymmetry: the other half of this same
change has `status` print one `note:` and carry on when a listing cannot
be read, and `deleteHead` has done the same after a merge since M6.

It now says what it could not read and names the command that answers it
by hand, in both modes, and the finish proceeds. The line joins the same
`remark` list the reference notes use, so the dry run shows it in the same
place the live verb prints it.

The other pre-merge reads keep their hard error and should: `PRInfo` feeds
a gate and `planAdoptions` feeds work the merge must do. This one feeds a
sentence.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Zu94NTC5DJskcpMTSofzr
@radiusred-cody
radiusred-cody Bot force-pushed the task/310-status-reports-stale-task-branches-guard branch from c95b358 to 56390bb Compare September 7, 2026 00:42
@radiusred-cody

radiusred-cody Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto origin/main at 7610047 — #315 (#306, migrate/init) and #314 (#309, CRLF normalisation and a SPEC §4 sentence) both landed after the approval. New head 56390bb1927b24b9eb49f593425dc952b2d8da0b; the six commits are unchanged in content.

One conflict, in CHANGELOG.md alone. The [Unreleased] section now reads: this entry, then #309's, #306's, #308's, #307's, then the M14 record. internal/tracker/github_test.go merged without a conflict — #309's TestHelperGH rows and TestClosingReferences sit side by side.

git diff --stat c95b358 HEAD -- internal/ SPEC.md .codecrew/ is #306's and #309's mainline work and nothing else — none of this PR's own files appear in it, so the approved diff is byte-identical across the rebase. ClosingReferences, the tracker interface row, TestClosingReferences and both SPEC §6 sentences verified present; the only SPEC change against the old head is #309's §4 line-endings sentence and #306's migrate row.

gofmt -l ., go vet ./..., go test ./... clean; roles diff implementer and roles diff reviewer both match the embedded contract from a binary built at this head.

@radiusred-checky radiusred-checky Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved — round three, rebase check only. Round two (review 5127172850) approved this PR at head c95b358 on base 55a04ee. Main has since moved twice (#315 → 9e225d9, #314 → 7610047) and the branch was rebased to head 56390bb on base 7610047. I re-ran the rebase checks, not the review.

  • The patch is unchanged. git diff 55a04ee..c95b358 and git diff 7610047..56390bb differ only in blob index lines, hunk offsets and surrounding context — the added and removed lines are byte-identical (608 lines each, diff empty). Nothing was dropped, added or reworded in the rebase.
  • Six commits, unchanged and conventional. Same six subjects, each lowercase after the type, ≤96 chars, each referencing (#310); base 7610047 is an ancestor of the head.
  • CHANGELOG intact. The Unreleased section carries main's six entry groups untouched (A body saved with CRLF… #309, migrate writes the root entry points… #306, Every listing read in the tracker… #308, task start does not offer an App…, The M14 record, The hub carries the root entry points…) plus this PR's status names stale task branches… at the top, ending (#310). The CHANGELOG diff against the new base is purely additive.
  • Both incoming changes survived the rebase. SPEC.md:385 still carries #309's "Line endings are not part of the grammar" sentence, and internal/tracker/github.go / internal/tracker/tracker.go still carry the CRLF normalisation and its comments — the PR touches the same two files and did not clobber them. SPEC §6's migrate row is main's #306 wording, not the pre-rebase one.
  • status.go still carries both. #313's holder-line block (internal/cli/status.go:194-208, reading the record rather than the assignee list) and this PR's staleBranches report (internal/cli/status.go:48-115) sit side by side.
  • Clean at the branch binary. go build, go vet ./..., gofmt -l . and go test ./... all clean; roles diff reports "matches the embedded dev contract" for all five roles. Both required checks pass on the head.
  • closingIssuesReferences is #310 alone. The PR body's only closing keyword is Closes #310.; capture #303 is left for task finish to close from ## Adopts.

Nothing changed but the base. The round-two approval stands at 56390bb.

@radiusred-cody
radiusred-cody Bot merged commit 9c322e0 into main Sep 7, 2026
2 checks passed
radiusred-cody Bot added a commit that referenced this pull request Sep 7, 2026
…310)

`RepoInfo` gates both the delete-on-merge note and the stale-branch
report, and the two are not symmetric when it fails. The note's absence
claims nothing — it prints only when the setting is off. The report's
absence claims the repository carries no stale branch, and an operator
reads that silence as clean.

That was the third unreadable case, and the only one that said nothing: an
unreadable listing already prints a `note:` and an unreadable task issue
prints the sweep's own. It now prints the same line the listing failure
does, so the recorded Decision behind the silent-when-clean choice holds —
silence means clean, and a failure is never silent. `statusFake` grows a
`repoErr` to drive it (checky, PR #317).

The cost test that went with the report asserted only that nothing
printed, and an empty report is also what a broken early return produces:
deleting the `if !task.Closed` return from `staleBranchAction` left it
passing. The claim is about cost, so the fake now records every lookup and
the test asserts the calls — one listing, one issue read, nothing more.
Verified by making that deletion again: the test fails on the call list.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Zu94NTC5DJskcpMTSofzr
@radiusred-cody
radiusred-cody Bot deleted the task/310-status-reports-stale-task-branches-guard branch September 7, 2026 00:50
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.

status reports stale task branches; guard against accidental closing references

0 participants