test(config): pin Cache-Control: no-store on /api/config#4476
Open
pedrofrxncx wants to merge 1 commit into
Open
test(config): pin Cache-Control: no-store on /api/config#4476pedrofrxncx wants to merge 1 commit into
pedrofrxncx wants to merge 1 commit into
Conversation
Regression guard for the header that keeps version-check-dialog's drift poll honest. Without no-store, browser/intermediary caching can serve a stale version indefinitely, defeating the poll — the stuck dialog then appears to "fix itself" only after a hard refresh clears the cache (the exact failure mode described in public-config.ts's own comment). This endpoint's version-check logic has been reverted and reshipped three times in git history (#4403, #4418, #4425, #4460, #4463), yet nothing pinned this header.
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.
Source
Improvement found while reading recently-churned files (Source 3) — no open PR or issue covers this.
Why
public-config.tssetsCache-Control: no-storeon/api/configspecifically soversion-check-dialog.tsx's drift-detection poll isn't defeated by caching — the in-code comment documents the exact failure mode: a cached response returns the same stale value forever, and a hard refresh (which incidentally clears the cache) makes a stuck "new version available" dialog look like it "fixes itself" for no reason. This version-check feature has been reverted and reshipped three separate times (#4403, #4418, #4425, #4460, #4463), yet no test pinned this header — a future refactor of the route could silently drop it and reintroduce that exact confusing bug.What changed
Added one test asserting
res.headers.get("Cache-Control") === "no-store"onGET /api/config.Verify
Checks run locally
bun run fmtbun test apps/mesh/src/api/routes/public-config.test.ts(9 pass)Full CI will run typecheck/lint across the monorepo.
Summary by cubic
Add a test that asserts Cache-Control: no-store is returned by GET /api/config to keep the version-drift poll reliable. This guards against caching serving stale config and causing the “new version available” dialog to get stuck.
Written for commit 1adc315. Summary will update on new commits.