Skip to content

perf(http): a derived body is versioned by its code, not by the release - #291

Merged
sweepies merged 2 commits into
mainfrom
perf/derived-versions
Nov 13, 2026
Merged

sweepies merged 2 commits into
mainfrom
perf/derived-versions

Conversation

@sweepies

@sweepies sweepies commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Consult 7, PR 12 (approved by the user). Every derived registry representation was keyed by the release (name+{BUILD}), so each release made every repository cold at once: a full registry download everywhere, the moment the cache peaks hardest.

  • Derived carries {name, version, derive} and keys bodies as name@v{version}. BUILD is gone from the http crate. All 38 Derived sites in datasource and notes pass an explicit version; the Docker anonymous pull token, a persisted representation that is not a Derived, carries its own.
  • Guard: tests/derived-versions.tsv lists every representation (35): name, version, the source files whose text produces its bytes, the dependency crates whose behaviour does (their locked versions from Cargo.lock are hashed in, so cargo update -p pep440_rs fails the guard until the affected rows are bumped), and the SHA-256. The guard also scans each crate's sources for Derived::new("…" and the pull-token constant and fails on any representation not registered. patchula_testkit::derived::check fails when a source hash changes without a version bump, and checks coverage both ways. Both crates' parity modules run it. To hash precisely, the shared derive engine moved to crates/http/src/derive.rs (hashed into every row, since it reads and parses every body), and the catalog types, truncation and notes' mirror and changelog compactions moved into their own files; call sites are unchanged.
  • Maintenance: change a transform, the guard fails naming the row, bump its version and update the row in the same commit (internals/cache.md).
  • Hard cutover: opening the cache deletes old name+build http rows; a + in a URL or credential scope is not matched.

Behaviour change: a new release keeps cached registry representations whose compaction code did not change.

Proof:

  • a_derived_body_is_versioned_by_its_code_not_the_release: an entry stored as doc@v1 is read by a later build with zero fetches; a bumped version misses and fetches; a doc+0.0.0 entry is never read.
  • opening_drops_per_build_http_representations.
  • Guard demonstrated: a one-token edit to the npm transform fails every_derive_versions_its_compaction_source with "compaction source changed — bump its version", and passes again once reverted.
  • No transcript changes.

Follow-ups (not changed here): the extraction cache, lookup hints and catalog views are still per-build state namespaces, so they also go cold on each release; versioning them by their code the same way is the next candidate.

View guided diff Turn on auto-fix

Review round: added upstream.rs to helm-index, markdown.rs to the changelog rows, the versioning sources to the six rows that sort or filter versions while deriving, the per-row dependency versions and the registration scan. Each gap was demonstrated: editing the file (or a locked dependency version, or adding an unregistered Derived::new) fails the guard, and the clean tree passes.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@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 fb8e5a7 Commit Preview URL

Branch Preview URL
Nov 13 2026, 02:44 AM

…e bytes

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@sweepies
sweepies merged commit 2d5a26b into main Nov 13, 2026
13 checks passed
@sweepies
sweepies deleted the perf/derived-versions branch November 13, 2026 02:55
@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