Repository navigation
fix(datasource,github): one token-realm rule, forge notes budget, and a cleanup pass - #307
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
count-patchula | 67f60fd | Commit Preview URL Branch Preview URL |
Nov 14 2026, 05:08 AM |
…b crates Behaviour fixes: - datasource: one realm-trust rule for registry token services. A realm off the registry's origin must be on port 443 and be Docker Hub's auth.docker.io/token, gitlab.com/jwt/auth for registry.gitlab.com, or a self-hosted GitLab's <instance>/jwt/auth (tokens only); anything else is refused before any request. - notes: owns its error type; a failed read returns its own error the first time and its kind and message when memoised. GitHub and forge notes share one release budget (newest versions first, 32 releases, 12,000 bytes, stop when spent) and one finish step. - http: a local cooldown past the longest wait is Error::Throttled, not a fake 429; corrupt cached metadata is Error::Metadata; transport errors keep a redacted kind (timeout, connect), which GitHub errors keep too. - github: the governor parses a body only for a rate-limit status or a GraphQL answer; installation ids are bounded like every other id; redirect loops are Error::Redirect; mints lock per mint and scoped mints cache the repository id. - config: settings validation names the failing field, registry key included; an unreadable secret file keeps its io error. Cleanups: the retired +<build> cleanup is migration 014; Docker Hub's pull window moves into the datasource rules and the http tests no longer copy them; shared helpers replace duplicates (Version::new, one tag-tree builder, the parity harness and file walker in testkit, hex, base headers, queue SQL consts); named constants replace magic numbers; history-narrating and stale comments are rewritten.
…ack and scoped mints - datasource: a self-hosted GitLab registry on a port of its instance (registry_external_url 'https://gitlab.example.com:5050') takes tokens from the instance's /jwt/auth again, with token trust only. The guide names the layout that stays refused: a token service on another port of the registry's host. - datasource: when the batched release read for mirror misses fails, the warm heads it read are kept and only the cold misses are asked again, concurrently. - github: a scoped mint must come back narrowed to the repository asked for; a mismatch forgets the cached id, reads it again and mints once more, and a second mismatch is an error. - mise: the io helper no longer splits a doc comment from its constant.
sweepies
force-pushed
the
refactor/sloppy-datasource-github
branch
from
November 14, 2026 05:07
3474f41 to
67f60fd
Compare
Merged
sweepies
added a commit
that referenced
this pull request
Nov 14, 2026
sweepies
added a commit
that referenced
this pull request
Nov 14, 2026
…s, logged causes, and a cleanup pass (#308) * fix(update): name a failed release-notes fetch and keep its body unsettled 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 * fix(engine): a failed plan keeps the saved catalog controls `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. * fix(server): log the cause of batch, remote and startup failures 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 * refactor(cli): shared exit helpers, one git command builder - `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` * fix(update): only a transient notes failure stays unsettled, and no receipt 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. * fix(engine): a failed plan still saves this run's held-back targets 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. * test(update): admit consults only the closed reads it selects 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. * test(server): deliveries under lock contention answer only once durable 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. * chore: rehash state rows on the #307 base * fix(update): a notes failure settles only when it would repeat, and keeps 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. * test(update): drop the admit comparison that held by construction 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. * test(server): the contention barrier waits on the delivery, not the clock 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A cleanup pass over code written during the refactor, covering
crates/datasource,notes,http,cache,github,config,testkit,report,versioning,processandmise.Behaviour fixes
registry.X→X/jwt/authstays allowed. A realm on the registry's host but another port is now refused. Seeguide/sources.md.guide/release-notes.md.Decodeerror.i64::MAXare rejected everywhere.Throttlederror, not a fake 429. Generic HTTP errors no longer say "registry".+<build>key scheme is a one-shot migration (014.sql), not two deletes on every open. A corrupt cache entry is aMetadataerror, not "invalid registry URL".json()refuses userinfo, andtoken_getrequires a host.Cleanup (no behaviour change)
token_getand the unusedregexdependency in datasource.Error::Notesis replaced by notes' own error type.Version::new,plain,unix_now, the User-Agent and the hex helpers;.rswalkers and the retry-cause SQL.valid_api_url,release_catalogs) and stale ones (registry.rs,reportmanager) are fixed, and history-narrating comments are rewritten.assert!(…is_ok())checks now assert the answer, and the schema version comes from the migration count.Review fixes
gitlab.example.com:5050, realmhttps://gitlab.example.com/jwt/auth) works again, with token trust only. The docs name the layout that stays refused: a token service on another port of the registry's host.Notes
GET /repos/{repo}.