Asset stamps become content hashes — version stamps bust nothing
Eric's screenshot showed week-old CSS again, straight through the cache-buster: the stamp was the app VERSION, unchanged at 1.0.0 since release, so every stylesheet change shipped at the same ?v= URL and browsers rightly kept their copies. The stamp is now an 8-char hash over the static bundle's bytes — it changes exactly when the files do, releases or not. The test now pins that property instead of the version equality it used to celebrate. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016jXZFSTZQKzAC8fqpWSz9g
This commit is contained in:
co-authored by
Claude Fable 5
parent
708883313f
commit
446579e96c
@@ -689,9 +689,14 @@ def test_pipeline_counts_pending_work_not_queue_rows(tmp_path):
|
||||
def test_assets_are_version_stamped(tmp_path):
|
||||
"""A cached stylesheet from last week must not survive an upgrade:
|
||||
asset URLs carry the app version."""
|
||||
from bggpipe import __version__
|
||||
import re
|
||||
|
||||
html = _app(_cfg(tmp_path)).get("/").text
|
||||
assert f"/static/app.css?v={__version__}" in html
|
||||
assert f"/static/app.js?v={__version__}" in html
|
||||
(stamp,) = set(re.findall(r'/static/app\.css\?v=([0-9a-f]{8})"', html))
|
||||
assert f"/static/app.js?v={stamp}" in html
|
||||
assert "__ASSET_V__" not in html
|
||||
# the stamp is a CONTENT hash: it must change when the css changes,
|
||||
# not when the release version does — that was the original sin
|
||||
from bggpipe import webreview
|
||||
|
||||
assert stamp == webreview._asset_stamp()
|
||||
|
||||
Reference in New Issue
Block a user