Skip to content

fix(platform): match asset hashes of 8+ chars, not exactly 8#2846

Merged
Israeltheminer merged 1 commit into
mainfrom
fix/cache-hashed-asset-hash-length
Jul 22, 2026
Merged

fix(platform): match asset hashes of 8+ chars, not exactly 8#2846
Israeltheminer merged 1 commit into
mainfrom
fix/cache-hashed-asset-hash-length

Conversation

@Israeltheminer

@Israeltheminer Israeltheminer commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Problem

Follow-up to the static-asset caching fix (#2843). That rule marks content-hashed chunks immutable by matching -[A-Za-z0-9_-]{8}\.(?:js|css)exactly 8 hash chars. Rollup lengthens a hash past 8 chars to disambiguate same-named chunks, so a post-deploy HAR showed /assets/queries-LIOgKzLg2.js (9-char hash, one of six queries-*.js) falling to no-cache and being re-downloaded on every visit. Fail-safe (never stale), but it leaves collision-extended chunks uncached — and that grows as chunks are added.

Fix

Widen the pattern {8}{8,} (8-or-more). Handles any hash length; only .js|.css under /assets/ match, so un-hashed public images (svg/png) and version-pinned /canvas-libs/* are still excluded. Fail-safe unchanged.

Verification

  • bun run --filter @tale/platform test server.test.ts → green (57), incl. a new 9-char case (/assets/queries-LIOgKzLg2.js → immutable) that fails on {8}, passes on {8,}.
  • bun run --filter @tale/platform typecheck clean; oxfmt --check + oxlint clean.

Verified against the post-deploy HAR: the caching fix works (repeat visit ~243s → ~9.9s; 152/153 hashed assets from cache); this closes the last 9-char-hash gap.

The static-asset cache rule (#2843) matched only exactly-8-char content hashes. Rollup extends a hash past 8 chars to break collisions between same-named chunks; a post-deploy HAR showed one of six queries-*.js with a 9-char hash falling to no-cache and being re-fetched every visit. Widen the pattern to {8,} and add a 9-char regression case. Only .js|.css under /assets/ match, so un-hashed public images and /canvas-libs/* stay excluded; fail-safe as before (never serves stale bytes).
@Israeltheminer
Israeltheminer merged commit 9b272b1 into main Jul 22, 2026
50 checks passed
@Israeltheminer
Israeltheminer deleted the fix/cache-hashed-asset-hash-length branch July 22, 2026 18:43
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