Skip to content

perf(cache): extraction, catalog and notes state survive a release when their code did not change - #293

Merged
sweepies merged 4 commits into
mainfrom
perf/state-versions
Nov 13, 2026
Merged

sweepies merged 4 commits into
mainfrom
perf/state-versions

Conversation

@sweepies

@sweepies sweepies commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #291. Every per-build state namespace (PER_BUILD) carried the release in its key, so each release made every repository cold at once: re-evaluated config, re-extracted files, refetched catalog controls, re-parsed changelogs. That is the moment the server is busiest.

  • PER_BUILD is gone. A state that depends on this build's code sets CODE_VERSIONED, and its VERSION names the derivation, not the release. The key is name@v{VERSION}, so a release keeps every entry whose deriving code did not change. Old +build rows are still pruned on open.
  • Guard: tests/state-versions.tsv generalises perf(http): a derived body is versioned by its code, not by the release #291's table: per state, the source files and trees whose text determines it, the locked versions of the dependency crates that do, and their hash. The extraction and config rows cover crates/manager/src, mise, config evaluation, words, versioning, update planning, PatchulaConfig.pkl and 19 parsing crates. patchula_testkit::state also scans each crate for CODE_VERSIONED implementations, so none can exist unregistered. The hashing is shared with perf(http): a derived body is versioned by its code, not by the release #291's derived-body guard (testkit/src/versions.rs).
  • Code-versioned now: config, config-files, extract, files, catalog, catalog-controls, changelog, notes-adapter, not-ours, each bumped once for the cutover. The three notes adapter Deriveds move to v2, because their source file is theirs too.
  • Not code-versioned: lookup-hint and branch-hint. They only name what to prefetch, so a stale hint costs one wasted prefetch and never a wrong answer (documented on the types).

Behaviour change: a release keeps config, extraction, catalog, changelog and ownership state whose code did not change (internals/cache.md, with the maintenance rule).

Proof:

  • code_versioned_state_survives_a_release and a_saved_extraction_survives_a_release: an entry written by one build is read by the next when its version is unchanged, and missed when bumped; a legacy +build row is pruned.
  • Guard demonstrated: a one-line edit to crates/manager/src/npm.rs, and semver bumped in Cargo.lock, each fail the guard; both reverted.
  • Corpus snapshots and transcripts are unchanged; within a release, requests and cache hits are identical.

View guided diff Turn on auto-fix

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 13, 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 c6f7b63 Commit Preview URL

Branch Preview URL
Nov 13 2026, 09:23 AM

sweepies and others added 4 commits November 13, 2026 09:14
…en their code did not change

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The scan found impls by the literal trait name at the start of a line,
so `use patchula_cache::State as S; impl S for T` shipped unseen. Any
`impl … for …` block whose own items declare `const NAMESPACE` (only
State declares it) now counts, wherever it sits on the line; an impl
nested in another block's fn counts once. A namespace listed twice in
tests/state-exempt.tsv fails instead of keeping the last reason.

Edits to a listed file bump the version, always: github-release-head
(2), source-head, tag-catalog and tag-object (2), and catalog and
catalog-controls (2), whose rows cover all of datasource and engine.
osv-listing's exemption names the setting that bounds it.
@sweepies
sweepies force-pushed the perf/state-versions branch from 9639cb6 to c6f7b63 Compare November 13, 2026 09:23
@sweepies
sweepies merged commit 1951dee into main Nov 13, 2026
13 checks passed
@sweepies
sweepies deleted the perf/state-versions branch November 13, 2026 09:32
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 13, 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