Skip to content

fix(ui): stop browsers running the previous release's app.js after an upgrade - #367

Merged
GeiserX merged 1 commit into
mainfrom
fix/versioned-static-assets
Sep 20, 2026
Merged

GeiserX merged 1 commit into
mainfrom
fix/versioned-static-assets

Conversation

@GeiserX

@GeiserX GeiserX commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

After the v1.36.8 upgrade, a tab that had loaded the dashboard the day before kept running the old app.js, so the Logs button looked as broken as ever until a hard refresh. Our own scripts and stylesheet are referenced by bare path and served with no Cache-Control, so the browser reuses them under heuristic freshness for hours.

Each of our own assets now carries ?v=<release> in its URL. A new release is a new URL, and the stale cache entry is never consulted.

Summary by CodeRabbit

  • Bug Fixes

    • Static CSS and JavaScript assets now include the current application version in their URLs, ensuring browsers retrieve updated files after a release.
  • Tests

    • Added coverage verifying that dashboard assets are versioned consistently and that changing the application version produces updated asset URLs.

The dashboard's stylesheet and scripts were referenced by bare path and served
with an ETag but no Cache-Control, so browsers applied heuristic freshness and
reused a day-old app.js for hours after an upgrade. After v1.36.8 a tab that had
loaded the dashboard the day before still ran the old script, and the bug that
release fixed looked unfixed until a hard refresh.

Each of our own assets now carries ?v=<release> in its URL, so every release is
a new URL and the old cache entry is never consulted.
@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: GeiserX/CashPilot/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 2d1b6795-7565-45ed-959d-f768f26c812b

📥 Commits

Reviewing files that changed from the base of the PR and between b643f77 and 809ffce.

📒 Files selected for processing (2)
  • app/templates/base.html
  • tests/test_static_assets_are_versioned.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The base template now appends the running application version to its CSS and JavaScript asset URLs. New tests verify versioned references and reject unversioned asset paths.

Changes

Static asset cache versioning

Layer / File(s) Summary
Versioned asset references
app/templates/base.html, tests/test_static_assets_are_versioned.py
The template adds ?v={{ app_version() }} to the stylesheet, application JavaScript, and delegated JavaScript URLs. Tests verify release-specific URLs and ensure no bare references remain.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: versioning asset URLs to prevent browsers from using an older app.js after an upgrade. It focuses on app.js, while the changes also version the stylesheet …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.76%. Comparing base (b643f77) to head (809ffce).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #367      +/-   ##
==========================================
+ Coverage   95.74%   95.76%   +0.01%     
==========================================
  Files          51       51              
  Lines        7337     7337              
==========================================
+ Hits         7025     7026       +1     
+ Misses        312      311       -1     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@GeiserX
GeiserX merged commit 0238c28 into main Sep 20, 2026
8 checks passed
@GeiserX
GeiserX deleted the fix/versioned-static-assets branch September 20, 2026 11:58
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