Rebuild the docs cache when the markdown behind it changes - #493
Merged
Conversation
Docs pages and navigation were cached for a day with no link back to the files they were rendered from. Deploys ship new markdown without clearing the application cache, so an edited page — and the sidebar rendered alongside it — could trail the actual files by up to 24 hours. Each cache entry now carries a fingerprint of the markdown it was built from (relative path plus mtime for every .md file in the version, no file contents read) and is rebuilt as soon as that stops matching. Entries written before the fingerprint existed have none, so they miss and rebuild on first request. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
simonhamp
marked this pull request as ready for review
September 3, 2026 09:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Docs pages and navigation were cached for a day with no link back to the markdown files they were rendered from:
The key folds in
config('docs'), so a Jump version bump invalidates rendered pages — but nothing invalidates them when the markdown itself changes. Deploys ship new docs without clearing the application cache, so an edited page (and the sidebar rendered alongside it) could trail the actual files by up to 24 hours.Why this shape
Each cache entry now carries a fingerprint of the markdown it was built from, and is rebuilt as soon as that stops matching. The fingerprint is an md5 of every
.mdfile's relative path plus mtime for the platform/version — no file contents are read, so it stays cheap on the hot path while still catching edits, additions and deletions.Entries written before the fingerprint existed have none, so they miss and rebuild on the first request. No cache flush is needed to deploy this.
localstill bypasses the cache entirely, unchanged.Tests
Four new cases in
tests/Feature/Docs/DocsCachingTest.php:The stale fixtures are shaped so the view renders rather than throwing — the assertion, not an exception, is what reports a failure.
php artisan test tests/Feature/Docs/DocsCachingTest.php→ 7 passed (15 assertions). Pint clean.🤖 Generated with Claude Code