Skip to content

fix(component-runtime): ArtifactCache::install drops the verification error of a damaged cached object #909

Closed

Description

@Goldziher

ArtifactCache::install (cache.rs) checks an existing object with if destination.is_dir() && let Ok(cached) = self.verify_cached(..) and discards the Err. A cached object whose library digest, size, manifest digest or signature no longer matches is then treated as absent: an offline cache returns ComponentError::Offline { .. } ("component x is not cached and network access is disabled"), an online one silently re-downloads and replaces it (install_stream removes the destination).

Consumers cannot tell "never installed" from "installed and damaged", cannot say which check failed (digest mismatch, bad signature, edited component.json, truncated library), and cannot log or report a repair. Reproduced in poly 0.34.0 (flip a byte in the cached dylib; poly components status --verify reports the Offline message).

Requested: (1) a public ArtifactCache::verify_cached(&self, entry) -> Result<CachedArtifact, ComponentError> that never downloads or removes anything, and (2) install returning (or at least exposing, e.g. through a callback or a ComponentError::CachedObjectInvalid { component, source } when offline) the verification error instead of Offline when the object exists but fails verification. poly would then report the real reason instead of inferring "failed verification" from a cached directory plus an Offline error.

Activity

  1. Goldziher commented on Nov 8, 2026

    @Goldziher
    MemberAuthor

    Fixed in 4e8123d, released in 0.129.0: ArtifactCache::verify_cached is public (verify-only) and offline installs of a damaged object fail with ComponentError::CachedObjectInvalid (code cached_object_invalid) wrapping the verification error instead of Offline; online installs still repair in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions