Skip to content

refactor(iscored): one SWR cache helper and safeFetch for both fetches (PP-az4d.19) - #2432

Merged
timothyfroehlich merged 6 commits into
mainfrom
refactor/PP-az4d.19-iscored-swr-cache
Oct 6, 2026
Merged

timothyfroehlich merged 6 commits into
mainfrom
refactor/PP-az4d.19-iscored-swr-cache

Conversation

@timothyfroehlich

Copy link
Copy Markdown
Owner

Summary

  • Replace the two hand-rolled in-memory stale-while-revalidate caches in src/lib/iscored/client.ts with one createSwrCache<T>({ttlMs, failureRetryMs, load, empty}) helper. The genuine difference stays: a failed games fetch retries after 15s, a failed scores fetch waits the normal 15s TTL.
  • Move both raw fetch calls onto safeFetch from ~/lib/http/external (CORE-ARCH-016) behind one fetchIscoredJson, keeping the 8s timeout, log messages, and result shapes.
  • Add two tests pinning the retry-interval difference; note iScored's move in CORE-ARCH-016.

No behavior change. Tests: src/lib/iscored unit (57 pass), iscored-actions integration (13 pass), pnpm run check clean.

🤖 Generated with Claude Code

timothyfroehlich and others added 2 commits October 6, 2026 08:55
…d fetches (PP-az4d.19)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pin-point Ready Ready Preview Oct 6, 2026 7:53pm UTC

Request Review

timothyfroehlich and others added 2 commits October 6, 2026 14:26
…tError (PP-az4d.19, CORE-ARCH-015)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@timothyfroehlich

Copy link
Copy Markdown
Owner Author

Claude Code review (medium)

Reviewed head 9a2e558 with /code-review medium. 2 findings: 1 fixed, 1 declined.

Round Finding Disposition
1 src/lib/iscored/client.ts:175 — Mid-body read failure now goes to reportError instead of log.warn and could raise a Sentry event per refresh during an iScored outage. Fixed in 9a2e558
2 src/lib/iscored/client.ts:78 — An in-flight load for an old gameroom user can store its result under a new key after a user change or clear(). Declined: Pre-existing behavior carried over unchanged by this no-behavior-change refactor, and ISCORED_USER is a fixed per-process env value so the key never changes at runtime.

—Claude

@timothyfroehlich
timothyfroehlich marked this pull request as ready for review October 6, 2026 20:10
@timothyfroehlich
timothyfroehlich merged commit c883a40 into main Oct 6, 2026
17 checks passed
@timothyfroehlich
timothyfroehlich deleted the refactor/PP-az4d.19-iscored-swr-cache branch October 6, 2026 21:50

This branch was successfully deployed

1 active deployment
Preview — 9a2e5588 Deployed Oct 6, 2026 by vercel[bot]
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