Skip to content

ci(migrations): confine snapshot cache lookup to a 3-day date window#285

Merged
bkontur merged 2 commits into
devfrom
ci-snapshot-cache-window
Jul 14, 2026
Merged

ci(migrations): confine snapshot cache lookup to a 3-day date window#285
bkontur merged 2 commits into
devfrom
ci-snapshot-cache-window

Conversation

@danielbui12

@danielbui12 danielbui12 commented Jul 14, 2026

Copy link
Copy Markdown
Member

Background

CI restored try-runtime snapshots via an unbounded prefix key (try-runtime-snapshot-<name>-). GitHub Actions cache prefers the PR's own ref scope over the base branch, so one stale PR-scoped snapshot shadows fresh dev-scoped ones indefinitely - daily use keeps it from evicting.

Example: PR #280 was pinned to a 2026-07-10 previewnet snapshot predating the DeregisterAnnouncementPeriod fix (10 -> 15), so its check-migration (web3-storage-paseo) job always failed the DeregisterAnnouncementPeriod > ChallengeTimeout try_state invariant from #276, while the same code passed on dev.

Changes

Both prepare-snapshots and check-migrations now look up snapshots only under explicit dated keys (today / yesterday / day-before, UTC):

  • Restored snapshots are at most two days old, regardless of ref scope.
  • The nightly 5AM UTC refresh keeps a fresh dev-scoped snapshot, so PRs rarely regenerate.
  • Stale branch-scoped entries become unreachable and evict after 7 days.
  • The redundant Get Date step is folded into the new dates step.

WHY 3-DAYS PERIOD?

Since we are changing the runtime pretty frequently so keeping the cache period in short time would be better

Issue

Diagnosed while verifying the failing runtime-migration check on #280.

An unbounded prefix restore searches the PR's own ref scope before the
base branch, so one stale PR-scoped snapshot shadows fresh dev-scoped
ones forever (daily CI use keeps it from evicting). PR #280 was pinned
to a 2026-07-10 previewnet snapshot that predates the on-chain
DeregisterAnnouncementPeriod fix and permanently failed the try_state
timing invariant added in #276.

Both jobs now look up snapshots only under explicit dated keys
(today/yesterday/day-before, UTC), so a restored snapshot is at most
two days old regardless of cache scope; the nightly 5AM refresh keeps
PRs from regenerating in practice. Stale branch-scoped entries become
unreachable and evict naturally.
@danielbui12 danielbui12 self-assigned this Jul 14, 2026
# to regenerate. `cache-matched-key` is empty iff nothing was found, which
# is also the case on the daily `schedule` (lookup skipped) so the
# snapshot is force-refreshed nightly.
# Snapshot lookup is confined to an explicit 3-day key window (today,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielbui12 please tell you assistant to minimalize docs

@bkontur

bkontur commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

@danielbui12 if we have a problem with outdated snapshot, we can just remove the snapshot from https://github.com/paritytech/web3-storage/actions/caches

@danielbui12

Copy link
Copy Markdown
Member Author

@bkontur yep, I use gh cli to kill stale cache

@danielbui12
danielbui12 requested a review from bkontur July 14, 2026 09:24
shell: bash
run: |
echo "today=$(/bin/date -u '+%Y%m%d')" >> "$GITHUB_OUTPUT"
echo "yesterday=$(/bin/date -u -d '1 day ago' '+%Y%m%d')" >> "$GITHUB_OUTPUT"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just out of curiosity, what if prepare-snapshots: runs before midnight and check-migrations after midnight?

@bkontur
bkontur merged commit 48a38a1 into dev Jul 14, 2026
38 checks passed
@bkontur
bkontur deleted the ci-snapshot-cache-window branch July 14, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants