refactor(oci): migrate dunite-oci to shared core limiter, origin check, typed blob errors (PSA-35) #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refactor/psa-35-oci-shared-core"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implements PSA-35: dunite-oci now builds on dunite-core's shared mechanisms instead of carrying near-identical copies.
OciLimiter/OciPullGuard/OciLimitDenialare now re-exports ofdunite_core::services::usage_limiter::{UsageLimiter, UsageGuard, LimitDenial}. The duplicated implementation inoci_limiter.rsis deleted, and with it the slot-leak rollback bug (the old copy decremented the daily count BEFORE releasing the in-flight slot and swallowed decrement errors, so a failing decrement leaked the concurrency slot permanently).UsageCounter, same pattern as dunite-download'sDownloadCounter. Thecurrent()method is dropped; nothing in the engine called it.forgejo_registry::validate_hostdelegates todunite_core::validation::origin::same_origin.BlobCacheError+ a cloneableFetchErrormirror (the dunite-download pattern). Upstream 404 surfaces asRegistry(NotFound), integrity violations asDigestMismatch, filesystem failures asIo, instead of everything flattening into an opaqueAppError::internalstring. A permission-denied cache dir is now diagnosable from consumer logs.Tests
tests/limiter.rspins the re-exported API surface and adds a regression test: a failing daily-count decrement can no longer leak a concurrency slot (failing_decrement_does_not_leak_concurrency_slot).filesystem_failure_surfaces_as_typed_io_errortest.Consumer impact (bunyip-oci, BUNYIP-26)
Public API changes, coordinated as the PSA-35 consumer-side follow-up:
PullCounterimpl: removecurrent()from the trait impl block (keep it as an inherent method if the repository's own tests use it).get_blobhandler: match onBlobCacheError::{Registry, InvalidDigest, DigestMismatch, Io, Store}instead ofAppErrorvariants. The handler comment already tracks this (PSA-35 reference).BlobCache::ensure_dir/evict_if_over_cap/sweep_orphansreturn types changed fromio::Error/AppErrortoBlobCacheError.bunyip-oci pins
branch = "main", so these land there on its nextcargo updateafter merge.