Skip to content

fix(cache): skip non-serializable entries during filesystem cache writes #15406

Description

@hardfist

Trigger

This only affects filesystem-backed new_cache entries. It occurs when an entry has been accepted by the in-memory cache, but its deferred encoder later fails during FileCacheStrategy::after_all_stored.

For module cache, a representative trigger is cache: { type: persistent } with experiments.new_cache.module enabled, where a completed module build contains a dependency or other payload that cannot be serialized by the cache codec, for example process-local state or an unsupported dynamic cacheable type. Memory cache hits are unaffected because they do not encode values.

Current behavior

The idle write batch uses try_for_each over every pending entry. If encoding one entry fails, after_all_stored returns an error before writing the batch. Valid entries in the same batch are not persisted, and the pending batch can be retried and fail again.

Before the typed module-cache refactor, module cache encoded its own value before storing it and skipped that module entry on failure. Moving encoding behind the generic cache boundary removes that module-specific recovery path.

Expected behavior

FileCacheStrategy should encode pending entries independently: log and discard only an entry whose encoder fails, while continuing to persist the other valid entries, validator data, and metadata. This should be implemented as a generic filesystem-cache behavior, not as a module-cache exception.

Activity

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