Skip to content

test(config): pin Cache-Control: no-store on /api/config#4476

Open
pedrofrxncx wants to merge 1 commit into
mainfrom
test/public-config-no-store-header
Open

test(config): pin Cache-Control: no-store on /api/config#4476
pedrofrxncx wants to merge 1 commit into
mainfrom
test/public-config-no-store-header

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Source

Improvement found while reading recently-churned files (Source 3) — no open PR or issue covers this.

Why

public-config.ts sets Cache-Control: no-store on /api/config specifically so version-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" on GET /api/config.

Verify

bun test apps/mesh/src/api/routes/public-config.test.ts

Checks run locally

  • bun run fmt
  • bun 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.

Review in cubic

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.
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