fix: MPS-24 Phase 2.8c — cache-bust ALL static JS (THE root cause)
THE root cause of the entire 'still reloads / still not working' saga
across 2.7 -> 2.8 -> 2.8b: shop_tags.j2 (tag_bulk.js) and
product_edit.j2 (product_tags.js) loaded their <script> WITHOUT the
?v={{ request.git_hash }} cache-bust. routes.py serves /static with
cache_max_age=3600, so the operator's browser kept the STALE JS for up
to an hour after every deploy — the new SPA code never executed, forms
fell back to native submit = full page reload, every time. Server-side
functional tests passed throughout because they have no browser cache.
Fix: append ?v={{ request.git_hash }} to EVERY static <script> include
(the established base.j2 / offer.js / pay-countdown.js convention) —
not just the two at fault but the whole latent class: tag_bulk,
product_tags, tag_filter, auction, player, sandbox, watch, signals,
comments, shop-settings. request.git_hash shifts every deploy -> URL
changes -> fresh fetch, no hard-refresh ever needed again.
Gate (must be empty):
grep -rnE '<script src="/static/js/[^"?]+\.js"' make_post_sell/templates/
The 2.8/2.8b JS (onTagFormClick unified click handler, AJAX focus,
drag-to-reorder) stands — it just was never being fetched by the
browser. 1131 tests pass. Docs: mps-24.md Phase 2.8c, CLAUDE.md
(new mandatory cache-bust convention section).
This commit is contained in:
parent
b15c0a0f38
commit
cd5ea68fe3
13 changed files with 46 additions and 13 deletions
17
CLAUDE.md
17
CLAUDE.md
|
|
@ -379,6 +379,23 @@ new comment into our DOM without a page reload (preserving media playback).
|
|||
Our server returns JSON (HTTP 201) for AJAX requests and falls back to our
|
||||
normal redirect flow on any error.
|
||||
|
||||
## Static Asset Cache-Busting (MANDATORY)
|
||||
|
||||
**Every `<script src="/static/...">` and `<link href="/static/...">` MUST
|
||||
end with `?v={{ request.git_hash }}`.** `routes.py` serves `/static` with
|
||||
`cache_max_age=3600`, so an un-versioned asset is cached by the browser
|
||||
for up to an hour — meaning a deploy that changes that JS/CSS is
|
||||
**invisible to users for up to an hour**. This manifests as "the new
|
||||
feature doesn't work / the SPA still full-reloads" even though the deploy
|
||||
landed and server-side tests pass (tests have no browser cache). This was
|
||||
the root cause of the entire MPS-24 tag-SPA debugging saga (5+ deploys).
|
||||
`request.git_hash` is a reified request method that shifts every deploy →
|
||||
URL changes → fresh fetch, no hard-refresh ever needed. Gate before
|
||||
commit (must be empty):
|
||||
```
|
||||
grep -rnE '<script src="/static/js/[^"?]+\.js"' make_post_sell/templates/
|
||||
```
|
||||
|
||||
## CI/CD Notes
|
||||
|
||||
- Build uses `virtualenv-clone` which requires `bin/python` symlink (Python 3.12 `venv` may only create `python3`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue