fix(action): key the action's cache by the binary's cache schema

Merged
SW
2d ago
+188-32

Bug

The composite action cached $RUNNER_TEMP/patchula under patchula-v2-<os>-<arch>-<run>-<attempt> and restored any patchula-v2-<os>-<arch>- entry, so every Count version shared one cache lineage. The binary rejects a cache database from a newer schema (Error::FutureSchema, on purpose, and that stays). So an older binary that restored a newer binary's cache failed hard:

× cannot open the cache in /home/runner/work/_temp/patchula: cache schema 15 is newer than supported schema 8

This showed up in #318's "Action" dry run (release 0.8.1) after main's source-built self-run saved a schema-15 cache. Anyone rolling back to an older version would hit the same error.

Fix

  • New patchula cache schema prints the newest cache schema the binary supports (patchula_cache::SCHEMA, which is MIGRATIONS.len(), currently 15).
  • action.yml now resolves the binary in its own Install Count Patchula step, before the cache step. That step uses the same binary: / version / action-ref logic as before and outputs the binary path plus a cache lineage:
    • s<schema> when the binary has cache schema
    • v<version> (from --version) for older releases that don't have it
  • The cache key is now patchula-v3-<os>-<arch>-<lineage>-<run>-<attempt>, and it only restores within its own lineage. The run step uses the resolved binary. The pre-0.4.0 --cache file/dir handling is unchanged.
  • When the schema changes, the next run starts with a cold cache, which is always a correct state. The old v2 entries are abandoned.
  • Docs: the GitHub Actions guide (caching paragraph), internals/cache.md (schema section), and the regenerated CLI reference and help snapshot.

The "Action" workflow dry run uses the latest release (0.8.1), so it covers the version fallback path.