Skip to content

Store cache is re-saved on every run in jobs without a container #78

Open

Description

@shahmir-oscilar

Summary

With cache: true, v3.1.1 never skips the post-step save in jobs that run directly on the runner. The store's contents don't change. The post step sees a different fingerprint only because the store had an empty index.db-wal right after the restore, and the project install deleted it. Container jobs skip the save as expected.

Repro: https://github.com/shahmir-oscilar/pnpm-setup-store-skip-repro (run 38620545293)

Environment

  • pnpm/setup v3.1.1 (a0881977), pnpm 12.4.1, runtime: node@24, cache: true
  • GitHub-hosted ubuntu-24.04

Observed

Each check job restores the store saved earlier in the run, an exact lockfile match. scripts/fingerprint.sh records what src/store-fingerprint hashes: the size and mtime of index.db, index.db-wal, and each files/xx directory.

Job pnpm store path Runtime install Post step
runner-check (no container) /home/runner/setup-pnpm/store/v11 reused 1 from the restored store Cache saved with the key: …
container-check (node:24-bookworm) /__w/.pnpm-store/v11 downloaded 1 into /github/home/setup-pnpm/store/v11 The store has not changed since it was restored, not saving cache.

runner-split-check uses install: false and runs pnpm install --frozen-lockfile as its own step:

after setup:   index.db-wal 0 bytes
pnpm install:  Already up to date
after install: index.db-wal none   (no other entry changed)
post step:     Cache saved with the key: …

Cause

Without a container, the project store is inside dest, the same store the runtime install uses. When fingerprintRestoredStore runs, that store has a 0-byte index.db-wal. The project install opens and closes the database, SQLite deletes the empty log, and the post-step fingerprint no longer matches.

We haven't confirmed whether the empty index.db-wal comes from the runtime install or from the restored archive.

Suggested fix

Treat a 0-byte index.db-wal the same as a missing one in fingerprintStore.

Drafted by Claude Code

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