From b82038f84f6d5b83c6edd2260246b60d1f5587cc Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Fri, 13 Nov 2026 01:11:45 +0100 Subject: [PATCH 1/7] feat(scripts): report a long-parked or unowned dependency PR as STRANDED The parked digest read every parked PR as finished rung-1 work. On 2026-11-12 all 11 open Dependabot PRs and 6 of 10 Renovate PRs were parked and the digest said actionable=0, while nine ksail gomod PRs waited weeks on one issue and filled the ecosystem's open-PR limit. `--parked-digest` now reports an exact dependabot[bot] or renovate[bot] PR whose park would otherwise hold as `STRANDED`, counted as actionable (exit 1), when: - UNCLAIMED: an open in-org issue its record names is neither parked itself nor referred to by an open non-bot PR (an assignee is not a claim); - ESCALATE: parked over 30 days (--escalate-max-age-days) on anything but an authority blocker; - NO-DECISION / DECISION-LAPSED: parked over 14 days (--stranded-max-age-days) without "awaits " and one "re-check " from today to the bound in the record result. The park date is the record comment's created_at; a missing or unreadable date, author, or blocker label set is UNKNOWN (exit 2). The merge policy, work selection and run procedure now say a park settles the PR, never its blocker, and describe the new row. Aligns the deployment with devantler-tech/agent-plugins#699. Co-Authored-By: Claude Opus 5.5 --- .claude/guides/merge-policy.md | 76 ++++-- .claude/guides/work-selection.md | 3 + .../cli_suite_test.go | 6 +- .../load_scope_test.go | 2 +- .../blocked-label-blocker-line-go/main.go | 49 +++- .../blocked-label-blocker-line-go/parked.go | 19 ++ .../parked_test.go | 4 +- .../pulldigest.go | 195 ++++++++++++-- .../pulldigest_test.go | 4 +- .../stranded_test.go | 239 ++++++++++++++++++ .claude/skills/portfolio-maintenance/SKILL.md | 7 +- 11 files changed, 548 insertions(+), 56 deletions(-) create mode 100644 .claude/scripts/blocked-label-blocker-line-go/stranded_test.go diff --git a/.claude/guides/merge-policy.md b/.claude/guides/merge-policy.md index 3a83cf8e1..475fc7641 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 ends the work +on the PR itself, never the work behind it: 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: - `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,52 @@ 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. `reason=UNCLAIMED`: an open issue of + this organization that the record names is not parked itself, and no open PR refers to it, so + nobody is working on it. 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-DECISION`: parked more than 14 days + (`--stranded-max-age-days`) and the record's result does not carry a current decision. + `reason=DECISION-LAPSED`: its re-check date has passed. `reason=ESCALATE`: parked more than 30 days + (`--escalate-max-age-days`) on anything but an authority blocker. Re-park it on the maintainer + decision it now needs, under *An authority park must enter the maintainer digest*. + The digest only reads a decision written into the record's result, after `last-verified`: the + route taken or why none exists, then `awaits ` and + `re-check `, from today up to 14 days ahead. For example: + `…: open; no route: the fix is upstream only; awaits Kyverno v1.17.0 release; re-check 2026-11-20`. + 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. 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, + 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 and the blocker recorded beside + it and on the blocker issue, and remove the ignore when the blocker clears. Never close the PR to + do it: see *Never close a Dependabot PR to retrigger it*. +- **Past 14 days a dependency PR's record carries the decision**, and past 30 days it is re-parked + as an authority blocker, through the `STRANDED` reasons above. +- **An update ecosystem stalls at its open-PR limit.** When parked PRs bring one configuration + entry's open PRs (one package manager and directory) to its `open-pull-requests-limit` or one + short of it, new updates stop opening, security fixes included. Treat that 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. + **"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 +868,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 decision 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/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..5e8597d9b 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 @@ -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-DECISION`", "`reason=DECISION-LAPSED`", "`reason=ESCALATE`", "`awaits `", "`re-check `", "**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/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..9e0126b23 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/main.go +++ b/.claude/scripts/blocked-label-blocker-line-go/main.go @@ -88,6 +88,11 @@ 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 + carry a current decision) + --escalate-max-age-days (default 30; how long one may stay + parked before it must wait on a maintainer ask) --quiet (findings only) --ask-digest (emit declared authority blockers with missing or stale ask records, oldest first, for verification before @@ -102,7 +107,21 @@ 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 it waits on is neither parked + itself nor referred to by an open pull request, + ESCALATE when it has been parked longer than + --escalate-max-age-days on anything but an authority + blocker, NO-DECISION or DECISION-LAPSED when it has + been parked longer than --stranded-max-age-days and + the record's result does not say what it "awaits" + with a "re-check " from today to + --stranded-max-age-days ahead; 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 +135,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 +173,14 @@ type options struct { maxAge int64 verifyMaxAge int64 unrecordedMaxAge int64 - quiet bool - askDigest bool - parkedDigest bool + // strandedMaxAge and escalateMaxAge bound how long a dependency pull + // request may stay parked before the digest asks for a decision, and then + // for the maintainer (see strandedReason). + strandedMaxAge int64 + escalateMaxAge 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, escalateMaxAge: 30} } 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", "--escalate-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", "--escalate-max-age-days": if len(value) > 9 { return o, false, fmt.Errorf("%s must have at most 9 digits", arg) } @@ -212,6 +236,10 @@ 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 + case "--escalate-max-age-days": + o.escalateMaxAge = days default: o.unrecordedMaxAge = days } @@ -672,6 +700,11 @@ 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) 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..dce3bc3b4 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go +++ b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go @@ -7,6 +7,7 @@ import ( "regexp" "strconv" "strings" + "time" ) // The parked digest answers one question for a survey: which open pull @@ -22,6 +23,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 decision or, later, without becoming a maintainer decision. 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 +54,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 +92,33 @@ 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. 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) } - return "", 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 + } + 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 +141,114 @@ 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). Its record +// keeps its decision in the result: what the pull request "awaits", and the +// "re-check " by which someone looks again. Both are read only from +// the result, after "last-verified", so a blocker's own text cannot supply them. +var ( + awaitsRE = regexp.MustCompile(`(?i)(?:^|[^A-Za-z0-9_-])awaits[\t ]+[^\t ;|]`) + recheckRE = regexp.MustCompile(`(?i)(?:^|[^A-Za-z0-9_-])re-check[\t ]+([0-9]{4}-[0-9]{2}-[0-9]{2})(?:$|[^0-9])`) +) + +// 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) } - return state, nil + 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, _ := civilDate(at.UTC().Format("2006-01-02")) + 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 age, nil +} + +// decisionReason judges the decision a long-parked record carries: "" when it +// says what it awaits and names exactly one re-check date from today to bound +// days ahead, DECISION-LAPSED when that date has passed, NO-DECISION otherwise. +// A re-check further out than the bound is no decision: it would park the pull +// request past every later look. +func decisionReason(line string, today time.Time, bound int64) string { + parts := strings.SplitN(line, " | last-verified ", 2) + if len(parts) != 2 || !awaitsRE.MatchString(parts[1]) { + return "NO-DECISION" + } + dates := recheckRE.FindAllStringSubmatch(parts[1], -1) + if len(dates) != 1 { + return "NO-DECISION" + } + recheck, err := civilDate(dates[0][1]) + if err != nil { + return "NO-DECISION" + } + switch ahead := civilDays(today, recheck); { + case ahead < 0: + return "DECISION-LAPSED" + case ahead > bound: + return "NO-DECISION" + } + 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. Then a park +// older than the escalation bound that is not yet a maintainer decision, and +// then a park older than the decision bound without a current decision. An +// authority blocker already waits on the maintainer through its checked ask. +func strandedReason(kind, line string, unclaimed bool, age int64, o options) string { + switch { + case unclaimed: + return "UNCLAIMED" + case kind == "authority": + return "" + case age > o.escalateMaxAge: + return "ESCALATE" + case age > o.strandedMaxAge: + return decisionReason(line, o.today, o.strandedMaxAge) + } + return "" } // parkedDigestReport renders one row per blocked-labelled pull request and a @@ -139,13 +267,20 @@ func parkedDigestReport(pulls []issue, o options) (string, bool, error) { continue } labelled++ + // A dependency pull request is matched by its exact author. Under --org the + // search names every author, so one it does not name is UNKNOWN: it might + // be a dependency pull request. + if o.org != "" && 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 +311,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, pulls, dependency, o); err != nil { return "", false, err } } @@ -184,6 +319,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(kind, 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..1b08e82a0 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/pulldigest_test.go +++ b/.claude/scripts/blocked-label-blocker-line-go/pulldigest_test.go @@ -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..4d1bedfa7 --- /dev/null +++ b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go @@ -0,0 +1,239 @@ +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; no route: the fix is upstream only; awaits owner/repo v2 release; 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 TestParkedDigestStrandsALongParkedDependencyPullRequestWithoutADecision(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-DECISION age=15d owner/repo#7\n"}, + {"renovate past the bound", "renovate[bot]", strandedLine, "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-DECISION age=15d "}, + {"a current decision", "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=DECISION-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-DECISION "}, + {"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-DECISION "}, + {"a re-check without what it awaits", "dependabot[bot]", strings.Replace(decidedLine, "awaits owner/repo v2 release; ", "", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-DECISION "}, + {"two re-check dates", "dependabot[bot]", decidedLine + "; re-check 2026-09-06", "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-DECISION "}, + {"a decision written into the blocker, not the result", "dependabot[bot]", "**Blocker:** owner/repo#7 awaits v2; re-check 2026-09-05 | upstream | last-verified 2026-09-01: open", "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-DECISION "}, + {"a decision past the escalation bound", "dependabot[bot]", decidedLine, "2026-07-31T00:00:00Z", nil, "STRANDED p#5 reason=ESCALATE age=32d "}, + {"an outcome wait past the escalation bound", "dependabot[bot]", "**Blocker:** the next v2 release being published | outcome | last-verified 2026-09-01: not yet; awaits v2; re-check 2026-09-05", "2026-07-31T00:00:00Z", nil, "STRANDED p#5 reason=ESCALATE "}, + {"an authority wait past the escalation bound", "dependabot[bot]", "**Blocker:** approve the upgrade | authority | last-verified 2026-09-01: waiting | asked digest o/monorepo#40 2026-08-30", "2026-07-31T00:00:00Z", []string{`"ask_state":"open",`}, "PARKED p#5 [authority]"}, + {"a wider decision bound", "dependabot[bot]", strandedLine, "2026-08-17T00:00:00Z", []string{"--stranded-max-age-days", "20"}, "PARKED p#5 "}, + {"a narrower escalation bound", "dependabot[bot]", decidedLine, "2026-08-17T00:00:00Z", []string{"--escalate-max-age-days", "10"}, "STRANDED p#5 reason=ESCALATE age=15d "}, + // 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) + } + }) + } +} + +// 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", "--escalate-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", "ESCALATE", "NO-DECISION", "DECISION-LAPSED", "--stranded-max-age-days", "--escalate-max-age-days", `"re-check "`, "ACTIONABLE or STRANDED"} { + if !strings.Contains(help, token) { + t.Fatalf("--help does not state %q", token) + } + } +} 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) From 9cfb5648440fbe5413c264d11859a2982a196f6b Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Fri, 13 Nov 2026 01:17:05 +0100 Subject: [PATCH 2/7] fix(scripts): never make contacting the maintainer the outcome of a park timer Maintainer correction 2026-11-13: "You own the code, I do not." Drop STRANDED reason=ESCALATE and --escalate-max-age-days. Past --stranded-max-age-days every parked dependency PR, whatever its blocker kind, needs a current route record in its result: "tried: ", "next: " and one "re-check " within the bound (NO-ROUTE / ROUTE-LAPSED otherwise). An authority park is no longer exempt, because a maintainer ask never pauses the work. The merge policy says ownership stays with the agent and a maintainer-ask is only a direction question with a stated default. Co-Authored-By: Claude Opus 5.5 --- .claude/guides/merge-policy.md | 41 +++++++------ .../cli_suite_test.go | 2 +- .../blocked-label-blocker-line-go/main.go | 30 ++++------ .../pulldigest.go | 57 +++++++++---------- .../stranded_test.go | 44 ++++++++------ 5 files changed, 91 insertions(+), 83 deletions(-) diff --git a/.claude/guides/merge-policy.md b/.claude/guides/merge-policy.md index 475fc7641..49fefd42c 100644 --- a/.claude/guides/merge-policy.md +++ b/.claude/guides/merge-policy.md @@ -219,15 +219,15 @@ counts them: `age` counts days since its record comment was created. `reason=UNCLAIMED`: an open issue of this organization that the record names is not parked itself, and no open PR refers to it, so nobody is working on it. 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-DECISION`: parked more than 14 days - (`--stranded-max-age-days`) and the record's result does not carry a current decision. - `reason=DECISION-LAPSED`: its re-check date has passed. `reason=ESCALATE`: parked more than 30 days - (`--escalate-max-age-days`) on anything but an authority blocker. Re-park it on the maintainer - decision it now needs, under *An authority park must enter the maintainer digest*. - The digest only reads a decision written into the record's result, after `last-verified`: the - route taken or why none exists, then `awaits ` and - `re-check `, from today up to 14 days ahead. For example: - `…: open; no route: the fix is upstream only; awaits Kyverno v1.17.0 release; re-check 2026-11-20`. + 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`: `tried: `, then + `next: ` and one `re-check `, from today up to 14 days + ahead. 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 @@ -245,14 +245,21 @@ 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, - 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 and the blocker recorded beside - it and on the blocker issue, and remove the ignore when the blocker clears. Never close the PR to - do it: see *Never close a Dependabot PR to retrigger it*. -- **Past 14 days a dependency PR's record carries the decision**, and past 30 days it is re-parked - as an authority blocker, through the `STRANDED` reasons above. + 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 and the + blocker recorded beside it and on the blocker issue, and remove the ignore when the blocker + clears. Never close the PR to do it: see *Never close a Dependabot PR to retrigger it*. +- **Past 14 days, waiting is no longer a route.** Take engineering routes yourself, and keep + taking them until the PR merges. Record each one in the park record (the `STRANDED` reasons + above). +- **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 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 (one package manager and directory) to its `open-pull-requests-limit` or one short of it, new updates stop opening, security fixes included. Treat that as rung-1 finishing 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 5e8597d9b..7cb3b30b4 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 @@ -941,7 +941,7 @@ func TestCLIComposerDigestAndContract(t *testing.T) { 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", // A park is owned work, never a resting place (devantler-tech/agent-plugins#699). - "`STRANDED # reason= age=d `", "`reason=UNCLAIMED`", "`reason=NO-DECISION`", "`reason=DECISION-LAPSED`", "`reason=ESCALATE`", "`awaits `", "`re-check `", "**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.**"} { + "`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 makes contacting the", "never a handoff", "**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"} { diff --git a/.claude/scripts/blocked-label-blocker-line-go/main.go b/.claude/scripts/blocked-label-blocker-line-go/main.go index 9e0126b23..e893676d2 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/main.go +++ b/.claude/scripts/blocked-label-blocker-line-go/main.go @@ -90,9 +90,7 @@ Options: --today (default UTC today) 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 - carry a current decision) - --escalate-max-age-days (default 30; how long one may stay - parked before it must wait on a maintainer ask) + 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 @@ -113,12 +111,11 @@ Options: --today (default UTC today) stays owned work: UNCLAIMED when an open issue of this organization it waits on is neither parked itself nor referred to by an open pull request, - ESCALATE when it has been parked longer than - --escalate-max-age-days on anything but an authority - blocker, NO-DECISION or DECISION-LAPSED when it has - been parked longer than --stranded-max-age-days and - the record's result does not say what it "awaits" - with a "re-check " from today to + 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; a STRANDED row is actionable, and a park date, author or blocker fact it cannot read is UNKNOWN; then @@ -173,11 +170,10 @@ type options struct { maxAge int64 verifyMaxAge int64 unrecordedMaxAge int64 - // strandedMaxAge and escalateMaxAge bound how long a dependency pull - // request may stay parked before the digest asks for a decision, and then - // for the maintainer (see strandedReason). + // 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 - escalateMaxAge int64 quiet bool askDigest bool parkedDigest bool @@ -193,7 +189,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, strandedMaxAge: 14, escalateMaxAge: 30} + return options{maxAge: 14, verifyMaxAge: 7, unrecordedMaxAge: 7, strandedMaxAge: 14} } func arguments(args []string) (options, bool, error) { @@ -210,7 +206,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", "--stranded-max-age-days", "--escalate-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) @@ -223,7 +219,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", "--stranded-max-age-days", "--escalate-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) } @@ -238,8 +234,6 @@ func arguments(args []string) (options, bool, error) { o.verifyMaxAge = days case "--stranded-max-age-days": o.strandedMaxAge = days - case "--escalate-max-age-days": - o.escalateMaxAge = days default: o.unrecordedMaxAge = days } diff --git a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go index dce3bc3b4..06187765e 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go +++ b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go @@ -27,7 +27,7 @@ import ( // 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 decision or, later, without becoming a maintainer decision. Parked +// 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). @@ -169,12 +169,14 @@ func blockerState(item issue, blocker string, pulls []issue, claims bool, o opti } // A parked dependency pull request is not finished work -// (devantler-tech/agent-plugins#699). Its record -// keeps its decision in the result: what the pull request "awaits", and the -// "re-check " by which someone looks again. Both are read only from -// the result, after "last-verified", so a blocker's own text cannot supply them. +// (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. All three are +// read only from the result, after "last-verified", so a blocker's own text +// cannot supply them. var ( - awaitsRE = regexp.MustCompile(`(?i)(?:^|[^A-Za-z0-9_-])awaits[\t ]+[^\t ;|]`) + triedRE = regexp.MustCompile(`(?i)(?:^|[^A-Za-z0-9_-])tried:[\t ]*[^\t ;|]`) + nextRE = regexp.MustCompile(`(?i)(?:^|[^A-Za-z0-9_-])next:[\t ]*[^\t ;|]`) recheckRE = regexp.MustCompile(`(?i)(?:^|[^A-Za-z0-9_-])re-check[\t ]+([0-9]{4}-[0-9]{2}-[0-9]{2})(?:$|[^0-9])`) ) @@ -204,49 +206,46 @@ func parkAge(item issue, today time.Time) (int64, error) { return age, nil } -// decisionReason judges the decision a long-parked record carries: "" when it -// says what it awaits and names exactly one re-check date from today to bound -// days ahead, DECISION-LAPSED when that date has passed, NO-DECISION otherwise. -// A re-check further out than the bound is no decision: it would park the pull -// request past every later look. -func decisionReason(line string, today time.Time, bound int64) string { +// routeReason judges the route record a long-parked record carries: "" when +// it says what was tried and the next route, and names exactly one re-check +// date 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 || !awaitsRE.MatchString(parts[1]) { - return "NO-DECISION" + if len(parts) != 2 || !triedRE.MatchString(parts[1]) || !nextRE.MatchString(parts[1]) { + return "NO-ROUTE" } dates := recheckRE.FindAllStringSubmatch(parts[1], -1) if len(dates) != 1 { - return "NO-DECISION" + return "NO-ROUTE" } recheck, err := civilDate(dates[0][1]) if err != nil { - return "NO-DECISION" + return "NO-ROUTE" } switch ahead := civilDays(today, recheck); { case ahead < 0: - return "DECISION-LAPSED" + return "ROUTE-LAPSED" case ahead > bound: - return "NO-DECISION" + 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. Then a park -// older than the escalation bound that is not yet a maintainer decision, and -// then a park older than the decision bound without a current decision. An -// authority blocker already waits on the maintainer through its checked ask. -func strandedReason(kind, line string, unclaimed bool, age int64, o options) string { +// 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 kind == "authority": - return "" - case age > o.escalateMaxAge: - return "ESCALATE" case age > o.strandedMaxAge: - return decisionReason(line, o.today, o.strandedMaxAge) + return routeReason(line, o.today, o.strandedMaxAge) } return "" } @@ -324,7 +323,7 @@ func parkedDigestReport(pulls []issue, o options) (string, bool, error) { if err != nil { return "", false, err } - if reason := strandedReason(kind, line, unclaimed, age, o); reason != "" { + 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 } diff --git a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go index 4d1bedfa7..1c8f5fbd2 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go +++ b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go @@ -15,7 +15,7 @@ import ( 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; no route: the fix is upstream only; awaits owner/repo v2 release; re-check 2026-09-05" + 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 @@ -40,7 +40,7 @@ func botPull(author, extra, record string) string { } // The tests take 2026-09-01 as today, so a record created on 2026-08-17 is 15 days old. -func TestParkedDigestStrandsALongParkedDependencyPullRequestWithoutADecision(t *testing.T) { +func TestParkedDigestStrandsALongParkedDependencyPullRequestWithoutARoute(t *testing.T) { for _, tc := range []struct { name, author, line, created string extra []string @@ -48,22 +48,30 @@ func TestParkedDigestStrandsALongParkedDependencyPullRequestWithoutADecision(t * }{ {"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-DECISION age=15d owner/repo#7\n"}, - {"renovate past the bound", "renovate[bot]", strandedLine, "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-DECISION age=15d "}, - {"a current decision", "dependabot[bot]", decidedLine, "2026-08-17T00:00:00Z", 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=DECISION-LAPSED age=15d "}, + {"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-DECISION "}, - {"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-DECISION "}, - {"a re-check without what it awaits", "dependabot[bot]", strings.Replace(decidedLine, "awaits owner/repo v2 release; ", "", 1), "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-DECISION "}, - {"two re-check dates", "dependabot[bot]", decidedLine + "; re-check 2026-09-06", "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-DECISION "}, - {"a decision written into the blocker, not the result", "dependabot[bot]", "**Blocker:** owner/repo#7 awaits v2; re-check 2026-09-05 | upstream | last-verified 2026-09-01: open", "2026-08-17T00:00:00Z", nil, "STRANDED p#5 reason=NO-DECISION "}, - {"a decision past the escalation bound", "dependabot[bot]", decidedLine, "2026-07-31T00:00:00Z", nil, "STRANDED p#5 reason=ESCALATE age=32d "}, - {"an outcome wait past the escalation bound", "dependabot[bot]", "**Blocker:** the next v2 release being published | outcome | last-verified 2026-09-01: not yet; awaits v2; re-check 2026-09-05", "2026-07-31T00:00:00Z", nil, "STRANDED p#5 reason=ESCALATE "}, - {"an authority wait past the escalation bound", "dependabot[bot]", "**Blocker:** approve the upgrade | authority | last-verified 2026-09-01: waiting | asked digest o/monorepo#40 2026-08-30", "2026-07-31T00:00:00Z", []string{`"ask_state":"open",`}, "PARKED p#5 [authority]"}, - {"a wider decision bound", "dependabot[bot]", strandedLine, "2026-08-17T00:00:00Z", []string{"--stranded-max-age-days", "20"}, "PARKED p#5 "}, - {"a narrower escalation bound", "dependabot[bot]", decidedLine, "2026-08-17T00:00:00Z", []string{"--escalate-max-age-days", "10"}, "STRANDED p#5 reason=ESCALATE age=15d "}, + {"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 "}, + // 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 "}, @@ -222,7 +230,7 @@ func TestParkedDigestReadsWhetherAnInPortfolioBlockerIsHeld(t *testing.T) { func TestStrandedBoundsAreNonNegativeIntegers(t *testing.T) { for _, value := range []string{"", "-1", "two", "1234567890"} { - for _, flag := range []string{"--stranded-max-age-days", "--escalate-max-age-days"} { + 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) } @@ -231,7 +239,7 @@ func TestStrandedBoundsAreNonNegativeIntegers(t *testing.T) { } func TestHelpDescribesTheStrandedVerdict(t *testing.T) { - for _, token := range []string{"STRANDED", "UNCLAIMED", "ESCALATE", "NO-DECISION", "DECISION-LAPSED", "--stranded-max-age-days", "--escalate-max-age-days", `"re-check "`, "ACTIONABLE or STRANDED"} { + 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) } From 9b99044257553b07db2078f07b6dbd324bb1c1ff Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Fri, 13 Nov 2026 01:28:56 +0100 Subject: [PATCH 3/7] fix(scripts): close the review round's gaps in the STRANDED verdict From the local review round on #4998: - a labelled PR whose author is not named is UNKNOWN under --input as under --org (an absent, null or empty user printed PARKED for an old dependency park); - an unusable created_at year is UNKNOWN instead of a huge age; - tests now pin the record comment's own date among several comments, a +02:00 offset that crosses midnight, and a closed blocker named after an unclaimed one; - the guide says only a PARKED row is a terminal park, that age runs from the first park, what "no open PR references it" actually checks and that agent-claim tips are not read, that a stall stops version updates (Dependabot security updates have their own limit), and that an unreadable blocker never justifies unparking. Co-Authored-By: Claude Opus 5.5 --- .claude/guides/merge-policy.md | 27 ++++--- .../cli_suite_test.go | 2 +- .../pulldigest.go | 15 ++-- .../pulldigest_test.go | 2 +- .../stranded_test.go | 70 +++++++++++++++++++ 5 files changed, 98 insertions(+), 18 deletions(-) diff --git a/.claude/guides/merge-policy.md b/.claude/guides/merge-policy.md index 49fefd42c..b5d75b30c 100644 --- a/.claude/guides/merge-policy.md +++ b/.claude/guides/merge-policy.md @@ -129,9 +129,9 @@ 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**. A park ends the work -on the PR itself, never the work behind it: 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 +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. @@ -216,10 +216,14 @@ counts them: own verdict from the paragraph above: repair the record, or unpark the PR. - `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. `reason=UNCLAIMED`: an open issue of - this organization that the record names is not parked itself, and no open PR refers to it, so - nobody is working on it. 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 + `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 labelled PR whose + author is not named is UNKNOWN. `reason=UNCLAIMED`: an open issue of this organization that the + record names is not parked itself, and no open PR by anyone but a dependency bot references it + (as `owner/repo#N`, or `#N` after a word such as Fixes or Part of), so no PR is working on it. 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 @@ -262,10 +266,13 @@ ecosystem's open-PR limit of 10, so no new Go update could open. continue meanwhile. - **An update ecosystem stalls at its open-PR limit.** When parked PRs bring one configuration entry's open PRs (one package manager and directory) to its `open-pull-requests-limit` or one - short of it, new updates stop opening, security fixes included. Treat that as rung-1 finishing - work. Raising the limit alone hides the stall instead of clearing it. + short of it, new version updates stop opening (Dependabot's security updates have a separate + limit). Treat that 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. + 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: 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 7cb3b30b4..b4aa26a64 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, "", "")+"]") diff --git a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go index 06187765e..ca799908e 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go +++ b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go @@ -154,7 +154,7 @@ func blockerState(item issue, blocker string, pulls []issue, claims bool, o opti return "closed", false, nil } state = "open" - if !claims || len(answer.PullRequest) > 0 && string(answer.PullRequest) != "null" { + if !claims || (len(answer.PullRequest) > 0 && string(answer.PullRequest) != "null") { continue } if answer.Labels == nil { @@ -198,7 +198,10 @@ func parkAge(item issue, today time.Time) (int64, error) { if err != nil { return 0, fmt.Errorf("pull request %s#%d record comment carries an unreadable created_at -- UNKNOWN", item.Repo, item.Number) } - day, _ := civilDate(at.UTC().Format("2006-01-02")) + 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) @@ -266,10 +269,10 @@ func parkedDigestReport(pulls []issue, o options) (string, bool, error) { continue } labelled++ - // A dependency pull request is matched by its exact author. Under --org the - // search names every author, so one it does not name is UNKNOWN: it might - // be a dependency pull request. - if o.org != "" && item.User.Login == "" { + // 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] 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 1b08e82a0..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"}],` diff --git a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go index 1c8f5fbd2..b43cb8135 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go +++ b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go @@ -245,3 +245,73 @@ func TestHelpDescribesTheStrandedVerdict(t *testing.T) { } } } + +// 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) + } +} From 07220b79c1051e035387bb1af16db312c985c5dd Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Fri, 13 Nov 2026 01:49:15 +0100 Subject: [PATCH 4/7] fix(scripts): let only a working PR hold a blocker, and inventory the new park rules From local review round 2 on #4998 and the plugin reshape in agent-plugins#699: - a PR that is itself parked no longer holds the issue it refers to (one parked on that same issue kept the dependency PRs behind it PARKED); tested with a mutation control; - tests pin that UNCLAIMED outranks a current route record, and the token boundaries, empty values, digit count, year and case of tried:/next:/re-check; - the guide says UNCLAIMED reads upstream-kind records, a parked PR is never merged while parked, a blocker clears only when its fix is verifiably available (closed-unfixed or not-planned still holds), an ignore is tracked on an in-org issue and never written upstream, the limit is the effective one and only the full limit stops updates, `next:` must be engineering, and "no timer" is scoped to these rules; - merge-policy.sensors.tsv inventories the twelve new rule sentences (MP-101..MP-112). Co-Authored-By: Claude Opus 5.5 --- .claude/guides/merge-policy.md | 51 +++++++++------- .claude/guides/merge-policy.sensors.tsv | 12 ++++ .../cli_suite_test.go | 2 +- .../blocked-label-blocker-line-go/main.go | 5 +- .../pulldigest.go | 14 ++++- .../stranded_test.go | 58 +++++++++++++++++++ 6 files changed, 116 insertions(+), 26 deletions(-) diff --git a/.claude/guides/merge-policy.md b/.claude/guides/merge-policy.md index b5d75b30c..424ed6ab9 100644 --- a/.claude/guides/merge-policy.md +++ b/.claude/guides/merge-policy.md @@ -218,9 +218,10 @@ counts them: `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 labelled PR whose - author is not named is UNKNOWN. `reason=UNCLAIMED`: an open issue of this organization that the - record names is not parked itself, and no open PR by anyone but a dependency bot references it - (as `owner/repo#N`, or `#N` after a word such as Fixes or Part of), so no PR is working on it. The + 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`, or `#N` after a word such as Fixes or Part of), + so no PR is working on it. A PR parked on that issue does not hold it. 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 @@ -228,8 +229,9 @@ counts them: 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`: `tried: `, then - `next: ` and one `re-check `, from today up to 14 days - ahead. For example: + `next: ` and one `re-check `, from today up to + 14 days ahead. 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. @@ -242,9 +244,10 @@ 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. 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. +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. 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. @@ -252,23 +255,29 @@ ecosystem's open-PR limit of 10, so no new Go update could open. 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 and the - blocker recorded beside it and on the blocker issue, and remove the ignore when the blocker + 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. - **Past 14 days, waiting is no longer a route.** Take engineering routes yourself, and keep - taking them until the PR merges. Record each one in the park record (the `STRANDED` reasons - above). + taking them until the PR merges or is closed for a recorded reason. Record each one in the park + record (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 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. + 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 (one package manager and directory) to its `open-pull-requests-limit` or one - short of it, new version updates stop opening (Dependabot's security updates have a separate - limit). Treat that as rung-1 finishing work. Raising the limit alone hides the stall instead of - clearing it. + 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 diff --git a/.claude/guides/merge-policy.sensors.tsv b/.claude/guides/merge-policy.sensors.tsv index 209d19174..2cea3c4f3 100644 --- a/.claude/guides/merge-policy.sensors.tsv +++ b/.claude/guides/merge-policy.sensors.tsv @@ -107,3 +107,15 @@ 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). computational .claude/scripts/blocked-label-blocker-line-go/pulldigest.go "UNCLAIMED" +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 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 b4aa26a64..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 @@ -941,7 +941,7 @@ func TestCLIComposerDigestAndContract(t *testing.T) { 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", // 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 makes contacting the", "never a handoff", "**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.**"} { + "`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"} { diff --git a/.claude/scripts/blocked-label-blocker-line-go/main.go b/.claude/scripts/blocked-label-blocker-line-go/main.go index e893676d2..727c34ab9 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/main.go +++ b/.claude/scripts/blocked-label-blocker-line-go/main.go @@ -109,8 +109,9 @@ Options: --today (default UTC today) 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 it waits on is neither parked - itself nor referred to by an open pull request, + this organization its upstream record names is + neither parked itself nor referred to by an open + pull request that is not itself parked, 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 diff --git a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go index ca799908e..0adeeb058 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go +++ b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go @@ -96,7 +96,8 @@ func forgeBlocker(org, repo string, number int64) (blockerRecord, 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. An open pull request is work +// 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". @@ -259,6 +260,15 @@ func strandedReason(line string, unclaimed bool, age int64, o options) string { 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. @@ -313,7 +323,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, unclaimed, err = blockerState(item, blocker, pulls, dependency, o); err != nil { + if state, unclaimed, err = blockerState(item, blocker, working, dependency, o); err != nil { return "", false, err } } diff --git a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go index b43cb8135..28fbced45 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go +++ b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go @@ -60,6 +60,15 @@ func TestParkedDigestStrandsALongParkedDependencyPullRequestWithoutARoute(t *tes {"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 "}, // 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 "}, @@ -151,6 +160,55 @@ func TestParkedDigestStrandsADependencyPullRequestWhoseBlockerNobodyHolds(t *tes } }) } + // 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 From 7a5cd3a24f4805fea61c9a9f714c8231ddef9304 Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Fri, 13 Nov 2026 02:15:55 +0100 Subject: [PATCH 5/7] refactor(scripts): read the route record as an allow-listed segment grammar Review round 3 on #4998 found a second date hidden after a space, comma or dash slipping past the re-check regex's boundaries; the third round of free-text boundary findings. Reshape once, per agent rule 3: the record's result is split on ";" and only these segment shapes count: exactly one starting "tried:" and one starting "next:", each carrying a letter or digit, and exactly one that is exactly "re-check ". Any other segment mentioning re-check is no route. Tests cover the space, comma, dash, prose, non-leading token, punctuation-only value, two next routes and a stray re-check beside a valid one, with a mutation control. Also from that round and agent-plugins#699's latest round: the guide says parking disables auto-merge and dequeues, a decision blocker clears once recorded and applied, a park closes only when superseded or the release is unwanted (never to free a slot), STRANDED rows count in actionable=, and help names the dependency-bot exclusion; MP-102 is marked prose-only and MP-113 inventories the new closing rule. Co-Authored-By: Claude Opus 5.5 --- .claude/guides/merge-policy.md | 28 +++++--- .claude/guides/merge-policy.sensors.tsv | 3 +- .../blocked-label-blocker-line-go/main.go | 6 +- .../pulldigest.go | 68 ++++++++++++++----- .../stranded_test.go | 10 +++ 5 files changed, 85 insertions(+), 30 deletions(-) diff --git a/.claude/guides/merge-policy.md b/.claude/guides/merge-policy.md index 424ed6ab9..bf171453e 100644 --- a/.claude/guides/merge-policy.md +++ b/.claude/guides/merge-policy.md @@ -194,7 +194,7 @@ else's comment can park a PR or clear a finding, and a record written without th **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. The PR itself needs no work this run. Do not diagnose it @@ -228,10 +228,12 @@ counts them: (`--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`: `tried: `, then - `next: ` and one `re-check `, from today up to - 14 days ahead. The digest cannot judge what `next:` says. Writing a wait or an ask there still - counts as no route. For example: + 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. Any other segment that mentions re-check makes it no route. 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. @@ -245,7 +247,9 @@ 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. On 2026-11-12 every open +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. @@ -262,11 +266,13 @@ Dependabot PR in the portfolio was parked: nine ksail gomod PRs waited on one is - **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. + 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 is closed for a recorded reason. Record each one in the park - record (the `STRANDED` reasons above). The `next:` route is engineering you will do, never a wait - or an ask. + 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. Record each route in the park record (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 @@ -902,7 +908,7 @@ conflict, queue, and control joins as other rung-one work and emits `NEEDS-FIX`, `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. A `STRANDED` row still -counts: its park holds, but its blocker or its decision is unowned work (see *A park is never a +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 diff --git a/.claude/guides/merge-policy.sensors.tsv b/.claude/guides/merge-policy.sensors.tsv index 2cea3c4f3..2bb2c8b62 100644 --- a/.claude/guides/merge-policy.sensors.tsv +++ b/.claude/guides/merge-policy.sensors.tsv @@ -108,7 +108,7 @@ MP-098 dependency-automation-and-programmed-bot-prs On a 404, `gh api` still pri 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). computational .claude/scripts/blocked-label-blocker-line-go/pulldigest.go "UNCLAIMED" +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 - - @@ -119,3 +119,4 @@ MP-109 you-own-every-pull-request-in-the-portfolio--whoever-authored-it is only 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/scripts/blocked-label-blocker-line-go/main.go b/.claude/scripts/blocked-label-blocker-line-go/main.go index 727c34ab9..9274eecfb 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/main.go +++ b/.claude/scripts/blocked-label-blocker-line-go/main.go @@ -111,13 +111,15 @@ Options: --today (default UTC today) 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 not itself parked, + 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; a STRANDED row is + --stranded-max-age-days ahead, each as its own + ";"-separated segment; 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 diff --git a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go index 0adeeb058..ce41f7245 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go +++ b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go @@ -8,6 +8,7 @@ import ( "strconv" "strings" "time" + "unicode" ) // The parked digest answers one question for a survey: which open pull @@ -172,14 +173,20 @@ func blockerState(item issue, blocker string, pulls []issue, claims bool, o opti // 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. All three are -// read only from the result, after "last-verified", so a blocker's own text -// cannot supply them. -var ( - triedRE = regexp.MustCompile(`(?i)(?:^|[^A-Za-z0-9_-])tried:[\t ]*[^\t ;|]`) - nextRE = regexp.MustCompile(`(?i)(?:^|[^A-Za-z0-9_-])next:[\t ]*[^\t ;|]`) - recheckRE = regexp.MustCompile(`(?i)(?:^|[^A-Za-z0-9_-])re-check[\t ]+([0-9]{4}-[0-9]{2}-[0-9]{2})(?:$|[^0-9])`) -) +// 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 ". Any other segment that +// mentions re-check 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})$`) + +// 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 { @@ -211,20 +218,49 @@ func parkAge(item issue, today time.Time) (int64, error) { } // routeReason judges the route record a long-parked record carries: "" when -// it says what was tried and the next route, and names exactly one re-check -// date 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. +// 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 || !triedRE.MatchString(parts[1]) || !nextRE.MatchString(parts[1]) { + if len(parts) != 2 { return "NO-ROUTE" } - dates := recheckRE.FindAllStringSubmatch(parts[1], -1) - if len(dates) != 1 { + // 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" + } + 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 strings.Contains(lower, "re-check"): + 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][1]) + recheck, err := civilDate(dates[0]) if err != nil { return "NO-ROUTE" } diff --git a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go index 28fbced45..300fe4eb8 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go +++ b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go @@ -69,6 +69,16 @@ func TestParkedDigestStrandsALongParkedDependencyPullRequestWithoutARoute(t *tes {"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 "}, // 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 "}, From cdfa36fec159ade0dc9d71dfba23635e1192687d Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Fri, 13 Nov 2026 02:25:03 +0100 Subject: [PATCH 6/7] fix(scripts): accept natural route-record prose and say how to keep one Nits from the first review round after the reshape on #4998 (no P0/P1): - only re-check as a word of its own voids a route record, so "re-checked upstream" in prose no longer reads as a hidden date; a re-check date may end in a period; both tested; - the guide says to keep one tried:/next: pair edited in place, how a bare #N counts, that sub-issue PRs do not hold an epic, and to park and unpark only through the helper; - compose --result help and --parked-digest help state the segment grammar; the BlockerClaim comment names the parked and dependency-bot exclusions. Co-Authored-By: Claude Opus 5.5 --- .claude/guides/merge-policy.md | 23 +++++++++++-------- .../blocked-label-blocker-line-go/compose.go | 5 +++- .../blocked-label-blocker-line-go/main.go | 8 ++++--- .../pulldigest.go | 14 +++++++---- .../stranded_test.go | 2 ++ 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/.claude/guides/merge-policy.md b/.claude/guides/merge-policy.md index bf171453e..4d05b5947 100644 --- a/.claude/guides/merge-policy.md +++ b/.claude/guides/merge-policy.md @@ -217,11 +217,13 @@ counts them. Its `actionable=` count includes the `STRANDED` rows: - `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 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`, or `#N` after a word such as Fixes or Part of), - so no PR is working on it. A PR parked on that issue does not hold it. The + 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 @@ -231,8 +233,9 @@ counts them. Its `actionable=` count includes the `STRANDED` rows: 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. Any other segment that mentions re-check makes it no route. The - digest cannot judge what `next:` says. Writing a wait or an ask there still counts as no route. + from today up to 14 days ahead. Any other segment that uses re-check as a word makes it no + route; "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. @@ -271,8 +274,10 @@ Dependabot PR in the portfolio was parked: nine ksail gomod PRs waited on one is - **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. Record each route in the park record (the - `STRANDED` reasons above). The `next:` route is engineering you will do, never a wait or an ask. + 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 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/main.go b/.claude/scripts/blocked-label-blocker-line-go/main.go index 9274eecfb..e60d08dad 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/main.go +++ b/.claude/scripts/blocked-label-blocker-line-go/main.go @@ -118,8 +118,9 @@ Options: --today (default UTC today) 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, each as its own - ";"-separated segment; a STRANDED row is + --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 @@ -699,7 +700,8 @@ type issue struct { 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) or "unclaimed". Only + // 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"` } diff --git a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go index ce41f7245..a93d1d704 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go +++ b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go @@ -176,11 +176,17 @@ func blockerState(item issue, blocker string, pulls []issue, claims bool, o opti // 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 ". Any other segment that -// mentions re-check is no route at all, so a date cannot be hidden in prose. +// 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})$`) +var ( + recheckSegmentRE = regexp.MustCompile(`(?i)^re-check ([0-9]{4}-[0-9]{2}-[0-9]{2})\.?$`) + // recheckWordRE finds re-check as a word of its own, so "re-checked" or + // "re-checking" in ordinary prose is not read as a date written elsewhere. + recheckWordRE = regexp.MustCompile(`(^|[^a-z0-9])re-check([^a-z]|$)`) +) // hasWord reports whether a segment's value holds a letter or a digit, so a // value of punctuation alone is no route. @@ -249,7 +255,7 @@ func routeReason(line string, today time.Time, bound int64) string { return "NO-ROUTE" } next++ - case strings.Contains(lower, "re-check"): + case recheckWordRE.MatchString(lower): date := recheckSegmentRE.FindStringSubmatch(segment) if date == nil { return "NO-ROUTE" diff --git a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go index 300fe4eb8..a311a2936 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go +++ b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go @@ -79,6 +79,8 @@ func TestParkedDigestStrandsALongParkedDependencyPullRequestWithoutARoute(t *tes {"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 "}, // 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 "}, From 9f982b79058c35ca601119084989d90c74ef9d4a Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Fri, 13 Nov 2026 03:05:58 +0100 Subject: [PATCH 7/7] fix(scripts): allow re-check only in the route record's own segment CodeRabbit on #4998: a date inside a tried: or next: value was not seen, because those prefixes were matched before the value was inspected. The whole result now uses re-check as a word exactly once, and that use must be the exact re-check segment; occurrences are counted without consuming their neighbours, so two side by side both count. Tested with a mutation control. Co-Authored-By: Claude Opus 5.5 --- .claude/guides/merge-policy.md | 7 ++-- .../pulldigest.go | 34 ++++++++++++++++--- .../stranded_test.go | 3 ++ 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/.claude/guides/merge-policy.md b/.claude/guides/merge-policy.md index 4d05b5947..37a545428 100644 --- a/.claude/guides/merge-policy.md +++ b/.claude/guides/merge-policy.md @@ -233,9 +233,10 @@ counts them. Its `actionable=` count includes the `STRANDED` rows: 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. Any other segment that uses re-check as a word makes it no - route; "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. + 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. diff --git a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go index a93d1d704..815c41aca 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go +++ b/.claude/scripts/blocked-label-blocker-line-go/pulldigest.go @@ -183,11 +183,31 @@ func blockerState(item issue, blocker string, pulls []issue, claims bool, o opti // blocker's own text cannot supply it. var ( recheckSegmentRE = regexp.MustCompile(`(?i)^re-check ([0-9]{4}-[0-9]{2}-[0-9]{2})\.?$`) - // recheckWordRE finds re-check as a word of its own, so "re-checked" or - // "re-checking" in ordinary prose is not read as a date written elsewhere. - recheckWordRE = regexp.MustCompile(`(^|[^a-z0-9])re-check([^a-z]|$)`) ) +// 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 { @@ -239,6 +259,12 @@ func routeReason(line string, today time.Time, bound int64) string { 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, ";") { @@ -255,7 +281,7 @@ func routeReason(line string, today time.Time, bound int64) string { return "NO-ROUTE" } next++ - case recheckWordRE.MatchString(lower): + case recheckWords(lower) > 0: date := recheckSegmentRE.FindStringSubmatch(segment) if date == nil { return "NO-ROUTE" diff --git a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go index a311a2936..e009f44db 100644 --- a/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go +++ b/.claude/scripts/blocked-label-blocker-line-go/stranded_test.go @@ -81,6 +81,9 @@ func TestParkedDigestStrandsALongParkedDependencyPullRequestWithoutARoute(t *tes {"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 "},