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:
russell@unturf.com 2026-05-16 09:39:17 -04:00
parent b15c0a0f38
commit cd5ea68fe3
No known key found for this signature in database
13 changed files with 46 additions and 13 deletions

View file

@ -363,6 +363,22 @@ Tests (`test_functional.py::TestProductTagsSpa`):
Deferred (occasional click, not the hot path): AJAX-ifying the
"Suggest categories" link — still a full navigation by design.
**Phase 2.8c — THE root cause** (shipped 2026-05-16): every "still
reloads / still not working" report across 2.7 → 2.8 → 2.8b was the
**same defect** — `shop_tags.j2` (`tag_bulk.js`) and `product_edit.j2`
(`product_tags.js`) loaded their `<script>` **without**
`?v={{ request.git_hash }}`. `/static` is served
`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 ran, forms
fell back to native submit = full reload, every time — while
JS-blind server tests passed. Fix: append `?v={{ request.git_hash }}`
to **all** static `<script>` includes (the existing `base.j2` /
`offer.js` convention), not just the two — same latent bug class
across `tag_filter`, `auction`, `player`, `sandbox`, `watch`,
`signals`, `comments`, `shop-settings`. Grep gate:
`grep -rnE '<script src="/static/js/[^"?]+\.js"' templates/` must be
empty. (The 2.8/2.8b JS work stands; it just was never being fetched.)
**Phase 2.8b** (shipped 2026-05-16): the generic `data-tag-form`
**`submit`-event** interception proved unreliable in the field —
operator reported Add / Delete / reorder *all* still full-reloaded