fix(#358): team route degrades gracefully on data-store failure - #359
Open
ChesterSchendel wants to merge 1 commit into
Open
fix(#358): team route degrades gracefully on data-store failure#359ChesterSchendel wants to merge 1 commit into
ChesterSchendel wants to merge 1 commit into
Conversation
The /dashboard/team GET handler had no error handling, so any throw in the Redis-backed enrichment surfaced as an opaque 500 — exactly what happened when prod's Redis.fromEnv() resolved to a stale/empty store after the KV migration. Managers (who run per-member Redis reads) 500'd; viewers (no Redis calls) saw the page. The failure was invisible: no server-side log. - Wrap GET in a thin wrapper around buildTeamResponse() that logs the real error instead of returning a bare 500. - Degrade gracefully: per-member and archived enrichment failures fall back to roster-only (stats: null) and set `degraded: true` rather than failing the whole request. Only auth/Clerk failures now return 500. - Client shows a non-blocking notice when `degraded`, instead of the red "Team fetch failed (500)" error. - /hq/api: document the new degraded behavior + stamp. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 & why
Follow-up hardening to today's prod incident where
/dashboard/teamreturnedTeam fetch failed (500)after the Vercel KV migration. Root cause was infra (staleUPSTASH_*vars in Production overrode the newKV_REST_API_*, soRedis.fromEnv()read a dead store) and has already been fixed in Vercel + the data restored. This PR addresses the code defect that made the failure opaque and total.The handler had no error handling. Any throw in the Redis-backed enrichment became a bare 500 with no server-side log — which is why diagnosing it took reverse-engineering instead of reading a stack trace. It also explained the split symptom: managers run per-member Redis reads (→ 500), viewers make no Redis calls (→ page rendered).
Changes
GETis now a thin wrapper aroundbuildTeamResponse()with an outer try/catch that logs the real error (console.error("[dashboard/team] fetch failed", err)).stats: null) and flipdegraded: true, instead of throwing the whole request. The roster comes from Clerk, so it renders even when the data store is down. Only genuine auth/Clerk failures return 500.degraded: boolean.degraded("Live performance data is temporarily unavailable… roster is current and scoring still works") instead of the red 500 banner.Net effect
Today's incident would have shown the team roster with a notice and a logged root cause, rather than a blank red error.
/hq lockstep
/hq/api: documented the team endpoint's degraded behavior + stamped frontmatter (lastPr 359).Verification
tsc --noEmit: no new errors (the lonevalidator.tsline is a pre-existing stale.nextartifact).eslint: clean.Resolves #358.
🤖 Generated with Claude Code