Skip to content

Versioned CSS and JS URLs; the fixes boards fit at 1280px - #294

Merged
patrickballard merged 1 commit into
mainfrom
fix/versioned-assets
Nov 29, 2026
Merged

patrickballard merged 1 commit into
mainfrom
fix/versioned-assets

Conversation

@patrickballard

Copy link
Copy Markdown
Contributor

Two fixes.

Stale CSS after a deploy

GitHub Pages lets a browser reuse a file for 10 minutes. After today's deploy a returning visitor got the new HTML with the old brand.css, and the new <nav popover> showed as a full-screen box on a phone, because the old .wg-nav { display: flex } beat the browser's hiding of a closed popover.

Every page now links the site's own CSS and JS as name?v=<first 10 hex of its sha256>, so a changed file has a URL no browser has cached:

  • Generated pages: every generator writes its stylesheets through build_campaigns.stylesheets(root) (scripts/assets.py), which hashes site/brand.css and site/style.css as it writes the page.
  • Hand-written pages and modules: site/ stays plain in the repo. The deploy runs python3 scripts/assets.py _site right after copying site/, which stamps index.html, 404.html (its /tracker/ URLs) and check/index.html, plus the checker's module URLs (check-logic.mjs, worker.mjs and the worker's driver.py). It stamps dependencies first, so a change to check-logic.mjs also gives worker.mjs, check.mjs and the page new URLs. The README's local build has the same step.
  • Tests (tests/test_assets.py) check that every stamped hash matches its file, that stamping twice changes nothing, that a module change reaches the page, that a link to a missing file stops the build, that no generator writes an unversioned href="….css", and that the deploy runs the stamp straight after the copy.

I looked at making brand.css itself harmless when old CSS meets new HTML. It isn't simple: the bar shows the closed popover as a row on purpose, so the rule that overrides the browser's hiding has to stay, and nothing in a new stylesheet can fix an old cached one. The other way round (old HTML with new CSS) is already fine, because the popover rules only match [popover]. With versioned URLs the two can't be mismatched any more.

Windows on ARM and free-threaded boards at 1280px

The columns' minimum widths added up to about 1060px in the 888px column, so "The change" was cut off. Unbreakable paths in the change's text (.github/workflows/pypi-build-artifacts.yml) were what kept that column at 312px. Now:

  • the change column gets overflow-wrap: anywhere (only long paths actually break at that width) and a 16em minimum;
  • the proof column drops its 17em minimum;
  • an open diff scrolls inside its own box instead of widening the column.

At 1280px both boards are now exactly 888px, with every <details> closed or open. On phones (below 720px) the old widths still apply, so rows aren't taller there; the table scrolls sideways inside its box as before.

Checked

  • pytest (776 passed) and the node tests (267 passed).
  • An offline build of _site from the committed data: all 5,024 pages link ?v= URLs, and none link an unversioned one. The home page, 404 page and checker load every versioned asset (200), and the checker ran a full check of pallets/flask.
  • Before and after screenshots at 375px and 1280px, light and dark, of both boards. Nothing outside the .fixes table moved.

🤖 Generated with Claude Code

GitHub Pages lets browsers reuse a file for 10 minutes, so after a deploy a returning visitor
could get the new HTML with the old brand.css (the new popover menu then showed as a full-screen
box on phones). Every page now links the site's own CSS and JS as name?v=<first 10 hex of its
sha256>:

- scripts/assets.py: url() and stylesheets() for the generators, which now all write their
  <link> tags through build_campaigns.stylesheets(); and `python3 scripts/assets.py _site`,
  which the deploy runs right after copying site/, stamping the hand-written index.html,
  404.html and check/ pages and the checker's module imports (check-logic.mjs, worker.mjs,
  driver.py), dependencies first.
- tests/test_assets.py: the stamped hashes match the files, stamping is idempotent, a module
  change reaches the page, no generator writes an unversioned link, and the deploy runs it.

Windows on ARM and free-threaded boards: at 1280px the columns needed about 1060px in an 888px
column, so "The change" was cut off. Long paths in the change's text can now break, the proof
column has no minimum, the change column's is 16em, and an open diff scrolls inside its own
box. Phones keep the old widths (the table scrolls sideways there anyway).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@patrickballard
patrickballard merged commit 34d10ab into main Nov 29, 2026
1 check passed
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