fix(engine): keep one repository's failures to itself and key catalog views by registry entries
SW
5h ago+512+512+012345678901234567890123456789-71-71-01234567890123456789
Six fixes from the engine/update scan.
Fixes
- Maintenance planning errors fail only the repository.
Write::maintenanceturned aPlanErrorinto the run-levelError::Invalid, so one repository's config (say a 225-characterprs.branchwith 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 returnsStepFailure::Repo, asplans()does. Only the cache error fromdefer_completed_refreshstays run-level.prs.branchis also capped at load.patchula_confignow holdsMAX_BRANCH_LEN(240, whichbranch_nameuses),BRANCH_LABEL_ROOM(40) andMAX_BRANCH_PREFIX_LEN(200). A compile-time assert inplan.rschecks that the longest fixed label (lock-file-maintenance) plus a collision suffix fits in that room. - 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.Lifecyclenow readsdegradedonce, when it is prepared. Obsolete closure uses that value, and the engine's cleanup readsLifecycle::degraded()instead of the repository's warnings at cleanup time. - Catalog views are keyed by the operator registry entries.
CatalogScopenow carries a digest of every operator entry'sscope(), 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. - Fewer cache writes.
Savedholds aCow<Catalog>, so saving borrows the fetched catalog instead of deep-cloning it. Views are written through a newCache::set_states: one writer round trip, one transaction.BranchHintandLookupHintare no longer rewritten when they equal what was read. - The maintenance PR body has no empty table. The update table header is written only when the plan has changes.
- Case and punctuation collisions get a stable hash. Labels still shared after the manager prefix (
github.com/Sirupsen/logrusandgithub.com/sirupsen/logrusin twogo.modfiles, groupsLintersandlinters) 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.BranchCollisionnow 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.rsan_unnameable_maintenance_branch_fails_only_its_repository: a 225-character prefix with no updates. The run returnsOkand only the repository fails.config/tests/config.rsa_branch_prefix_longer_than_the_cap_is_refused_at_load.update/tests/write.rswarnings_after_preparation_leave_the_lifecycle_undegraded. Also,lookup_warnings_defer_obsolete_pr_closurenow assertsdegraded().engine/src/catalogs/tests.rsregistry_entries_key_the_views_they_may_have_read: same entry reused; a rotated or removed entry misses.update/src/pr/body/tests.rsthe_maintenance_body_has_no_empty_update_table.update/src/plan/planning.rsnames_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_lockwas 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
matchonLifecycle::degraded(). - Auto-merge's
policy_allowsstill readsrepo.degraded()after lockfile generation, so a lockfile warning still blocks auto-merge. That is deliberately conservative and unchanged here.