docs: cut the version badge cache to the shortest shields allows - #162
Merged
Merged
Conversation
The badges lag a deploy by far longer than intended. Two caches compound, each at the 600 seconds this set: shields serves `max-age=600` from a CDN that caches per edge, and GitHub's camo proxy then mirrors that max-age on top. So a badge can be up to twenty minutes stale, and two people can see different versions at the same moment depending on which shields edge they reach. Measured while diagnosing: camo fetched fresh (`x-cache: MISS`, `age: 0`) and was handed `v4.4.0` by shields, two releases behind, at a moment a direct request returned `v4.6.0`. 120 is the floor — shields clamps anything lower, serving `max-age=120` for a requested 30 or 60 alike. That takes the worst case from roughly twenty minutes to roughly four. It cannot be real time. GitHub serves every external image through a caching proxy, so a README badge is always a cached copy of a cached copy. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VU7YUhP71KSsotWQ1H7CRH
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VU7YUhP71KSsotWQ1H7CRH
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.
📌 Description
The live version badges added in #161 lag a deploy by much longer than intended. Diagnosed rather
than guessed:
Two caches compound, each at the 600 seconds #161 set. shields.io serves
cache-control: max-age=600from a CDN that caches per edge, and GitHub's camo proxy thenmirrors that
max-ageon top of it. A badge can therefore be up to ~20 minutes stale, and twopeople can see different versions at the same moment depending on which shields edge they reach.
Measured, not inferred. camo fetched fresh —
x-cache: MISS,age: 0— and shields handed itproduction: v4.4.0, two releases behind, at a moment a direct request to shields returnedv4.6.0.120 seconds is the floor. shields clamps anything lower: a requested
cacheSecondsof 30 or 60both come back as
max-age=120. Worst case goes from roughly twenty minutes to roughly four.cacheSecondsrequestedCache-Controlservedmax-age=120max-age=120max-age=120max-age=300max-age=600(before this change)It cannot be real time, and that is worth stating plainly: GitHub serves every external image
through a caching proxy, so a README badge is always a cached copy of a cached copy. Anyone needing
the exact deployed version should read
/openapi.json, which the badge links to.🧱 Type of Change
requirements.txt,pyproject.tomlMarked as a bug fix as well as a docs change: the badges were showing a version the service had not
run for two releases.
🧪 How Has This Been Tested?
tests/unit/)tests/functional/)tests/integration/)276 tests, 100.00% coverage, unchanged — no code is touched.
pre-commit run --all-filespasses 12/12 hooks.
Manual: requested
cacheSecondsof 30, 60, 120, 300 and 600 against shields and recorded theCache-Controleach returned (table above); pulled the camo URL out of GitHub's rendered README andread its cache headers and rendered value; and confirmed both environments'
/openapi.jsonreport4.6.0, so the badge source is correct and the staleness was entirely caching.Unchecked: nothing in the image or its behaviour changes.
✅ Checklist
scripts/run_tests.py)pre-commit run --all-files).envvars updated (if applicable)scripts/benchmark/benchmark_requests.py)Unchecked items carry no work: no code, no image change, no new variables, nothing a benchmark
measures.
🛠️ Affected API Behaviour
app/app.py– Modified/authenticateroute logicapp/pesu.py– Updated scraping or authentication handlingOnly
README.md— two query parameters.🧩 Models
app/models/request.py– Input validation or request schema changesapp/models/response.py– Authentication response formattingapp/models/profile.py– Profile extraction logic🐳 DevOps & Config
Dockerfile– Changes to base image or build process.github/workflows/*.yaml– CI/CD pipeline or deployment updatespyproject.toml/requirements.txt– Dependency version changes.pre-commit-config.yaml– Linting or formatting hook changesProject version only, 4.6.0 → 4.7.0, plus the matching
uv.lock.📊 Benchmarks & Analysis
scripts/benchmark/benchmark_requests.py– Performance or latency measurement changesscripts/benchmark/analyze_benchmark.py– Benchmark result analysis changesscripts/run_tests.py– Custom test runner logic or behavior updates🧠 Additional Notes
A shorter cache means shields re-fetches
/openapi.jsonmore often, which is 18 KB from a publicendpoint and also keeps the service awake — neither a cost worth avoiding here.
If a badge that is never stale is wanted, the only way is for the value to come from something
GitHub does not proxy — which no README badge can be. The realistic alternative is the Grafana
dashboard, which queries live.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VU7YUhP71KSsotWQ1H7CRH