Skip to content

fix(update,engine,server): failed release notes, lost catalog controls, logged causes, and a cleanup pass - #308

Merged
sweepies merged 12 commits into
mainfrom
refactor/sloppy-update-engine
Nov 14, 2026
Merged

sweepies merged 12 commits into
mainfrom
refactor/sloppy-update-engine

Conversation

@sweepies

@sweepies sweepies commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

A cleanup pass over code written during the refactor, covering crates/update, crates/engine, crates/server and crates/cli. The commits are by crate area, because the fixes use helpers from the cleanups.

Behaviour fixes

  • Release notes: a transient release-notes failure (network, timeout, 5xx, rate limit) is logged and gets its own section ("The Count could not read these release notes this run…"). That body is never settled: no write receipt is kept for it, so the next run renders and fetches again. Only a lasting failure settles: a 404, an upstream refusal, an invalid or unsafe package name. Everything else, local cache faults included, retries. When the source resolved but its notes couldn't be read, the section keeps the source link ("could not read these release notes; view upstream"); "could not be resolved" is used only when the source wasn't found. Before, every failure rendered as unresolvable and stayed in the PR. See guide/release-notes.md.
  • Catalog controls: a failed plan keeps the saved plan-derived catalog controls, and still saves this run's held-back targets. Before, it overwrote the dashboard's retry keys with nothing.
  • Maintenance: a missing extraction commit now reads "missing extraction commit" (it read "missing base").
  • Server errors: the server logs the cause when a batch or remote run fails. Startup errors include their cause, e.g. "invalid GitHub App credentials: …".
  • Auto-merge history: automerge::merged returns cache errors and filters on the actor, the same as load_history (they are now one function).
  • Dashboard trigger: it compares the bot's login case-insensitively, like the sender check.
  • Code spans: a <!-- inside a PR-body code span is escaped with a zero-width space. The previous &lt; showed literally in code spans.

Cleanup (no behaviour change)

  • Deleted the cutover oracles: pr/view/oracle.rs and the legacy inventory query. Their fail-closed admission tests moved to pr/view/tests.rs, and the inventory tests compare the filtered and unfiltered reads directly. The frozen-bytes test now calls the real branch_identity.
  • Shared helpers:
    • update: is_published, the open PR on a plan's branch, one Plan::new base, the hold-ranking rule, the scope constructor, the compare read, and the WEB_FLOW/ZERO_OID constants;
    • engine: the extraction and work builders, the credential scope, held-target expansion, one repository validator (valid_repo), and one concurrency check against MAX_CONCURRENCY;
    • server: the installation client builder and a single slot guard; installation discovery shares the engine's listing;
    • cli: the exit-code helpers and one git command builder.
  • Webhook payload: the pull request is typed, not a cloned JSON Value.
  • Narrower surfaces: the engine's test-only constructors are behind a testing feature. stored_receipts replaces three copies of the receipt state in tests.
  • Constants, comments and tests: magic numbers are named, and history-narrating comments are rewritten. A sleep-based test is replaced by a deterministic one. A table test over 162 PR shapes checks that admit consults only the closed reads it selects, which is what the deleted oracle guarded.

Notes

  • State rows are rehashed with no version bumps.
  • Transcripts:
    • six inventory tests no longer make the legacy read;
    • two write tests reflect the failed-notes fix;
    • three server discovery tests page installations through Link headers.
  • Reported only: the CLI's in-place plan ignores the committed-credentials refusal that the engine's local scan honours.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 14, 2026 •

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 05fe6f1 Commit Preview URL

Branch Preview URL
Nov 14 2026, 06:08 AM

…ttled

A release-notes fetch that fails is logged with its cause and gets its own
section ("the Count could not read these release notes this run") instead of
"source repository could not be resolved". A body with a failed fetch carries
a content marker no intent computes, so the next run fetches again instead of
reusing it as settled.

`automerge::merged`, the server's public-page reader of the auto-merge
history, returns cache errors and filters on the actor, as the inventory's
reader does; the two are one function now. The server logs a read failure.

Cleanups in the crate:
- delete the cutover oracles: `pr/view/oracle.rs` (its fail-closed
  admission tests move to `pr/view/tests.rs`), the legacy inventory document,
  `read_legacy_inventory` and the `Documents` indirection; the inventory
  tests compare the unfiltered and filtered reads and assert counts directly
- the frozen-bytes test calls `branch_identity` for the identity and branch
- drop the dashboard receipt read `reconcile` never used
- shared helpers: published-status checks, the open PR on a plan's branch,
  the GraphQL pull projection, the compare read and ownership constants,
  `is_key`, one repository scope constructor, `with_digest`, the batch label,
  the lockfile-pending wording, `Plan::new` as the base literal, `Plan::hold`
  through `keep`, one held-target pass in `Controls::apply`, `restore_closed`
- `one()` returns a `MergeNote`; `requested` is gone
- one code-span helper (`text::code`); `truncate` is `cut_bytes`
- named body budgets, closed-PR chunk and page sizes, head retries, write
  parallelism and refs per update
- `PlanError::MissingBase` merges into `MissingExtractionCommit`
- `tooling` uses a named `Unknown` instead of `Result<_, ()>`
- test fixtures `action` and `change` in `plan::testing`; unused
  `contents_mut`/`deleted_mut` removed
