Skip to content

fix(engine): keep one repository's failures to itself and key catalog views by registry entries - #344

Open
sweepies wants to merge 1 commit into
mainfrom
fix/engine-update
Open

sweepies wants to merge 1 commit into
mainfrom
fix/engine-update

Conversation

@sweepies

@sweepies sweepies commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Six fixes from the engine/update scan.

Fixes

  1. Maintenance planning errors fail only the repository. Write::maintenance turned a PlanError into the run-level Error::Invalid, so one repository's config (say a 225-character prs.branch with no updates) failed the whole batch: every repository's report row, schedule turn and public record was dropped and the server backed them all off. It now returns StepFailure::Repo, as plans() does. Only the cache error from defer_completed_refresh stays run-level. prs.branch is also capped at load. patchula_config now holds MAX_BRANCH_LEN (240, which branch_name uses), BRANCH_LABEL_ROOM (40) and MAX_BRANCH_PREFIX_LEN (200). A compile-time assert in plan.rs checks that the longest fixed label (lock-file-maintenance) plus a collision suffix fits in that room.
  2. Lockfile warnings no longer turn off cleanup. Obsolete-PR closure read repo.degraded() before lockfile generation, and cleanup read it after, so a lockfile tool's warning skipped cleanup while obsolete PRs still closed, and stale branches piled up. Lifecycle now reads degraded once, when it is prepared. Obsolete closure uses that value, and the engine's cleanup reads Lifecycle::degraded() instead of the repository's warnings at cleanup time.
  3. Catalog views are keyed by the operator registry entries. CatalogScope now carries a digest of every operator entry's scope(), computed once per engine. Adding, removing or rotating an entry misses every view read before, as the HTTP cache key does. I keyed by the whole entry set, not "the matching entry": a catalog can be built from several reads, including mirror redirects, so its matching entry can't be known before the fetch. Keying by all entries is a superset and fails closed. The cost is one catalog refetch whenever any entry changes.
  4. Fewer cache writes. Saved holds a Cow<Catalog>, so saving borrows the fetched catalog instead of deep-cloning it. Views are written through a new Cache::set_states: one writer round trip, one transaction. BranchHint and LookupHint are no longer rewritten when they equal what was read.
  5. The maintenance PR body has no empty table. The update table header is written only when the plan has changes.
  6. Case and punctuation collisions get a stable hash. Labels still shared after the manager prefix (github.com/Sirupsen/logrus and github.com/sirupsen/logrus in two go.mod files, groups Linters and linters) each take -<first 8 hex of sha256(branch identity)>. The identity depends only on the dependency or group, so names stay the same from run to run and in any order. BranchCollision now only covers a hash collision, and its text no longer suggests explicit groups.

State versions: extract/files 12, config/config-files 9, catalog/catalog-controls 10, with their rows updated in tests/state-versions.tsv.

Docs: guide/pull-requests.md (collision hash, the 200-character prefix cap, which warnings skip cleanup and obsolete closure), internals/cache.md (the catalog scope), and a schema doc line on prs.branch.

Tests

  • engine/tests/write.rs an_unnameable_maintenance_branch_fails_only_its_repository: a 225-character prefix with no updates. The run returns Ok and only the repository fails.
  • config/tests/config.rs a_branch_prefix_longer_than_the_cap_is_refused_at_load.
  • update/tests/write.rs warnings_after_preparation_leave_the_lifecycle_undegraded. Also, lookup_warnings_defer_obsolete_pr_closure now asserts degraded().
  • engine/src/catalogs/tests.rs registry_entries_key_the_views_they_may_have_read: same entry reused; a rotated or removed entry misses.
  • update/src/pr/body/tests.rs the_maintenance_body_has_no_empty_update_table.
  • update/src/plan/planning.rs names_that_differ_only_in_case_or_punctuation_take_a_stable_hash: the go.mod and group cases, checked stable across runs and input order.
  • Transcripts recorded for the new tests. actions_lock_maintenance_commits_only_the_lock was re-recorded because its PR body lost the empty table.

Ran on the VM: tests for config, cache, update, engine, cli and server, the manager and lookup corpus tests, and clippy -D warnings on the changed crates.

Follow-ups

  • Item 2 has no engine-level test: producing a real lockfile warning there needs a Cargo or partial actions-relock tool fake. The update-level test pins the invariant. The engine wiring is a single match on Lifecycle::degraded().
  • Auto-merge's policy_allows still reads repo.degraded() after lockfile generation, so a lockfile warning still blocks auto-merge. That is deliberately conservative and unchanged here.

View guided diff Turn on auto-fix

… views by registry entries

- A lockfile-maintenance planning error fails only its repository
  (StepFailure::Repo), not the whole batch; only cache errors stay
  run-level. prs.branch is capped at 200 characters at load, derived from
  the shared 240-character branch limit and the room fixed labels need.
- Obsolete-PR closure and branch cleanup decide on one degraded flag,
  read when the lifecycle is prepared, so lockfile tool warnings no longer
  turn cleanup off while obsolete PRs still close.
- Catalog views are keyed by a digest of every operator registry entry's
  scope, so adding, removing or rotating an entry misses old views.
- Catalog views are saved borrowed and in one transaction; unchanged
  branch and lookup hints are not rewritten.
- The lockfile-maintenance PR body no longer opens with an empty table.
- Branch labels still shared after the manager prefix (case or
  punctuation differences) take a short stable hash of the branch
  identity instead of failing the repository with BranchCollision.
@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 b5e07a4 Commit Preview URL

Branch Preview URL
Nov 15 2026, 11:09 PM

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