Repository navigation
Conversation
A signed-in user whose email is in ADMIN_EMAILS gets "Admin" in the account menu, opening /admin,
whose one action is clearing the result cache for the whole deployment.
Every 'use cache: remote' body now starts with resultEntry() (lib/next-cache.ts), which sets the
day's lifetime as before and tags the entry RESULT_TAG; POST /api/admin {action: "clearCache"}
expires that tag with revalidateTag(tag, {expire: 0}). On Vercel that is the Runtime Cache shared
by every function instance; elsewhere it is the answering process's own memory. No database
change: nothing records the clear.
requireAdmin (lib/auth.ts) refuses with 404 where the deployment has no sign-in and 403 for anyone
signed out or not listed. With the development sign-in anyone can claim an address, so there it is
a convenience, not a guard; that sign-in is already refused on Vercel production.
Verified on an isolated next dev (in-process Postgres, dev sign-in): Explore 55 ms cached ->
707 ms recomputed after a clear -> 36 ms cached again, the study list likewise; a signed-out and
a non-admin request are refused; a non-admin has no menu item; the page and its confirm flow
driven in Chromium with no console errors. test/auth.test.ts covers who is an admin;
test/result-cache-tag.test.ts fails on a cached body without resultEntry() (checked by planting
one). Gate: lint, build, unit (1674) and postgres (66) passed; stopped before e2e.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTZPdCcLJ4FcYtykedj
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
|
Superseded by #83, which contains this commit plus live federation settings on /admin. |
This branch was successfully deployed
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
ADMIN_EMAILSenv var get Admin in the account menu, which opens/admin. Its one action is Clear the cache, which empties the result cache for the whole deployment.'use cache: remote'body now starts withresultEntry()(lib/next-cache.ts), which keeps the one-day lifetime and adds the tagRESULT_TAG.POST /api/admin {action:"clearCache"}expires that tag withrevalidateTag(tag, { expire: 0 }).requireAdmin,lib/auth.ts):Before merging
Set
ADMIN_EMAILS(comma-separated) in Vercel production. Without it, nobody sees the page.Verified
next dev(in-process Postgres, dev sign-in):test/auth.test.tscovers who counts as an admin.test/result-cache-tag.test.tsfails if a cached body lacksresultEntry(), which would let it survive a clear. I confirmed it fails by planting one.Not in this PR
Live-editing the federation settings is on the local branch
session/admin-federation(not pushed). It needs migration0010on Supabase, which is waiting on the owner database URL.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q3ezTZPdCcLJ4FcYtykedj