Skip to content

fix: put the pinned version in the component wasm filename - #292

Merged
robcohen merged 2 commits into
mainfrom
fix/component-cache-version
Aug 21, 2026
Merged

robcohen merged 2 commits into
mainfrom
fix/component-cache-version

Conversation

@robcohen

Copy link
Copy Markdown
Member

Closes #286.

The bug

The cache path was version-agnostic (rustledger_ffi_component.wasm) and the download was guarded by not exists(). Together those mean bumping RUSTLEDGER_VERSION never re-downloads — a working tree keeps using the previous release's component indefinitely.

The failure mode is the bad one. While preparing #284 this reported "669 passed" against a tree pinned to v0.22.0 while actually running a component from an earlier release; after deleting the stale file the true result was 5 failed, 645 passed, matching CI. A stale run is green, so nothing prompts anyone to look. CI is unaffected because it starts from a clean checkout — which means this hits contributors specifically, and hits them exactly when they bump the version, the moment the component matters most.

Why the filename and not a marker

Putting the version in the filename makes a bump a cache miss by construction, rather than relying on a staleness check somebody has to maintain.

desktop/scripts/ensure-rustledger.ts solves this for a sibling wasm with a .wasm-version marker, and that was my first instinct. It's the wrong fit here: CI provisions the file directly without writing a marker, so a missing marker can't be distinguished from an externally provisioned file that happens to be stale — which is precisely the bug.

Blast radius

I grepped for the literal filename before changing it; there were four other consumers, all updated:

  • .github/workflows/test.yml (two download sites) and desktop-release.yml — all three already had the tag to hand
  • contrib/pyinstaller_spec.spec — now globs, so it needn't know the version
  • the _default_wasm_path assertion in test_rustledger_component_marshal.py

Cleanup

Versioned names would otherwise accumulate one ~7 MB artifact per upgrade, so a successful download prunes its superseded siblings and the pre-#286 unversioned file, which is now dead in every existing checkout. Pruning is best-effort — a file that can't be removed is left alone, since tidy-up must never break a working engine.

Verification

just test-py: 671 passed, 1 skipped, coverage 100.00% — the gate is --cov-fail-under=100 and component_engine.py isn't in the omit list, so the new function needed real tests rather than a pragma. Two were added, including one that asserts an unremovable file doesn't propagate.

Note desktop-release.yml carries a few unrelated quote-style changes: prettier normalizes the whole file whenever it's touched.

Closes #286.

The cache path was version-agnostic (rustledger_ffi_component.wasm) and
the download was guarded by `not exists()`, so bumping
RUSTLEDGER_VERSION never re-downloaded: a working tree kept using the
previous release's component indefinitely.

The failure mode is the bad one. While preparing #284 this reported
"669 passed" against a tree pinned to v0.22.0 while actually running a
component from a previous release; after deleting the stale file the
true result was 5 failed, 645 passed, matching CI. A stale run is GREEN,
so nothing prompts anyone to look. CI was unaffected because it starts
from a clean checkout, which means this hit contributors specifically,
and hit them exactly when bumping the version — the moment the component
matters most.

Putting the version in the filename makes a bump a cache miss by
construction, rather than relying on a staleness check that has to be
maintained. desktop/scripts/ensure-rustledger.ts solves the same problem
for a sibling wasm with a .wasm-version marker; a marker would have been
ambiguous here, because CI provisions the file directly and a missing
marker cannot be distinguished from an externally provisioned file that
happens to be stale — which is the bug.

Blast radius, all updated: the three CI download sites (test.yml twice,
desktop-release.yml, all of which already have the tag to hand), the
PyInstaller spec (now globs, so it need not know the version), and the
_default_wasm_path assertion.

Versioned names would otherwise accumulate one ~7 MB artifact per
upgrade, so a successful download now prunes its superseded siblings and
the pre-#286 unversioned file, which is dead in every existing checkout.
Pruning is best-effort: a file that cannot be removed is left alone,
since tidy-up must never break a working engine.

671 passed, coverage gate still 100%.
mypy runs with no-implicit-reexport, so importing it via
component_engine (which only re-exports it) fails attr-defined.
@robcohen
robcohen merged commit d77a4ad into main Aug 21, 2026
32 checks passed
@robcohen
robcohen deleted the fix/component-cache-version branch August 21, 2026 20:33
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.

Component wasm cache is version-agnostic, so a rustledger version bump silently tests against the old component

1 participant