Skip to content

feat(cache): say how warm the cache is before a run starts - #359

Merged
sweepies merged 2 commits into
mainfrom
feat/cache-start-summary
Nov 22, 2026
Merged

sweepies merged 2 commits into
mainfrom
feat/cache-start-summary

Conversation

@sweepies

@sweepies sweepies commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Every run now starts by saying whether its cache is cold or warm, how cold, and why, so a slow cold run is expected before it starts.

patchula: cache warm: 8412 responses (61.3 MiB) and 2210 stored values, last opened 6 hours ago
patchula: cache partly cold: 8412 responses (61.3 MiB) and 2210 stored values, last opened 6 hours ago; 1903 outdated entries dropped (extract, tag-catalog)
patchula: cache cold: there is no cache yet
patchula: cache cold: the cache was corrupt, starting fresh
patchula: cache cold: 40 outdated entries dropped (extract)

What changed

  • Cache::opened() returns an Opened summary from opening the cache:
    • where the database came from (Existing, Created, Rebuilt after corruption, Memory);
    • each tabled name the open-time prune dropped entries under (a version bump or a locked-dependency fingerprint change), with counts, via DELETE … RETURNING;
    • how many responses eviction dropped (for example after the budget was lowered);
    • what is left: responses, compressed bytes, state values and release lists;
    • seconds since the cache was last opened.
  • Migration 017 adds a one-row opened table for that last-open time. The HTTP timestamps can't be used: they sit after each body, so reading them would page every body in. Every count reads an index or the trigger-kept http_bytes row.
  • CLI: lookup, run, apply and tui print the summary as one stderr line after the cache opens. It is shown at the default verbosity, because the default log level is WARN and an info event would never appear in Actions. The spinner now starts after the cache opens, so the line isn't drawn over.
  • Server: logs it once at start as an info event with a cold field.
  • Docs: the GitHub Actions guide (next to the existing cold-cache note) and internals/cache.md.

No rows in tests/*-versions.tsv are touched, so this is independent of #351–#358.

Tests

  • the_opening_summary_says_how_warm_and_why: the wording for warm, partly cold, cold after everything was superseded, and each cold origin.
  • opening_reports_how_warm_the_cache_is: a first open is Created and cold; a reopen is Existing and warm, with one response and an idle time; a reopen with a zero budget counts one eviction and is cold.
  • opening_prunes_superseded_keys now also checks the superseded counts per name.
  • The corruption test checks Origin::Rebuilt.
  • The server startup test now parses every stderr line as JSON and expects the cache event before the error.

Follow-ups

  • In the GitHub Action, a cold cache could also be raised as a ::notice:: annotation so it shows on the run summary.
  • The tool store (tools/) isn't covered: a run with a warm database but no installed tools is still slow for lockfile updates.

View guided diff Turn on auto-fix

Opening the cache now returns an `Opened` summary: where the database came
from (existing, new, rebuilt after corruption, or in memory), each kind of
entry the prune dropped because this build keys it differently and how
many, what eviction dropped, what is left, and how long since the cache was
last opened (a one-row `opened` table, migration 017). The CLI prints it as
one stderr line before a lookup, run, apply or tui batch, and the server
logs it at start, so a cold run is expected before it is slow.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 2ea47bf Commit Preview URL

Branch Preview URL
Nov 22 2026, 07:42 PM

@sweepies
sweepies merged commit 58c6a16 into main Nov 22, 2026
13 checks passed
@sweepies
sweepies deleted the feat/cache-start-summary branch November 22, 2026 19:50
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 22, 2026
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.

1 participant