- comments state the present rule instead of narrating history
`save_catalog_controls` saved an empty set when planning failed, which
un-retried every ticked box on the next run. It now logs the plan error and
keeps the saved controls.

Cleanups in the crate:
- one repository validator (`patchula_config::settings::valid_repo`) and one
  concurrency check against `MAX_CONCURRENCY`, which the CLI uses too
- shared `extract_files`, `Work::from_extraction`, `credential_scope`,
  `held_targets`, the no-config reason, the Git tree mode constants and
  `mark_sent`
- `report.rs` reads the catalog and the resolved version once, compiles
  `security.quietImages` once per repository, and shares the security
  label and notice construction
- `lookup.rs` indexes catalogs by package once and shares the reused-tags
  predicate
- the catalog reuse window is computed once per key; milliseconds per hour
  are named
- the token and transport constructors are behind a `testing` feature
- `installation_repositories` and `repo_report` are public for the server
- `write.rs` reads the dry run off the absent inventory
- tests read stored write receipts through `patchula_update::stored_receipts`
- comments state the present rule instead of narrating history

The state table's rows are rehashed for the source changes; no stored state
changes meaning.
A batch whose engine run failed, and a remote run that failed, now log the
engine error before the stand-in report or the generic remote message. Server
errors carry their cause, so startup and IO failures say why ("invalid GitHub
App credentials: …").

Cleanups in the crate:
- the webhook payload's `pull_request` is a typed `model::PullRequest`;
  redundant `#[serde(default)]` and the test-only `Payload::parse` are gone
- one installation-client helper; a remote run that cannot build one logs
  why its public record is skipped
- installation discovery uses the engine's listing; the batch error report
  uses `repo_report`
- batches use `SlotGuard`, as remote runs do; `discard_on_panic` is gone
- the public API's rejection body is `RejectBody`; open PRs decode once
  without a clone
- one bot-login comparison (case-insensitive) and shared installation
  checks in the webhook classifier
- the startup contention test drops its sleep; `MAX_JOBS` counts running
  jobs too
- `fail`/`usage` helpers with named exit codes replace hand-built tuples;
  one engine-error mapping and one `PATCHULA_RECHECK` message
- the concurrency check is the engine's
- `source` no longer filters remote flags twice
- the TUI wraps with `textwrap`
- the git runners share `git_command`; tests share `copier::test_git`
- tests read stored write receipts through `patchula_update::stored_receipts`
…eceipt settles it

A release-notes fetch that fails is classified by the notes error's kind:
the network, a timeout, a server error or a rate limit may pass on a later
run; a registry 404, an unsafe name, a Go vanity host without go-get
metadata or an upstream answer the notes cannot use fails the same way every
run. Only the transient class gets the "could not read … this run" section
and the unsettled content marker; a lasting failure renders as before
("source repository could not be resolved") and settles.

A body with a transient failure no longer settles through write receipts:
`save_receipts` keeps no receipt for its branch, so the next run is not
restored from one and renders the body, and fetches the notes, again. The
receipt-path test fails the fetch on run 1 and checks run 2 fetches again.
A plan error keeps the plan-derived controls the last run saved and still records the package files' held-back targets, instead of skipping the whole save.
Over every one-PR history and a spread of two-PR histories, with and without a bring-back tick, admit decides the same whether the other heads are unanswered, answered in full or unread.
A parked-runtime barrier (paused clock on the current-thread runtime) replaces the sleep: no delivery is acknowledged while its write is locked out; one that gives up on the lock answers 503 and its redelivery is accepted.
@sweepies
sweepies force-pushed the refactor/sloppy-update-engine branch from c4ab4e5 to 3198031 Compare November 14, 2026 05:47
…eeps a resolved source

The classifier now lists the lasting conditions and keeps everything else
unsettled: an unsafe package name or a tool name mise's policy refuses, a
package or release the upstream does not know (`NotFound`), `Upstream` and
`Source(Invalid)`. The network, rate limits, `Auth`, `Parse` and every local
fault (the cache, a missing tool store, GraphQL or pagination errors) may
pass, so their bodies stay unsettled and keep no receipt. A memoised failure
keeps only its kind, so of those only `NotFound` reads as lasting.

A lasting failure after the source repository resolved keeps the source:
the section says the notes could not be read and links upstream, settled.
"Source repository could not be resolved" is left for a source that was
never found.

The guide describes both classes, the resolved-source wording, and that a
host that no longer resolves retries its notes every run.
A head closed_reads does not name already reads as Unread, so filling the other heads as unread could never differ; the comparison against heads answered in full stays.
…lock

Under the workspace's `patchula-cache/paused-clock` feature every cache call
runs in `spawn_blocking`, so a paused clock cannot auto-advance and the old
barrier waited out SQLite's busy timeout; every delivery answered 503 and the
contention path never ran. The resolver now logs, at debug, the installation
mapping write it is about to make, and the test waits for that event through
a tracing layer: one delivery is then writing against the locked database and
the others wait on its single-flight lookup. None may have answered, and
after the commit every delivery is accepted, with one shared lookup.
@sweepies
sweepies merged commit 3019fab into main Nov 14, 2026
13 checks passed
@sweepies
sweepies deleted the refactor/sloppy-update-engine branch November 14, 2026 06:15
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 14, 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