Skip to content

fix(update): typed holds, one ownership rule and one checkbox reader - #207

Merged
sweepies merged 3 commits into
mainfrom
fix/update-lifecycle
Nov 9, 2026
Merged

sweepies merged 3 commits into
mainfrom
fix/update-lifecycle

Conversation

@sweepies

@sweepies sweepies commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Fourth PR that replaces implicit state machines with explicit ones (after #204, #205 and #206).

Changes

  • Typed holds. Why a plan waits used to be a free-text reason: every check in plan::build overwrote the previous one, and the dashboard, receipts and lockfile refresh matched exact strings. Plan.hold: Option<Hold> (Window, Concurrent, PerHour, WaitingForBatch, Batched, ClosedByOwner, LockfilesCurrent, MaintenanceWindow, MaintenanceDone, Blocked(text)) is set only through Plan::hold, which keeps status and reason in step. When several apply, a hold no tick can lift wins. Before, a plan outside its window whose target digest was missing could be lifted to Planned by a "Create it now anyway" tick, or listed under the wrong row. The reason text is unchanged, so PR and dashboard output stay byte-identical. BATCHED_REASON and CLOSED_BY_OWNER are gone.
  • One ownership rule. Writing accepted any recorded Patchula-Base of up to 64 letters and digits; cleanup accepted only 40 hex digits. Both now use recorded_base and all_ours. Writing's form won: the base only bounds the history inspected, and ownership comes from every commit since it being authored, verified and marked by the Count. The test fixtures also depend on non-hex fake SHAs.
  • One checkbox reader (pull_requests::checkboxes) for dashboard actions, PR re-checks and batch add/remove, which had three copies of the fence tracking.
  • Release-age permits are pruned at save to the targets still held back. If any lookup failed this run, they are kept, since dropping a valid permit would hold that update again.
  • Fix status: an advisory fixed by a batched update names the batch PR, and one whose PR its owner closed says "fixed in X, whose PR was closed".
  • Batch close order: the PR is closed before the "Moved to the batch PR" note is posted, so a failed close can't post the note twice. A failed note is recorded in the action's reason.
  • Pinned manifests are restored on Drop, so an error path can't leave a pin behind.
  • Auto-merge: a merged PR's cached merged_at is now an RFC 3339 timestamp instead of the string "merged by patchula".
  • Repository errors go through fail, so the first error names the reason and later ones (the dashboard, PR actions) don't replace it.

Looked at, no change

  • Native::AlreadyMergeable collapsing to a bool: the "waiting for a later run" label is accurate, because the Count merges those PRs itself.
  • Dashboard ticks surviving a failed run, the partial receipt restore, and receipts rebuilt each run: all deliberate.
  • Planned plans count toward prs.* before lockfile generation. That is also deliberate, so held plans never run tools.
  • A person reopening a batched PR: the batch still carries it, so it is closed again.

Follow-up

The ActionStatus split (branch vs PR statuses), a typed "stale, rerun" status for the server's requeue decision, and an ImageState enum all change the report JSON. They come next, together with a schema bump.

Tests

New tests cover hold precedence (a tick never lifts a blocked plan, in either order). The fixtures were moved to Plan::hold. The patchula-update, patchula-engine, patchula-server and patchula-cli suites pass (407 tests), and Clippy is clean.

View guided diff Turn on auto-fix

- Why a plan waits was free text, last write wins, and the dashboard,
  receipts and lockfile refresh matched exact strings. Plans now carry a
  typed Hold, set only through Plan::hold: a hold no tick can lift beats
  one a tick can, so ticking "Create it now anyway" can no longer write a
  plan that is also blocked, and a blocked plan is listed as blocked.
- Writing and cleanup decide branch ownership with one recorded_base and
  one all_ours predicate; they disagreed on the base's form.
- Dashboard, PR and batch checkboxes go through one fence-aware reader.
- Release-age permits are pruned to the versions still held back, unless
  a lookup failed this run.
- An advisory fixed by a batched update names the batch PR; one whose PR
  its owner closed says so instead of "fixed by the update".
- A batched PR is closed before the note saying so, so a failed close
  cannot post the note twice.
- Pinned manifests are restored on drop, an error path included.
- A merged PR's cached merged_at is a timestamp, not "merged by patchula".
- A repository's first error names its reason; later ones don't replace it.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula e947a24 Commit Preview URL

Branch Preview URL
Nov 08 2026, 08:46 PM

…ilure

Review findings on #207:
- With the shared alphanumeric base rule, any branch whose tip carries a
  `Patchula-Base:` GitHub cannot compare made cleanup error and failed the
  whole repository every run. A 404 or 422 compare now means the branch is
  not the Count's: cleanup skips it, and writing leaves it Protected.
- Pinned::restore forgot every original before writing them back, so a
  failure partway left the rest pinned; each is now forgotten only once
  written, and Drop retries the remainder.
- Among blockers of one kind a plan names the last again, as before typed
  holds, so multi-problem plans keep their reason text.
Second-pass review findings on #207:
- A blocked plan whose PR the batch carries closed as batched but was
  shown as blocked; Batched now outranks every other hold, as its reason
  did before typed holds.
- Plan::hold and keep broke ties in opposite directions; both keep the
  later of equal holds.
- An advisory is credited to the batch PR only when that PR carries the
  update, and reads "whose PR was closed" only when every matching plan
  was closed.
- A test covers the write path's uncomparable recorded base.
@sweepies
sweepies merged commit 9750c75 into main Nov 9, 2026
11 checks passed
@sweepies
sweepies deleted the fix/update-lifecycle branch November 9, 2026 00:17
@sweepies
sweepies restored the fix/update-lifecycle branch November 9, 2026 00:17
@sweepies
sweepies deleted the fix/update-lifecycle branch November 9, 2026 00:17
@sweepies
sweepies restored the fix/update-lifecycle branch November 9, 2026 00:18
@sweepies
sweepies deleted the fix/update-lifecycle branch November 9, 2026 00:18
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant