diff --git a/.claude/guides/merge-policy.md b/.claude/guides/merge-policy.md index 3a83cf8e1..37a545428 100644 --- a/.claude/guides/merge-policy.md +++ b/.claude/guides/merge-policy.md @@ -129,9 +129,11 @@ self-progressing under the evidence-bound rule below; once that evidence fails o yours too. **Three terminal states, and CLOSING is first-class.** A PR is done when it is **merged**, **closed -with the reason recorded**, or **parked on a named, live-verified blocker**. Close one when it adds no -value, duplicates work already shipped, or conflicts with where the product is going — re-filing any -still-valid finding as an issue first, and stating the reason on the PR. A stale draft nobody will +with the reason recorded**, or **parked on a named, live-verified blocker**. A park is that state +only while the parked digest reports the PR `PARKED`, and even then its blocker stays owned (see +*A park is never a resting place* below). Close one when it adds no value, duplicates work already shipped, or conflicts with +where the product is going — re-filing any still-valid finding as an issue first, and stating the +reason on the PR. A stale draft nobody will finish is not neutral: it costs review capacity, ages into conflicts, and hides the work that matters. **A parked PR carries one blocker record, in a comment, under the `blocked` label** (monorepo#3424). @@ -189,16 +191,17 @@ and its one record is `MALFORMED`, `STALE`, `NO-ASK` or `STALE-ASK` as an issue' comment by `devantler` whose first line is a `> 🤖 Generated by the …` disclosure counts, so nobody else's comment can park a PR or clear a finding, and a record written without that line is not seen. -**A parked PR is a terminal state, and the survey reads it as one** (monorepo#3288). After the +**A parked PR is settled for the survey only while the digest says so** (monorepo#3288). After the survey, run `.claude/scripts/blocked-label-blocker-line.sh --org devantler-tech --parked-digest`. It prints one row for every open PR that carries the `blocked` label and a closing `CHECKED` line that -counts them: +counts them. Its `actionable=` count includes the `STRANDED` rows: - `PARKED # [] `: the PR has one conforming record, re-verified recently, and - no blocker it names is known to be closed. It is finished rung-1 work. Do not diagnose it again or - comment on it, and do not count it against `nothing_on_fire`, whatever the survey digest says - about that PR. The note says what was read. `blocker open`: every issue or PR of this - organization that the record names was read and is open. `blocker state not read`: the record + no blocker it names is known to be closed. The PR itself needs no work this run. Do not diagnose it + again or comment on it, and do not count it against `nothing_on_fire`, whatever the survey digest + says about that PR. Its blocker is still owned work (*A park is never a resting place* below). + The note says what was read. `blocker open`: every issue or PR of this organization that the + record names was read and is open. `blocker state not read`: the record names none the digest may read (another owner's, or a blocker described only in words), so checking that blocker when the record's date comes due is still yours. `authority`: the PR waits on a decision, and the digest never reads an authority blocker's state; it separately verifies @@ -211,12 +214,87 @@ counts them: blocks it now. `BLOCKER-SELF` and `BLOCKER-UNREADABLE` mean the record names the PR itself or a reference with no usable number: write a real blocker or unpark. Any other reason is the record's own verdict from the paragraph above: repair the record, or unpark the PR. - -Exit `0` means every labelled PR is parked, `1` that at least one is actionable, and `2` is UNKNOWN: -then nothing is read as parked, and every labelled PR stays in the survey's own disposition. +- `STRANDED # reason= age=d `: an exact `dependabot[bot]` or + `renovate[bot]` PR whose park would otherwise hold, but which is still owned rung-1 work this run. + `age` counts days since its record comment was created, which is the PR's first park: `unpark` + keeps that comment and a later `park` reuses it, so a re-park keeps its age. A record comment + removed by hand would reset the age, so park and unpark only through the helper. A labelled PR + whose author is not named is UNKNOWN. `reason=UNCLAIMED`: an open issue of this organization that + an upstream-kind record names is not parked itself, and no open, unparked PR by anyone but a + dependency bot references it (as `owner/repo#N` from anywhere, or as `#N` after a word such as + Fixes or Part of from a PR in the issue's own repository), so no PR is working on it. A PR parked + on that issue does not hold it, and neither do PRs on its sub-issues. The + digest does not read `agent-claim/` tips: check the claim protocol's signals, then claim it + and work it to a terminal state, or park it on what really blocks it. An assignee does not count + as holding it. `reason=NO-ROUTE`: parked more than 14 days + (`--stranded-max-age-days`), whatever the blocker kind, and the record's result does not carry a + current route record. `reason=ROUTE-LAPSED`: its re-check date has passed. Either way, take the + next engineering route yourself and record it. The digest only reads a route record written + into the record's result, after `last-verified`, as `;`-separated segments: exactly one that + starts `tried: `, one that starts + `next: `, and one that is exactly `re-check `, + from today up to 14 days ahead. That segment is the only place the result may use re-check as a + word: a date inside a `tried:` or `next:` value, or anywhere else, makes it no route, while + "re-checked" in prose does not count. The digest cannot judge what `next:` says. Writing a wait + or an ask there still counts as no route. + For example: + `…: open; tried: pinning vcluster v0.30, still needs k8s 0.36; next: patch the vendored client; re-check 2026-11-20`. + An authority park needs the route record too: a maintainer ask never pauses the work. + A park date, author or blocker label that cannot be read is UNKNOWN. + +Exit `0` means every labelled PR is parked, `1` that at least one is actionable or stranded, and +`2` is UNKNOWN: then nothing is read as parked, and every labelled PR stays in the survey's own +disposition. Only this digest makes a PR parked. The label alone, a comment that says so, or an earlier run's note never does, so nobody else's comment can take a PR out of the sweep. +**A park is never a resting place** (agent-plugins#699; the `portfolio-maintenance` PR-driving +procedure holds the portable rule). `PARKED` means only that the PR needs no work on itself this run. +What blocks it is still owned, and a parked PR is never merged while it is parked: run `unpark` once +its blocker verifiably clears, then drive it under the normal gates. When you park a PR, disable +its auto-merge request and dequeue it from any merge queue, so the park holds the merge. On +2026-11-12 every open +Dependabot PR in the portfolio was parked: nine ksail gomod PRs waited on one issue, the oldest since +2026-10-05, and they filled that ecosystem's open-PR limit of 10, so no new Go update could open. + +- **An in-portfolio blocker is rung-1 finishing work**, ahead of any Ready pull. Claim it under the + claim protocol and drive it, or park it on its own blocker so the issue sweep checks its record. +- **An upstream blocker is re-checked against live releases on every record re-verification**, at + most 7 days apart. Each check also weighs a route around the wait: adapt to the new version, fork + or patch the dependency, isolate or replace the conflicting dependency, contribute upstream under + the egress rules, or split out or ignore only the blocked part of a grouped update so the rest + merges. To ignore part of an update, use the ecosystem's configuration with the range recorded + beside it, and track it on an issue in this organization that stays open until the ignore is + removed. Do not write about it on the upstream artifact. Remove the ignore when the blocker + clears. Never close the PR to do it: see *Never close a Dependabot PR to retrigger it*. +- **A blocker clears only when its fix is verifiably available to the product**: merged in the + portfolio, or released in a version the PR can take. An upstream item closed without a released + fix, or closed as not planned, still holds: when the digest reports `record=BLOCKER-CLOSED` for + one, re-park on what really blocks the PR now. A scope or design decision clears once the + decision is recorded in the park record and the change it requires is on the PR or merged. +- **Past 14 days, waiting is no longer a route.** Take engineering routes yourself, and keep + taking them until the PR merges or a newer update supersedes it. Closing it otherwise is the + separate decision that the release is unwanted (*Never close a Dependabot PR to retrigger it*), + never a way to free a slot or clear the bound. On each route, edit the park record in place: + its one `tried:` segment names the latest route and what it showed, and its one `next:` segment + names the route after it (the `STRANDED` reasons above). The `next:` route is engineering you will + do, never a wait or an ask. +- **Ownership stays with the agent** (maintainer direction 2026-11-13: *"You own the code, I do + not."*). A park never hands work to the maintainer, and no bound or timer in these rules makes + contacting the maintainer the outcome. A `maintainer-ask` is only for a genuine question of + direction you cannot settle on your own, never about what agents can do themselves. It is never a + handoff and never a substitute for the work: its default is what you will do if no answer comes, + and the routes continue meanwhile. +- **An update ecosystem stalls at its open-PR limit.** When parked PRs bring one configuration + entry's open PRs to its effective `open-pull-requests-limit` (the configured value, or the tool's + default when unset), new version updates stop opening. Dependabot's security updates have a + separate limit. One short of the limit is the last free slot: treat both as rung-1 finishing work. + Raising the limit alone hides the stall instead of clearing it. +- **A mis-park is unparked and driven.** When the PR does not touch what its blocker names, or the + blocker holds only another part of a grouped update, run `unpark` and drive the PR. A blocker + that cannot be read, or a record that names none, never justifies unparking: re-verify or repair + the record instead. + **"Is someone actively working on it?" is decided from data, never by asking.** Treat a PR as actively owned by someone else — and leave it alone this run — when any of these holds: @@ -825,16 +903,19 @@ rung-one work — when current evidence shows any of these: a required check fai never dispatched after its expected window; the branch is DIRTY/conflicting or behind with no live bot update; the exact head is green but auto-merge was never armed or did not advance inside the normal window; a merge-group was evicted or failed; or the ecosystem is pinned at its configured open-PR -limit by PRs in those states. Silence alone is not a stall, and an actively pending check is not a -failure. Queue-wide creation/merge history remains useful corroboration, but it is no longer required -when one PR's exact evidence already proves that it cannot finish itself. +limit, or one short of it, by PRs in those states or by parked PRs. Silence alone is not a stall, +and an actively pending check is not a failure. Queue-wide creation/merge history remains useful +corroboration, but it is no longer required when one PR's exact evidence already proves that it +cannot finish itself. The survey emits `AUTOMATION-OWNED (SELF-PROGRESSING)` only with the positive evidence and timestamp that justify it. It deepens every suspected or expired bot PR through the same current-head checks, conflict, queue, and control joins as other rung-one work and emits `NEEDS-FIX`, `MERGE-READY`, `ACTIVELY-OWNED`, or `QUERY-UNKNOWN` normally. A stalled bot PR counts against `nothing_on_fire` and blocks issue descent until repaired, merged, or parked on a named live blocker — and a PR the -parked digest above reports `PARKED` is exactly that, so it no longer counts. +parked digest above reports `PARKED` is exactly that, so it no longer counts. A `STRANDED` row still +counts: its park holds, but its blocker or its next route is unowned work (see *A park is never a +resting place*). Repair the root cause with the least invasive action that can finish the exact head: diagnose before retrying; rerun only a demonstrated transient once; request the bot's update/rebase where that can diff --git a/.claude/guides/merge-policy.sensors.tsv b/.claude/guides/merge-policy.sensors.tsv index 209d19174..2bb2c8b62 100644 --- a/.claude/guides/merge-policy.sensors.tsv +++ b/.claude/guides/merge-policy.sensors.tsv @@ -107,3 +107,16 @@ MP-097 dependency-automation-and-programmed-bot-prs 🔴 **The exemption proves MP-098 dependency-automation-and-programmed-bot-prs On a 404, `gh api` still prints the error body on none - - MP-099 dependency-automation-and-programmed-bot-prs So a cask PR is the exception to "qualifying PRs none - - MP-100 dependency-automation-and-programmed-bot-prs `RIPE` is necessary, not sufficient none - - +MP-101 you-own-every-pull-request-in-the-portfolio--whoever-authored-it A park is that state only while the parked digest reports the PR computational .claude/scripts/blocked-label-blocker-line-go/pulldigest.go "STRANDED" +MP-102 you-own-every-pull-request-in-the-portfolio--whoever-authored-it Its blocker is still owned work (*A park is never a resting place* below). none - - +MP-103 you-own-every-pull-request-in-the-portfolio--whoever-authored-it An authority park needs the route record too computational .claude/scripts/blocked-label-blocker-line-go/pulldigest.go return routeReason(line, o.today, o.strandedMaxAge) +MP-104 you-own-every-pull-request-in-the-portfolio--whoever-authored-it **A park is never a resting place** (agent-plugins#699 computational .claude/scripts/blocked-label-blocker-line-go/pulldigest.go "STRANDED" +MP-105 you-own-every-pull-request-in-the-portfolio--whoever-authored-it a parked PR is never merged while it is parked none - - +MP-106 you-own-every-pull-request-in-the-portfolio--whoever-authored-it Never close the PR to do it none - - +MP-107 you-own-every-pull-request-in-the-portfolio--whoever-authored-it The `next:` route is engineering you will do none - - +MP-108 you-own-every-pull-request-in-the-portfolio--whoever-authored-it A park never hands work to the maintainer none - - +MP-109 you-own-every-pull-request-in-the-portfolio--whoever-authored-it is only for a genuine question of direction you cannot settle none - - +MP-110 you-own-every-pull-request-in-the-portfolio--whoever-authored-it It is never a handoff and never a substitute for the work computational .claude/scripts/blocked-label-blocker-line-go/pulldigest.go return routeReason(line, o.today, o.strandedMaxAge) +MP-111 you-own-every-pull-request-in-the-portfolio--whoever-authored-it A blocker that cannot be read, or a record that names none, never justifies unparking none - - +MP-112 dependency-automation-and-programmed-bot-prs A `STRANDED` row still counts computational .claude/scripts/blocked-label-blocker-line-go/pulldigest.go labelled > parked +MP-113 you-own-every-pull-request-in-the-portfolio--whoever-authored-it Closing it otherwise is the separate decision that the release is unwanted none - - diff --git a/.claude/guides/work-selection.md b/.claude/guides/work-selection.md index 18a00c38f..18e527e8c 100644 --- a/.claude/guides/work-selection.md +++ b/.claude/guides/work-selection.md @@ -487,6 +487,9 @@ immutable PR creation time when the start is unknown. `updatedAt` is activity, n A PR reaches a terminal state when it is merged, parked on a named live-verified blocker, or—when a stale draft is not worth reviving—closed with every still-valid finding re-filed as an issue (an invalid or superseded finding may instead be closed with the reason recorded). +A park settles the PR, never its blocker: an in-portfolio blocker is finishing work at this rung, +and a parked dependency PR the parked digest reports `STRANDED` is still this rung's work (see +*A park is never a resting place* under [*You own EVERY pull request*](merge-policy.md#you-own-every-pull-request-in-the-portfolio--whoever-authored-it)). Closing old work creates no intake credit: the lane's total open own-PR count must not rise while the oldest cohort drains, and no replacement draft may be opened merely because an old one was disposed of. diff --git a/.claude/scripts/blocked-label-blocker-line-go/cli_suite_test.go b/.claude/scripts/blocked-label-blocker-line-go/cli_suite_test.go index bafa8dbfc..4027a0177 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/cli_suite_test.go +++ b/.claude/scripts/blocked-label-blocker-line-go/cli_suite_test.go @@ -916,7 +916,7 @@ func TestCLIComposerDigestAndContract(t *testing.T) { // entrypoint: flag plumbing, the three row shapes and both exit codes. const digestRecord = `> 🤖 Generated by the Agentic Engineer\n\n\n**Blocker:** o/r#7 | upstream | last-verified 2026-09-01: open` digestPull := func(number int, state, comments string) string { - return fmt.Sprintf(`{"repo":"d","number":%d,"pull_request":{},"labels":[{"name":"blocked"}],%s"body":"x","comments":[%s]}`, number, state, comments) + return fmt.Sprintf(`{"repo":"d","number":%d,"pull_request":{},"user":{"login":"devantler"},"labels":[{"name":"blocked"}],%s"body":"x","comments":[%s]}`, number, state, comments) } comment := `{"user":{"login":"devantler"},"body":"` + digestRecord + `"}` digest := payloadFile(t, "["+digestPull(1, `"blocker_state":"open",`, comment)+","+digestPull(2, `"blocker_state":"closed",`, comment)+","+digestPull(3, "", "")+"]") @@ -939,7 +939,9 @@ func TestCLIComposerDigestAndContract(t *testing.T) { // CONTRACT: the merge policy and the run procedure tell a run to read the // digest and what each row means. if parkRule != "" { - for _, token := range []string{"blocked-label-blocker-line.sh --org devantler-tech --parked-digest", "`PARKED # [] `", "`ACTIONABLE #", "`record=BLOCKER-CLOSED`", "`BLOCKER-SELF`", "never reads an authority blocker", "do not count it against `nothing_on_fire`", "`2` is UNKNOWN", "Only this digest makes a PR parked"} { + for _, token := range []string{"blocked-label-blocker-line.sh --org devantler-tech --parked-digest", "`PARKED # [] `", "`ACTIONABLE #", "`record=BLOCKER-CLOSED`", "`BLOCKER-SELF`", "never reads an authority blocker", "do not count it against `nothing_on_fire`", "`2` is UNKNOWN", "Only this digest makes a PR parked", + // A park is owned work, never a resting place (devantler-tech/agent-plugins#699). + "`STRANDED # reason= age=d `", "`reason=UNCLAIMED`", "`reason=NO-ROUTE`", "`reason=ROUTE-LAPSED`", "`tried: `", "`next: `", "`re-check `", "a maintainer ask never pauses the work", "**Ownership stays with the agent**", "no bound or timer in these rules makes", "handoff and never a substitute for the work", "**A park is never a resting place**", "Its blocker is still owned work", "Raising the limit alone hides the stall", "**A mis-park is unparked and driven.**"} { assert(t, "the parked-PR rule states: "+token, strings.Contains(parkRule, token), "not found in the rule paragraph") } for _, token := range []string{"--parked-digest", "BLOCKER-CLOSED", "CHECKED"} { @@ -948,6 +950,8 @@ func TestCLIComposerDigestAndContract(t *testing.T) { } assert(t, "the run procedure runs the parked digest after the survey", strings.Contains(readGuide(t, "skills/portfolio-maintenance/SKILL.md"), "blocked-label-blocker-line.sh --org devantler-tech --parked-digest"), "command not found in the run procedure") + assert(t, "the run procedure reads a STRANDED row as rung-1 work", + strings.Contains(flat(readGuide(t, "skills/portfolio-maintenance/SKILL.md")), "An `ACTIONABLE` or `STRANDED` row is rung-1 work this run"), "STRANDED is not work in the run procedure") } const ( diff --git a/.claude/scripts/blocked-label-blocker-line-go/compose.go b/.claude/scripts/blocked-label-blocker-line-go/compose.go index 4f4612f30..fd93d0867 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/compose.go +++ b/.claude/scripts/blocked-label-blocker-line-go/compose.go @@ -38,7 +38,10 @@ const composeHelp = `Compose a blocker record in the one shape the guard accepts outcome: the event in plain words, on one line. An item that must move first is an upstream blocker, so a bare reference is refused; a reference may appear beside the words. - --result what the live check found today, on one line. + --result what the live check found today, on one line. For a dependency + pull request parked past the bound, add ";"-separated segments + "tried: ", "next: " and + "re-check ", one of each (see --parked-digest). --asked authority only, and required: where and when the maintainer was asked. Ask first; a record without a fresh ask is refused. --actor engineer (default) or improver: selects the disclosure line. diff --git a/.claude/scripts/blocked-label-blocker-line-go/load_scope_test.go b/.claude/scripts/blocked-label-blocker-line-go/load_scope_test.go index 32b9fc48e..416a88a3e 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/load_scope_test.go +++ b/.claude/scripts/blocked-label-blocker-line-go/load_scope_test.go @@ -34,7 +34,7 @@ func TestParkedDigestDoesNotReadUnrelatedIssues(t *testing.T) { case "repos/o/platform/issues/900/comments?per_page=100": return []byte("[" + record + "]"), nil case "repos/o/ksail/issues/7": - return []byte(`{"number":7,"state":"open"}`), nil + return []byte(`{"number":7,"state":"open","labels":[{"name":"blocked"}]}`), nil default: return nil, errors.New("unexpected read: " + endpoint) } diff --git a/.claude/scripts/blocked-label-blocker-line-go/main.go b/.claude/scripts/blocked-label-blocker-line-go/main.go index 733013c20..e60d08dad 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/main.go +++ b/.claude/scripts/blocked-label-blocker-line-go/main.go @@ -88,6 +88,9 @@ Options: --today (default UTC today) because skipping a blocked issue needs a live check) --unrecorded-max-age-days (default 7; how long a Security issue may stay unstarted before it needs a record) + --stranded-max-age-days (default 14; how long a dependency + pull request may stay parked before its record must + show the engineering route tried and the next one) --quiet (findings only) --ask-digest (emit declared authority blockers with missing or stale ask records, oldest first, for verification before @@ -102,7 +105,24 @@ Options: --today (default UTC today) names the pull request itself, BLOCKER-UNREADABLE when a reference has no usable number; only this organization's are read, and an authority blocker's - state never is), then + state never is), + STRANDED with the reason when a dependabot[bot] or + renovate[bot] pull request would be PARKED but + stays owned work: UNCLAIMED when an open issue of + this organization its upstream record names is + neither parked itself nor referred to by an open + pull request that is neither parked nor a + dependency bot's, + NO-ROUTE or ROUTE-LAPSED when it has been parked + longer than --stranded-max-age-days, whatever its + blocker kind, and the record's result does not say + what was "tried:", the "next:" route and one + "re-check " from today to + --stranded-max-age-days ahead, exactly one of each + as its own ";"-separated segment, with no other + segment using re-check as a word; a STRANDED row is + actionable, and a park date, author or blocker fact + it cannot read is UNKNOWN; then a CHECKED line counting every one read; issue findings are not part of it and do not change its exit) Write a record with the compose subcommand (compose --help), never by hand. @@ -116,7 +136,7 @@ an orgs/ or repos/ path; nothing is printed unless every endpoint was read. Exit: 0 conforms; 1 findings; 2 UNKNOWN (usage, unreadable or incomplete input, or an --org read that saw no Security issue at all). With --parked-digest: 0 every labelled pull request is parked (or none is - labelled); 1 at least one is ACTIONABLE; 2 UNKNOWN. + labelled); 1 at least one is ACTIONABLE or STRANDED; 2 UNKNOWN. Forge reads other than searches are conditional: each page is kept privately under $XDG_CACHE_HOME (default ~/.cache) and reused only when the forge confirms it unchanged in this run, which is not charged to the request budget. @@ -154,9 +174,13 @@ type options struct { maxAge int64 verifyMaxAge int64 unrecordedMaxAge int64 - quiet bool - askDigest bool - parkedDigest bool + // strandedMaxAge bounds how long a dependency pull request may stay parked + // before its record must show the engineering route tried and the next one + // (see strandedReason). + strandedMaxAge int64 + quiet bool + askDigest bool + parkedDigest bool } func civilDate(value string) (time.Time, error) { @@ -169,7 +193,7 @@ func civilDate(value string) (time.Time, error) { // defaultOptions holds the bounds a sweep applies unless told otherwise. The // composer reads the same ones, so a record it prints is judged as it was composed. func defaultOptions() options { - return options{maxAge: 14, verifyMaxAge: 7, unrecordedMaxAge: 7} + return options{maxAge: 14, verifyMaxAge: 7, unrecordedMaxAge: 7, strandedMaxAge: 14} } func arguments(args []string) (options, bool, error) { @@ -186,7 +210,7 @@ func arguments(args []string) (options, bool, error) { o.askDigest = true case "--parked-digest": o.parkedDigest = true - case "--org", "--input", "--today", "--ask-max-age-days", "--verify-max-age-days", "--unrecorded-max-age-days": + case "--org", "--input", "--today", "--ask-max-age-days", "--verify-max-age-days", "--unrecorded-max-age-days", "--stranded-max-age-days": i++ if i == len(args) { return o, false, fmt.Errorf("%s requires a value", arg) @@ -199,7 +223,7 @@ func arguments(args []string) (options, bool, error) { o.input = value case "--today": today = value - case "--ask-max-age-days", "--verify-max-age-days", "--unrecorded-max-age-days": + case "--ask-max-age-days", "--verify-max-age-days", "--unrecorded-max-age-days", "--stranded-max-age-days": if len(value) > 9 { return o, false, fmt.Errorf("%s must have at most 9 digits", arg) } @@ -212,6 +236,8 @@ func arguments(args []string) (options, bool, error) { o.maxAge = days case "--verify-max-age-days": o.verifyMaxAge = days + case "--stranded-max-age-days": + o.strandedMaxAge = days default: o.unrecordedMaxAge = days } @@ -672,6 +698,12 @@ type issue struct { BlockerState string `json:"blocker_state"` // AskState is the explicit offline answer for the linked maintainer-ask issue. AskState string `json:"ask_state"` + // BlockerClaim is, on an --input dependency pull request whose blocker_state + // is "open", whether that in-portfolio blocker is "held" (parked itself, a + // pull request, or referred to by an open pull request that is neither parked + // nor a dependency bot's) or "unclaimed". Only + // the parked digest reads it; under --org it is read from the forge. + BlockerClaim string `json:"blocker_claim"` } // unrecordedType is the one issue type read for being unstarted: a Security diff --git a/.claude/scripts/blocked-label-blocker-line-go/parked.go b/.claude/scripts/blocked-label-blocker-line-go/parked.go index 9a4231735..1786d54fc 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/parked.go +++ b/.claude/scripts/blocked-label-blocker-line-go/parked.go @@ -33,6 +33,10 @@ type comment struct { Login string `json:"login"` } `json:"user"` Body string `json:"body"` + // CreatedAt dates the record comment. The record is edited in place, so it is + // the day the pull request was first parked; the parked digest reads it as + // the park's age for a dependency pull request (see strandedReason). + CreatedAt string `json:"created_at"` } // parked reports whether a pull request carries the blocked label. Unlike an @@ -90,6 +94,21 @@ func parkRecords(comments []comment) []string { return records } +// recordCreated returns the creation time of the one record comment of a +// parked pull request whose record parkVerdict accepted. A time that is missing +// or unreadable is an error: read as today, it would make every old park new. +func recordCreated(comments []comment) (string, error) { + for _, c := range comments { + if c.User.Login == recordAuthor && strings.HasPrefix(c.Body, disclosurePrefix) && carriesMarker(c.Body) { + if c.CreatedAt == "" { + return "", errors.New("record comment carries no created_at -- UNKNOWN") + } + return c.CreatedAt, nil + } + } + return "", errors.New("no record comment to date -- UNKNOWN") +} + // inputComments reads the comments an --input record lists for a parked pull // request. A record that lists none is UNKNOWN: read as an empty thread, it // would report a record that exists as MISSING. diff --git a/.claude/scripts/blocked-label-blocker-line-go/parked_test.go b/.claude/scripts/blocked-label-blocker-line-go/parked_test.go index 0b260c348..595933e65 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/parked_test.go +++ b/.claude/scripts/blocked-label-blocker-line-go/parked_test.go @@ -15,7 +15,9 @@ const ( func commentJSON(t *testing.T, login, body string) string { t.Helper() - raw, err := json.Marshal(map[string]any{"user": map[string]string{"login": login}, "body": body}) + // Every record is dated the day the tests take as today, so a dependency + // pull request parked by one is a new park unless a test says otherwise. + raw, err := json.Marshal(map[string]any{"user": map[string]string{"login": login}, "body": body, "created_at": "2026-09-01T00:00:00Z"}) if err != nil { t.Fatal(err) } diff --git a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go index 06c63899b..815c41aca 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go +++ b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go @@ -7,6 +7,8 @@ import ( "regexp" "strconv" "strings" + "time" + "unicode" ) // The parked digest answers one question for a survey: which open pull @@ -22,6 +24,14 @@ import ( // a label nobody backed with a record nor a park that outlived its blocker can // hide work. The bracketed note stands before the blocker text, which is the // record's own words and could otherwise imitate it. +// +// A park is still not a resting place. A dependency pull request whose park +// holds is STRANDED, and so still work, while an in-portfolio blocker it waits +// on is held by nobody, or once it has been parked past a bound without a +// current record of the engineering route tried and the next one. Parked +// Dependabot pull requests once filled an ecosystem's open-pull-request limit +// for weeks while every run read them as finished +// (devantler-tech/agent-plugins#699). // blockerReferenceRE finds every issue or pull request a blocker names: // "owner/repo#N", "repo#N" for one in this organization, or "#N" for one in the @@ -45,26 +55,35 @@ func recordBlocker(line string) (blocker, kind string) { return strings.TrimSpace(head[0]), kind } -// forgeBlockerState reads whether one issue or pull request of this -// organization is open. The answer must be that of the object asked for and one -// of the forge's two states: anything else is UNKNOWN, never open. -func forgeBlockerState(org, repo string, number int64) (string, error) { +// blockerRecord is what the digest reads of one issue or pull request a +// record names: its state and, for a parked dependency pull request, whether +// the blocker is held by anyone (see blockerState). +type blockerRecord struct { + Number int64 `json:"number"` + State string `json:"state"` + PullRequest json.RawMessage `json:"pull_request"` + Labels *[]struct { + Name string `json:"name"` + } `json:"labels"` +} + +// forgeBlocker reads one issue or pull request of this organization. The +// answer must be that of the object asked for and one of the forge's two +// states: anything else is UNKNOWN, never open. +func forgeBlocker(org, repo string, number int64) (blockerRecord, error) { + var record blockerRecord path, err := pullPath(org, repo, number) if err != nil { - return "", err + return record, err } raw, err := forgeRead(path) if err != nil { - return "", errors.New("forge read failed -- UNKNOWN, never zero") - } - var record struct { - Number int64 `json:"number"` - State string `json:"state"` + return record, errors.New("forge read failed -- UNKNOWN, never zero") } if json.Unmarshal(raw, &record) != nil || record.Number != number || (record.State != "open" && record.State != "closed") { - return "", fmt.Errorf("blocker %s#%d carries no readable state -- UNKNOWN", repo, number) + return record, fmt.Errorf("blocker %s#%d carries no readable state -- UNKNOWN", repo, number) } - return record.State, nil + return record, nil } // blockerState reports what is known about the blocker of one parked pull @@ -74,16 +93,34 @@ func forgeBlockerState(org, repo string, number int64) (string, error) { // carries no usable number. Under --org only a reference inside the // organization is read: another owner's repository is outside what a sweep may // query. An --input record states the answer in "blocker_state". -func blockerState(item issue, blocker string, o options) (string, error) { +// +// When claims is set, the pull request is a dependency pull request, and +// unclaimed reports whether an open issue it waits on is held by nobody: not +// parked itself (its own record is then checked by the issue sweep), and not +// referred to by any open pull request in pulls, which holds only those not +// parked themselves. An open pull request is work +// in flight and always held. An assignee does not hold it, because a claim +// lapses after about two hours. A label set it cannot read is UNKNOWN. An +// --input record states the answer in "blocker_claim". +func blockerState(item issue, blocker string, pulls []issue, claims bool, o options) (state string, unclaimed bool, err error) { if o.org == "" { switch item.BlockerState { case "", "open", "closed": - return item.BlockerState, nil + default: + return "", false, fmt.Errorf("pull request %s#%d carries an unreadable blocker_state -- UNKNOWN", item.Repo, item.Number) + } + if !claims || item.BlockerState != "open" { + return item.BlockerState, false, nil } - return "", fmt.Errorf("pull request %s#%d carries an unreadable blocker_state -- UNKNOWN", item.Repo, item.Number) + switch item.BlockerClaim { + case "held": + return "open", false, nil + case "unclaimed": + return "open", true, nil + } + return "", false, fmt.Errorf("dependency pull request %s#%d carries no readable blocker_claim -- UNKNOWN", item.Repo, item.Number) } text := urlRE.ReplaceAllString(blocker, " ") - state := "" for _, at := range blockerReferenceRE.FindAllStringSubmatchIndex(text, -1) { // A match that continues a longer path or word names something else. if at[0] > 0 { @@ -106,21 +143,183 @@ func blockerState(item issue, blocker string, o options) (string, error) { } number, err := strconv.ParseInt(group(3), 10, 64) if err != nil || number <= 0 { - return "unreadable", nil + return "unreadable", false, nil } if strings.EqualFold(repo, item.Repo) && number == item.Number { - return "self", nil + return "self", false, nil } - answer, err := forgeBlockerState(o.org, repo, number) + answer, err := forgeBlocker(o.org, repo, number) if err != nil { - return "", err + return "", false, err } - if answer == "closed" { - return "closed", nil + if answer.State == "closed" { + return "closed", false, nil } state = "open" + if !claims || (len(answer.PullRequest) > 0 && string(answer.PullRequest) != "null") { + continue + } + if answer.Labels == nil { + return "", false, fmt.Errorf("blocker %s#%d carries no labels, so whether anyone holds it is unproven -- UNKNOWN", repo, number) + } + held := issue{Repo: repo, Number: number, Labels: answer.Labels} + if !held.blocked() && !mentioned(held, pulls, o.org) { + unclaimed = true + } + } + return state, unclaimed, nil +} + +// A parked dependency pull request is not finished work +// (devantler-tech/agent-plugins#699). Past the bound, waiting is no longer a +// route: its record keeps, in the result, what was "tried:", the "next:" route +// and the "re-check " by which the agent looks again. The result is +// read as a list of ";"-separated segments, and only these shapes count: a +// segment that starts with "tried:" or "next:" and carries a word, and a +// segment that is exactly "re-check ", optionally ending in a period. +// Any other segment that uses re-check as a word is no route at all, so a date +// cannot be hidden in prose. +// All of it is read only from the result, after "last-verified", so a +// blocker's own text cannot supply it. +var ( + recheckSegmentRE = regexp.MustCompile(`(?i)^re-check ([0-9]{4}-[0-9]{2}-[0-9]{2})\.?$`) +) + +// recheckWords counts the uses of re-check as a word of its own in lowercase +// text, so "re-checked" or "re-checking" in ordinary prose is not one. Each +// occurrence is judged by the characters on either side of it without consuming +// them, so two uses side by side are both counted. +func recheckWords(lower string) int { + const word = "re-check" + n := 0 + for from := 0; ; { + at := strings.Index(lower[from:], word) + if at < 0 { + return n + } + at += from + before := at == 0 || !(lower[at-1] >= 'a' && lower[at-1] <= 'z' || lower[at-1] >= '0' && lower[at-1] <= '9') + end := at + len(word) + after := end == len(lower) || !(lower[end] >= 'a' && lower[end] <= 'z') + if before && after { + n++ + } + from = at + 1 + } +} + +// hasWord reports whether a segment's value holds a letter or a digit, so a +// value of punctuation alone is no route. +func hasWord(value string) bool { + return strings.IndexFunc(value, func(r rune) bool { return unicode.IsLetter(r) || unicode.IsDigit(r) }) >= 0 +} + +// civilDays counts whole days from one civil date to another. +func civilDays(from, to time.Time) int64 { + // Unix days avoid time.Duration's roughly 290-year subtraction limit. + return to.Unix()/86400 - from.Unix()/86400 +} + +// parkAge reads how many days ago a dependency pull request was parked, from +// the creation time of its one record comment. A time that is missing, +// unreadable or later than today is UNKNOWN, never a new park. +func parkAge(item issue, today time.Time) (int64, error) { + created, err := recordCreated(item.thread) + if err != nil { + return 0, fmt.Errorf("pull request %s#%d: %w", item.Repo, item.Number, err) + } + at, err := time.Parse(time.RFC3339, created) + if err != nil { + return 0, fmt.Errorf("pull request %s#%d record comment carries an unreadable created_at -- UNKNOWN", item.Repo, item.Number) + } + day, err := civilDate(at.UTC().Format("2006-01-02")) + if err != nil { + return 0, fmt.Errorf("pull request %s#%d record comment carries an unusable created_at -- UNKNOWN", item.Repo, item.Number) + } + age := civilDays(day, today) + if age < 0 { + return 0, fmt.Errorf("pull request %s#%d record comment is dated after today -- UNKNOWN", item.Repo, item.Number) } - return state, nil + return age, nil +} + +// routeReason judges the route record a long-parked record carries: "" when +// its result holds exactly one "tried:" segment and one "next:" segment, each +// with a value, and exactly one "re-check " segment from today to +// bound days ahead; ROUTE-LAPSED when that date has passed; NO-ROUTE +// otherwise. A re-check further out than the bound is no record: it would park +// the pull request past every later look. +func routeReason(line string, today time.Time, bound int64) string { + parts := strings.SplitN(line, " | last-verified ", 2) + if len(parts) != 2 { + return "NO-ROUTE" + } + // The result follows ": " and ends where an ask record begins. + _, result, found := strings.Cut(strings.SplitN(parts[1], " | asked ", 2)[0], ": ") + if !found { + return "NO-ROUTE" + } + // The whole result uses re-check as a word exactly once, and that use must + // be the re-check segment itself: a date inside a tried: or next: value, or + // anywhere else, makes the record no route. + if recheckWords(strings.ToLower(result)) != 1 { + return "NO-ROUTE" + } + tried, next := 0, 0 + var dates []string + for _, segment := range strings.Split(result, ";") { + segment = strings.TrimSpace(segment) + lower := strings.ToLower(segment) + switch { + case strings.HasPrefix(lower, "tried:"): + if !hasWord(segment[len("tried:"):]) { + return "NO-ROUTE" + } + tried++ + case strings.HasPrefix(lower, "next:"): + if !hasWord(segment[len("next:"):]) { + return "NO-ROUTE" + } + next++ + case recheckWords(lower) > 0: + date := recheckSegmentRE.FindStringSubmatch(segment) + if date == nil { + return "NO-ROUTE" + } + dates = append(dates, date[1]) + } + } + if tried != 1 || next != 1 || len(dates) != 1 { + return "NO-ROUTE" + } + recheck, err := civilDate(dates[0]) + if err != nil { + return "NO-ROUTE" + } + switch ahead := civilDays(today, recheck); { + case ahead < 0: + return "ROUTE-LAPSED" + case ahead > bound: + return "NO-ROUTE" + } + return "" +} + +// strandedReason reports why a dependency pull request whose park otherwise +// holds is still owned work, or "" when it is parked. An unclaimed +// in-portfolio blocker comes first: it is work nobody is doing. Past the bound +// every park needs a current route record, whatever its blocker kind: a +// maintainer ask is a question of direction, never a handoff, so it does not +// pause the work, and no bound ever makes contacting the maintainer the +// outcome. +func strandedReason(line string, unclaimed bool, age int64, o options) string { + switch { + case unclaimed: + return "UNCLAIMED" + case age > o.strandedMaxAge: + return routeReason(line, o.today, o.strandedMaxAge) + } + return "" } // parkedDigestReport renders one row per blocked-labelled pull request and a @@ -129,6 +328,15 @@ func blockerState(item issue, blocker string, o options) (string, error) { func parkedDigestReport(pulls []issue, o options) (string, bool, error) { var report strings.Builder labelled, parked := 0, 0 + // Only an open pull request that is not itself parked can hold a blocker: + // a parked one is waiting, not working, so one parked on the very issue it + // refers to would otherwise hold that issue for every pull request behind it. + var working []issue + for _, item := range pulls { + if item.Labels != nil && !item.parked() { + working = append(working, item) + } + } for _, item := range pulls { // A pull request record with no labels array was never read for the // label, so the digest cannot say it is not parked. @@ -139,13 +347,20 @@ func parkedDigestReport(pulls []issue, o options) (string, bool, error) { continue } labelled++ + // A dependency pull request is matched by its exact author. A labelled + // pull request whose author is not named, under --org or --input, is + // UNKNOWN: it might be a dependency pull request. + if item.User.Login == "" { + return "", false, fmt.Errorf("pull request %s#%d carries no author, so whether it is a dependency pull request is unproven -- UNKNOWN", item.Repo, item.Number) + } + dependency := dependencyBots[item.User.Login] verdict, line, _ := parkVerdict(parkRecords(item.thread), o) if verdict != "CONFORMS" { _, _ = fmt.Fprintf(&report, "%-10s %s#%d record=%s\n", "ACTIONABLE", item.Repo, item.Number, verdict) continue } blocker, kind := recordBlocker(line) - state := "" + state, unclaimed := "", false if kind == "authority" { ask := askRE.FindStringSubmatch(line) if ask == nil || ask[1] != "digest" || ask[2] == "" { @@ -176,7 +391,7 @@ func parkedDigestReport(pulls []issue, o options) (string, bool, error) { // event, not on the object either may name. if kind == "upstream" { var err error - if state, err = blockerState(item, blocker, o); err != nil { + if state, unclaimed, err = blockerState(item, blocker, working, dependency, o); err != nil { return "", false, err } } @@ -184,6 +399,16 @@ func parkedDigestReport(pulls []issue, o options) (string, bool, error) { _, _ = fmt.Fprintf(&report, "%-10s %s#%d record=%s %s\n", "ACTIONABLE", item.Repo, item.Number, reason, snippet(blocker)) continue } + if dependency { + age, err := parkAge(item, o.today) + if err != nil { + return "", false, err + } + if reason := strandedReason(line, unclaimed, age, o); reason != "" { + _, _ = fmt.Fprintf(&report, "%-10s %s#%d reason=%s age=%dd %s\n", "STRANDED", item.Repo, item.Number, reason, age, snippet(blocker)) + continue + } + } parked++ note := kind switch { diff --git a/.claude/scripts/blocked-label-blocker-line-go/pulldigest_test.go b/.claude/scripts/blocked-label-blocker-line-go/pulldigest_test.go index 1ace8d2a2..2f1fea6ab 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/pulldigest_test.go +++ b/.claude/scripts/blocked-label-blocker-line-go/pulldigest_test.go @@ -10,7 +10,7 @@ import ( // digestPull is one --input pull request in repo p with the given number, // labels fragment and comments. func digestPull(number, labels string, comments ...string) string { - return `{"repo":"p","number":` + number + `,"pull_request":{},` + labels + `"body":"**Blocker:** body/only#1","comments":[` + strings.Join(comments, ",") + `]}` + return `{"repo":"p","number":` + number + `,"pull_request":{},"user":{"login":"devantler"},` + labels + `"body":"**Blocker:** body/only#1","comments":[` + strings.Join(comments, ",") + `]}` } const blockedLabel = `"labels":[{"name":"blocked"}],` @@ -265,7 +265,7 @@ func TestParkedDigestReadsTheBlockerOfThisOrganizationFromTheForge(t *testing.T) code int want string }{ - {"an open blocker in another repository", "o/ksail#7", "repos/o/ksail/issues/7", `{"number":7,"state":"open"}`, 0, "PARKED platform#900 [upstream, blocker open] o/ksail#7\n"}, + {"an open blocker in another repository", "o/ksail#7", "repos/o/ksail/issues/7", `{"number":7,"state":"open","labels":[{"name":"blocked"}]}`, 0, "PARKED platform#900 [upstream, blocker open] o/ksail#7\n"}, {"a closed blocker in another repository", "o/ksail#7", "repos/o/ksail/issues/7", `{"number":7,"state":"closed"}`, 1, "ACTIONABLE platform#900 record=BLOCKER-CLOSED o/ksail#7\n"}, {"the organization spelled in another case", "O/ksail#7", "repos/o/ksail/issues/7", `{"number":7,"state":"closed"}`, 1, "record=BLOCKER-CLOSED"}, {"a bare reference is in the pull request's own repository", "#7", "repos/o/platform/issues/7", `{"number":7,"state":"closed"}`, 1, "ACTIONABLE platform#900 record=BLOCKER-CLOSED #7\n"}, @@ -354,7 +354,7 @@ func TestParkedDigestFindsAClosedBlockerInsideALongerBlockerText(t *testing.T) { // does not keep the park, in either order. func TestParkedDigestReadsEveryBlockerARecordNames(t *testing.T) { states := func(first, second string) map[string]string { - return map[string]string{"repos/o/ksail/issues/7": `{"number":7,"state":"` + first + `"}`, "repos/o/ksail/issues/8": `{"number":8,"state":"` + second + `"}`} + return map[string]string{"repos/o/ksail/issues/7": `{"number":7,"state":"` + first + `","labels":[{"name":"blocked"}]}`, "repos/o/ksail/issues/8": `{"number":8,"state":"` + second + `","labels":[{"name":"blocked"}]}`} } for name, tc := range map[string]struct { first, second string diff --git a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go new file mode 100644 index 000000000..e009f44db --- /dev/null +++ b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go @@ -0,0 +1,390 @@ +package main + +import ( + "encoding/json" + "errors" + "strings" + "testing" +) + +// A parked dependency pull request is owned work, never a terminal state +// (devantler-tech/agent-plugins#699). Every open Dependabot pull request of the +// portfolio once sat parked for weeks, nine of them on one issue nobody was +// working, while the digest called each one finished. These tests pin the +// STRANDED verdict that keeps such a park in the run's work. + +const ( + strandedLine = "**Blocker:** owner/repo#7 | upstream | last-verified 2026-09-01: open" + decidedLine = "**Blocker:** owner/repo#7 | upstream | last-verified 2026-09-01: open; tried: pinning the v1 SDK, still conflicts; next: patch the vendored v2 client; re-check 2026-09-05" +) + +// datedRecord is a record comment created at the given time; an empty time +// leaves created_at out. +func datedRecord(t *testing.T, line, created string) string { + t.Helper() + fields := map[string]any{"user": map[string]string{"login": "devantler"}, "body": recordHead + line} + if created != "" { + fields["created_at"] = created + } + raw, err := json.Marshal(fields) + if err != nil { + t.Fatal(err) + } + return string(raw) +} + +// botPull is an --input parked pull request by author, whose record is the +// given comment, with extra fields placed before the body. +func botPull(author, extra, record string) string { + return `[{"repo":"p","number":5,"pull_request":{},"labels":[{"name":"blocked"}],"user":{"login":"` + author + `"},` + extra + `"body":"bump","comments":[` + record + `]}]` +} + +// The tests take 2026-09-01 as today, so a record created on 2026-08-17 is 15 days old. +func TestParkedDigestStrandsALongParkedDependencyPullRequestWithoutARoute(t *testing.T) { + for _, tc := range []struct { + name, author, line, created string + extra []string + want string + }{ + {"a new park", "dependabot[bot]", strandedLine, "2026-09-01T09:00:00Z", nil, "PARKED p#5 "}, + {"exactly at the bound", "dependabot[bot]", strandedLine, "2026-08-18T23:59:59Z", nil, "PARKED p#5 "}, + {"one day past the bound", "dependabot[bot]", strandedLine, "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE age=15d owner/repo#7\n"}, + {"renovate past the bound", "renovate[bot]", strandedLine, "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE age=15d "}, + {"a current route record", "dependabot[bot]", decidedLine, "2026-08-17T00:00:00Z", nil, "PARKED p#5 "}, + {"a re-check due today", "dependabot[bot]", strings.Replace(decidedLine, "2026-09-05", "2026-09-01", 1), "2026-08-17T00:00:00Z", nil, "PARKED p#5 "}, + {"a lapsed re-check", "dependabot[bot]", strings.Replace(decidedLine, "2026-09-05", "2026-08-31", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=ROUTE-LAPSED age=15d "}, + {"a re-check at the bound ahead", "dependabot[bot]", strings.Replace(decidedLine, "2026-09-05", "2026-09-15", 1), "2026-08-17T00:00:00Z", nil, "PARKED p#5 "}, + {"a re-check past the bound ahead", "dependabot[bot]", strings.Replace(decidedLine, "2026-09-05", "2026-09-16", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a re-check that is no date", "dependabot[bot]", strings.Replace(decidedLine, "2026-09-05", "2026-02-30", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a record without what was tried", "dependabot[bot]", strings.Replace(decidedLine, "tried: pinning the v1 SDK, still conflicts; ", "", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a record without the next route", "dependabot[bot]", strings.Replace(decidedLine, "next: patch the vendored v2 client; ", "", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"two re-check dates", "dependabot[bot]", decidedLine + "; re-check 2026-09-06", "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a route written into the blocker, not the result", "dependabot[bot]", "**Blocker:** owner/repo#7 tried: x; next: y; re-check 2026-09-05 | upstream | last-verified 2026-09-01: open", "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + // The tokens are words of their own, each with a value, and the date is a whole date. + {"a token that only ends in tried:", "dependabot[bot]", strings.Replace(decidedLine, "tried:", "untried:", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a token that only ends in next:", "dependabot[bot]", strings.Replace(decidedLine, "next:", "pre-next:", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"an empty next route", "dependabot[bot]", strings.Replace(decidedLine, "next: patch the vendored v2 client;", "next: ;", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"an empty tried route", "dependabot[bot]", strings.Replace(decidedLine, "tried: pinning the v1 SDK, still conflicts;", "tried:;", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a re-check that only ends in re-check", "dependabot[bot]", strings.Replace(decidedLine, "re-check", "pre-re-check", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a re-check date with a digit too many", "dependabot[bot]", strings.Replace(decidedLine, "2026-09-05", "2026-09-051", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a re-check in a year with no day", "dependabot[bot]", strings.Replace(decidedLine, "2026-09-05", "0000-09-05", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"tokens in capitals", "dependabot[bot]", strings.NewReplacer("tried:", "TRIED:", "next:", "Next:", "re-check", "RE-CHECK").Replace(decidedLine), "2026-08-17T00:00:00Z", nil, "PARKED p#5 "}, + // Only the allowed segment shapes count: a second date hidden after a + // space, a comma or a dash, or a re-check inside prose, is no route. + {"a second re-check after a space", "dependabot[bot]", decidedLine + " re-check 2026-08-01", "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a second re-check after a comma", "dependabot[bot]", decidedLine + ",re-check 2026-08-01", "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a re-check date with a dashed suffix", "dependabot[bot]", strings.Replace(decidedLine, "2026-09-05", "2026-09-05-01", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a re-check inside prose", "dependabot[bot]", strings.Replace(decidedLine, "; re-check 2026-09-05", "; will re-check 2026-09-05", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a tried that does not lead its segment", "dependabot[bot]", strings.Replace(decidedLine, "; tried: pinning", ", tried: pinning", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a tried of punctuation alone", "dependabot[bot]", strings.Replace(decidedLine, "tried: pinning the v1 SDK, still conflicts", "tried: ,", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"two next routes", "dependabot[bot]", strings.Replace(decidedLine, "; re-check", "; next: fork it; re-check", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a stray re-check beside a valid one", "dependabot[bot]", decidedLine + "; will re-check 2026-08-01 too", "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"re-checked in prose beside a valid route", "dependabot[bot]", strings.Replace(decidedLine, "open; tried:", "open, re-checked upstream releases; still re-checking v2; tried:", 1), "2026-08-17T00:00:00Z", nil, "PARKED p#5 "}, + {"a re-check date ending in a period", "dependabot[bot]", decidedLine + ".", "2026-08-17T00:00:00Z", nil, "PARKED p#5 "}, + {"a re-check date inside the tried value", "dependabot[bot]", strings.Replace(decidedLine, "tried: pinning the v1 SDK, still conflicts", "tried: tested shim, re-check 2026-08-31", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"a re-check date inside the next value", "dependabot[bot]", strings.Replace(decidedLine, "next: patch the vendored v2 client", "next: patch it, re-check 2026-08-31", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"two uses of re-check side by side", "dependabot[bot]", strings.Replace(decidedLine, "tried: pinning the v1 SDK, still conflicts", "tried: re-check re-check", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + // No bound hands the work to the maintainer: a park of any age stays the + // agent's, held only by a current route record (maintainer, 2026-11-13). + {"a current route record long past the bound", "dependabot[bot]", decidedLine, "2026-06-01T00:00:00Z", nil, "PARKED p#5 "}, + {"an outcome wait without a route", "dependabot[bot]", "**Blocker:** the next v2 release being published | outcome | last-verified 2026-09-01: not yet; re-check 2026-09-05", "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-ROUTE "}, + {"an outcome wait with a route", "dependabot[bot]", "**Blocker:** the next v2 release being published | outcome | last-verified 2026-09-01: not yet; tried: the v2 beta, fails CI; next: backport the fix; re-check 2026-09-05", "2026-08-17T00:00:00Z", nil, "PARKED p#5 [outcome]"}, + // A maintainer ask is a question of direction, never a handoff, so it + // does not pause the work. + {"a maintainer ask without a route", "dependabot[bot]", "**Blocker:** approve the upgrade | authority | last-verified 2026-09-01: waiting | asked digest o/monorepo#40 2026-08-30", "2026-08-17T00:00:00Z", []string{`"ask_state":"open",`}, "STRANDED p#5 reason=NO-ROUTE "}, + {"a maintainer ask while routes continue", "dependabot[bot]", "**Blocker:** approve the upgrade | authority | last-verified 2026-09-01: waiting; tried: the v2 shim; next: fork the client; re-check 2026-09-05 | asked digest o/monorepo#40 2026-08-30", "2026-08-17T00:00:00Z", []string{`"ask_state":"open",`}, "PARKED p#5 [authority]"}, + {"a new maintainer ask", "dependabot[bot]", "**Blocker:** approve the upgrade | authority | last-verified 2026-09-01: waiting | asked digest o/monorepo#40 2026-08-30", "2026-08-25T00:00:00Z", []string{`"ask_state":"open",`}, "PARKED p#5 [authority]"}, + {"a wider bound", "dependabot[bot]", strandedLine, "2026-08-17T00:00:00Z", []string{"--stranded-max-age-days", "20"}, "PARKED p#5 "}, + {"a narrower bound", "dependabot[bot]", strandedLine, "2026-08-25T00:00:00Z", []string{"--stranded-max-age-days", "3"}, "STRANDED p#5 reason=NO-ROUTE age=7d "}, + // Only the exact identities are dependency pull requests: anyone else's + // park is judged as before, whatever its age. + {"the maintainer's pull request", "devantler", strandedLine, "2026-06-01T00:00:00Z", nil, "PARKED p#5 "}, + {"a lookalike author", "dependabot[bot]-fork", strandedLine, "2026-06-01T00:00:00Z", nil, "PARKED p#5 "}, + {"another spelling", "Dependabot[bot]", strandedLine, "2026-06-01T00:00:00Z", nil, "PARKED p#5 "}, + {"the app name without its suffix", "dependabot", strandedLine, "2026-06-01T00:00:00Z", nil, "PARKED p#5 "}, + } { + t.Run(tc.name, func(t *testing.T) { + extra, args := "", []string{"--parked-digest"} + for _, e := range tc.extra { + if strings.HasPrefix(e, `"`) { + extra += e + } else { + args = append(args, e) + } + } + code, out := runInput(t, botPull(tc.author, extra, datedRecord(t, tc.line, tc.created)), args...) + stranded := strings.HasPrefix(tc.want, "STRANDED") + if !strings.Contains(out, tc.want) || (code == 1) != stranded || (code == 0) == stranded { + t.Fatalf("code=%d, want %q; out:\n%s", code, tc.want, out) + } + counts := "CHECKED labelled=1 parked=1 actionable=0\n" + if stranded { + counts = "CHECKED labelled=1 parked=0 actionable=1\n" + } + if !strings.Contains(out, counts) { + t.Fatalf("missing %q; out:\n%s", counts, out) + } + }) + } +} + +// The park date is what every age verdict rests on: a record whose date cannot +// be read would make an old park look new, so the digest is UNKNOWN instead. +func TestParkedDigestIsUnknownWhenADependencyParkCannotBeDated(t *testing.T) { + for name, created := range map[string]string{ + "no created_at": "", + "an unreadable timestamp": "yesterday", + "a date only": "2026-08-01", + "a time after today": "2026-09-02T00:00:00Z", + } { + t.Run(name, func(t *testing.T) { + code, out := runInput(t, botPull("dependabot[bot]", "", datedRecord(t, strandedLine, created)), "--parked-digest") + if code != 2 || !strings.Contains(out, "UNKNOWN") || strings.Contains(out, "CHECKED") || strings.Contains(out, "PARKED") { + t.Fatalf("code=%d out:\n%s", code, out) + } + }) + } + t.Run("the maintainer's park is not dated", func(t *testing.T) { + if code, out := runInput(t, botPull("devantler", "", datedRecord(t, strandedLine, "")), "--parked-digest"); code != 0 || !strings.Contains(out, "PARKED p#5 ") { + t.Fatalf("code=%d out:\n%s", code, out) + } + }) +} + +// An in-portfolio blocker is finishing work: one that nobody holds keeps the +// dependency pull request in the run's work, at any age. +func TestParkedDigestStrandsADependencyPullRequestWhoseBlockerNobodyHolds(t *testing.T) { + record := datedRecord(t, strandedLine, "2026-09-01T00:00:00Z") + for _, tc := range []struct { + name, author, extra string + code int + want string + }{ + {"an unclaimed blocker", "renovate[bot]", `"blocker_state":"open","blocker_claim":"unclaimed",`, 1, "STRANDED p#5 reason=UNCLAIMED age=0d owner/repo#7\n"}, + {"a held blocker", "renovate[bot]", `"blocker_state":"open","blocker_claim":"held",`, 0, "PARKED p#5 [upstream, blocker open]"}, + {"a closed blocker stays BLOCKER-CLOSED", "renovate[bot]", `"blocker_state":"closed","blocker_claim":"unclaimed",`, 1, "ACTIONABLE p#5 record=BLOCKER-CLOSED"}, + {"a blocker whose state was not read", "renovate[bot]", ``, 0, "PARKED p#5 [upstream, blocker state not read]"}, + {"no claim on an open blocker", "renovate[bot]", `"blocker_state":"open",`, 2, "blocker_claim -- UNKNOWN"}, + {"an unreadable claim", "renovate[bot]", `"blocker_state":"open","blocker_claim":"maybe",`, 2, "blocker_claim -- UNKNOWN"}, + {"the maintainer's pull request needs no claim", "devantler", `"blocker_state":"open",`, 0, "PARKED p#5 [upstream, blocker open]"}, + } { + t.Run(tc.name, func(t *testing.T) { + code, out := runInput(t, botPull(tc.author, tc.extra, record), "--parked-digest") + if code != tc.code || !strings.Contains(out, tc.want) || (code == 2) == strings.Contains(out, "CHECKED") { + t.Fatalf("code=%d, want %d and %q; out:\n%s", code, tc.code, tc.want, out) + } + }) + } + // An unclaimed blocker is reported first: a current route record past the + // bound does not hide that nobody is working on the in-portfolio blocker. + t.Run("an unclaimed blocker outranks a current route record", func(t *testing.T) { + code, out := runInput(t, botPull("renovate[bot]", `"blocker_state":"open","blocker_claim":"unclaimed",`, datedRecord(t, decidedLine, "2026-08-17T00:00:00Z")), "--parked-digest") + if code != 1 || !strings.Contains(out, "STRANDED p#5 reason=UNCLAIMED age=15d ") { + t.Fatalf("code=%d out:\n%s", code, out) + } + }) +} + +// A pull request parked on the very issue it refers to is waiting, not working +// on it: it does not hold that issue for the dependency pull request behind it. +func TestParkedDigestDoesNotLetAParkedPullRequestHoldItsBlocker(t *testing.T) { + ownRecord := datedRecord(t, "**Blocker:** o/ksail#7 | upstream | last-verified 2026-09-01: open", "2026-09-01T00:00:00Z") + for _, tc := range []struct { + name, labels string + code int + want string + }{ + {"a parked pull request that refers to the issue", `[{"name":"blocked"}]`, 1, "STRANDED platform#900 reason=UNCLAIMED "}, + {"the same pull request, not parked", `[]`, 0, "PARKED platform#900 [upstream, blocker open]"}, + } { + t.Run(tc.name, func(t *testing.T) { + pull := `{"repository_url":"https://api.github.com/repos/o/platform","number":900,"labels":[{"name":"blocked"}],"pull_request":{},"user":{"login":"renovate[bot]"},"title":"bump","body":"bump","comments":99}` + work := `{"repository_url":"https://api.github.com/repos/o/ksail","number":50,"labels":` + tc.labels + `,"pull_request":{},"user":{"login":"devantler"},"title":"work","body":"Related to #7","comments":99}` + original := forgeRead + t.Cleanup(func() { forgeRead = original }) + forgeRead = func(endpoint string) ([]byte, error) { + switch endpoint { + case pullEndpoint("o"): + return []byte(searchPage(pull, work)), nil + case "repos/o/platform/issues/900": + return []byte(counted(1)), nil + case "repos/o/platform/issues/900/comments?per_page=100", "repos/o/ksail/issues/50/comments?per_page=100": + return []byte("[" + ownRecord + "]"), nil + case "repos/o/ksail/issues/50": + return []byte(`{"number":50,"comments":1}`), nil + case "repos/o/ksail/issues/7": + return []byte(`{"number":7,"state":"open","labels":[]}`), nil + } + t.Errorf("unexpected read %q", endpoint) + return nil, errors.New("unexpected read") + } + code, out := runOrgDigest(t) + if code != tc.code || !strings.Contains(out, tc.want) { + t.Fatalf("code=%d, want %d and %q; out:\n%s", code, tc.code, tc.want, out) + } + }) + } +} + +// serveStranded answers the org reads for one parked pull request +// platform#900 by author, whose record names o/ksail#7, beside the other open +// pull requests given, and the blocker answer given. It returns the reads. +func serveStranded(t *testing.T, author, blocker string, others ...string) *[]string { + t.Helper() + pull := map[string]any{ + "repository_url": "https://api.github.com/repos/o/platform", "number": 900, "labels": []any{map[string]string{"name": "blocked"}}, + "pull_request": map[string]any{}, "body": "bump", "title": "bump", "comments": 99, + } + if author != "" { + pull["user"] = map[string]string{"login": author} + } + raw, err := json.Marshal(pull) + if err != nil { + t.Fatal(err) + } + record := datedRecord(t, strings.Replace(strandedLine, "owner/repo#7", "o/ksail#7", 1), "2026-09-01T00:00:00Z") + var reads []string + original := forgeRead + t.Cleanup(func() { forgeRead = original }) + forgeRead = func(endpoint string) ([]byte, error) { + reads = append(reads, endpoint) + switch endpoint { + case pullEndpoint("o"): + return []byte(searchPage(append([]string{string(raw)}, others...)...)), nil + case "repos/o/platform/issues/900": + return []byte(counted(1)), nil + case "repos/o/platform/issues/900/comments?per_page=100": + return []byte("[" + record + "]"), nil + case "repos/o/ksail/issues/7": + return []byte(blocker), nil + } + t.Errorf("unexpected read %q", endpoint) + return nil, errors.New("unexpected read") + } + return &reads +} + +// otherPull is another open pull request of the organization by author, with +// the given body. +func otherPull(author, repo, body string) string { + return `{"repository_url":"https://api.github.com/repos/o/` + repo + `","number":50,"labels":[],"pull_request":{},"user":{"login":"` + author + `"},"title":"work","body":"` + body + `","comments":0}` +} + +func TestParkedDigestReadsWhetherAnInPortfolioBlockerIsHeld(t *testing.T) { + const unlabelled = `{"number":7,"state":"open","labels":[]}` + for _, tc := range []struct { + name, author, blocker string + others []string + code int + want string + }{ + {"nobody holds it", "renovate[bot]", unlabelled, nil, 1, "STRANDED platform#900 reason=UNCLAIMED age=0d o/ksail#7\n"}, + {"it is parked itself", "renovate[bot]", `{"number":7,"state":"open","labels":[{"name":"Blocked"}]}`, nil, 0, "PARKED platform#900 [upstream, blocker open]"}, + {"an open pull request works on it", "renovate[bot]", unlabelled, []string{otherPull("devantler", "ksail", "Part of #7")}, 0, "PARKED platform#900 "}, + {"an open pull request elsewhere names it", "renovate[bot]", unlabelled, []string{otherPull("devantler", "platform", "Fixes o/ksail#7")}, 0, "PARKED platform#900 "}, + {"only a dependency pull request names it", "renovate[bot]", unlabelled, []string{otherPull("dependabot[bot]", "ksail", "Fixes #7")}, 1, "reason=UNCLAIMED"}, + {"only a number in prose names it", "renovate[bot]", unlabelled, []string{otherPull("devantler", "ksail", "we chose option #7")}, 1, "reason=UNCLAIMED"}, + {"an assignee does not hold it", "renovate[bot]", `{"number":7,"state":"open","labels":[],"assignees":[{"login":"devantler"}]}`, nil, 1, "reason=UNCLAIMED"}, + {"it is a pull request", "renovate[bot]", `{"number":7,"state":"open","pull_request":{}}`, nil, 0, "PARKED platform#900 [upstream, blocker open]"}, + {"its labels cannot be read", "renovate[bot]", `{"number":7,"state":"open"}`, nil, 2, "carries no labels, so whether anyone holds it is unproven -- UNKNOWN"}, + {"its labels are not a list", "renovate[bot]", `{"number":7,"state":"open","labels":"blocked"}`, nil, 2, "carries no readable state -- UNKNOWN"}, + {"the maintainer's pull request reads no claim", "devantler", `{"number":7,"state":"open"}`, nil, 0, "PARKED platform#900 [upstream, blocker open]"}, + {"a pull request with no author", "", `{"number":7,"state":"open","labels":[]}`, nil, 2, "carries no author"}, + } { + t.Run(tc.name, func(t *testing.T) { + reads := serveStranded(t, tc.author, tc.blocker, tc.others...) + code, out := runOrgDigest(t) + if code != tc.code || !strings.Contains(out, tc.want) || (code == 2) == strings.Contains(out, "CHECKED") { + t.Fatalf("code=%d, want %d and %q; reads=%v out:\n%s", code, tc.code, tc.want, *reads, out) + } + }) + } +} + +func TestStrandedBoundsAreNonNegativeIntegers(t *testing.T) { + for _, value := range []string{"", "-1", "two", "1234567890"} { + for _, flag := range []string{"--stranded-max-age-days"} { + if code, out := runInput(t, "[]", "--parked-digest", flag, value); code != 2 || strings.Contains(out, "CHECKED") { + t.Fatalf("%s %q: code=%d out:\n%s", flag, value, code, out) + } + } + } +} + +func TestHelpDescribesTheStrandedVerdict(t *testing.T) { + for _, token := range []string{"STRANDED", "UNCLAIMED", "NO-ROUTE", "ROUTE-LAPSED", "--stranded-max-age-days", `"tried:"`, `"next:"`, `"re-check "`, "whatever its", "ACTIONABLE or STRANDED"} { + if !strings.Contains(help, token) { + t.Fatalf("--help does not state %q", token) + } + } +} + +// A labelled pull request whose author is not named might be a dependency pull +// request, so it is UNKNOWN under --input as under --org, never PARKED. +func TestParkedDigestIsUnknownWhenAParkedPullRequestNamesNoAuthor(t *testing.T) { + record := datedRecord(t, strandedLine, "2026-06-01T00:00:00Z") + for name, user := range map[string]string{"no user": ``, "a null user": `"user":null,`, "an empty user": `"user":{},`, "an empty login": `"user":{"login":""},`} { + t.Run(name, func(t *testing.T) { + payload := `[{"repo":"p","number":5,"pull_request":{},"labels":[{"name":"blocked"}],` + user + `"body":"bump","comments":[` + record + `]}]` + if code, out := runInput(t, payload, "--parked-digest"); code != 2 || !strings.Contains(out, "carries no author") || strings.Contains(out, "CHECKED") { + t.Fatalf("code=%d out:\n%s", code, out) + } + }) + } +} + +// The park date is the record comment's own: not an earlier comment's, nor a +// later one's, and taken in UTC whatever offset the forge reports. +func TestParkAgeIsTheRecordCommentsOwnUTCDate(t *testing.T) { + other := func(created string) string { + raw, err := json.Marshal(map[string]any{"user": map[string]string{"login": "dependabot[bot]"}, "body": "rebased", "created_at": created}) + if err != nil { + t.Fatal(err) + } + return string(raw) + } + for _, tc := range []struct { + name, comments, want string + }{ + {"an older comment before the record", other("2026-06-01T00:00:00Z") + "," + datedRecord(t, strandedLine, "2026-08-30T00:00:00Z"), "PARKED p#5 "}, + {"a newer comment after the record", datedRecord(t, strandedLine, "2026-08-01T00:00:00Z") + "," + other("2026-08-31T00:00:00Z"), "STRANDED p#5 reason=NO-ROUTE age=31d "}, + // 01:00 at +02:00 on 2026-08-18 is 23:00 UTC on 2026-08-17: 15 days, not 14. + {"an offset that crosses midnight", datedRecord(t, strandedLine, "2026-08-18T01:00:00+02:00"), "STRANDED p#5 reason=NO-ROUTE age=15d "}, + {"a year the calendar has no day for", datedRecord(t, strandedLine, "0000-01-01T00:00:00Z"), "unusable created_at -- UNKNOWN"}, + } { + t.Run(tc.name, func(t *testing.T) { + payload := `[{"repo":"p","number":5,"pull_request":{},"labels":[{"name":"blocked"}],"user":{"login":"dependabot[bot]"},"body":"bump","comments":[` + tc.comments + `]}]` + if _, out := runInput(t, payload, "--parked-digest"); !strings.Contains(out, tc.want) { + t.Fatalf("want %q; out:\n%s", tc.want, out) + } + }) + } +} + +// A closed blocker outranks an unclaimed one named before it: the park no +// longer holds at all, so the pull request is driven, not merely stranded. +func TestParkedDigestReadsEveryBlockerBeforeStranding(t *testing.T) { + record := datedRecord(t, "**Blocker:** o/ksail#7 and o/ksail#8 | upstream | last-verified 2026-09-01: open", "2026-09-01T00:00:00Z") + pull := `{"repository_url":"https://api.github.com/repos/o/platform","number":900,"labels":[{"name":"blocked"}],"pull_request":{},"user":{"login":"renovate[bot]"},"title":"bump","body":"bump","comments":99}` + original := forgeRead + t.Cleanup(func() { forgeRead = original }) + forgeRead = func(endpoint string) ([]byte, error) { + switch endpoint { + case pullEndpoint("o"): + return []byte(searchPage(pull)), nil + case "repos/o/platform/issues/900": + return []byte(counted(1)), nil + case "repos/o/platform/issues/900/comments?per_page=100": + return []byte("[" + record + "]"), nil + case "repos/o/ksail/issues/7": + return []byte(`{"number":7,"state":"open","labels":[]}`), nil + case "repos/o/ksail/issues/8": + return []byte(`{"number":8,"state":"closed","labels":[]}`), nil + } + t.Errorf("unexpected read %q", endpoint) + return nil, errors.New("unexpected read") + } + if code, out := runOrgDigest(t); code != 1 || !strings.Contains(out, "ACTIONABLE platform#900 record=BLOCKER-CLOSED") || strings.Contains(out, "STRANDED") { + t.Fatalf("code=%d out:\n%s", code, out) + } +} diff --git a/.claude/skills/portfolio-maintenance/SKILL.md b/.claude/skills/portfolio-maintenance/SKILL.md index 406a75100..79a042a0a 100644 --- a/.claude/skills/portfolio-maintenance/SKILL.md +++ b/.claude/skills/portfolio-maintenance/SKILL.md @@ -500,9 +500,10 @@ A `CR-DECLINED #` line names a PR where CodeRabbit refuses our disclose skip CodeRabbit on that PR and go to the next lane. **Then set the parked pull requests aside** (monorepo#3288): run `.claude/scripts/blocked-label-blocker-line.sh --org devantler-tech --parked-digest` once and read it -as the [merge-policy guide](../../guides/merge-policy.md) says. A `PARKED` row is finished rung-1 -work: drop it from the queue and from `nothing_on_fire`, whatever the surveyor reported for it. An -`ACTIONABLE` row is rung-1 work this run, and exit `2` parks nothing. +as the [merge-policy guide](../../guides/merge-policy.md) says. A `PARKED` row needs no work on the +PR itself: drop it from the queue and from `nothing_on_fire`, whatever the surveyor reported for it. +Its blocker is still owned work (*A park is never a resting place*). An `ACTIONABLE` or `STRANDED` +row is rung-1 work this run, and exit `2` parks nothing. **Then read the private vulnerability reports** (monorepo#4294): run `.claude/scripts/security-advisory-sweep.sh` once and handle each row as the [advance-work guide](../../guides/advance-work.md#security-advisories--private-vulnerability-reports)