Skip to content

fix(auth): avoid negative-caching transient user-key failures#5599

Open
JacobisEpic wants to merge 3 commits into
koala73:mainfrom
JacobisEpic:fix/5384-user-api-key-negative-cache
Open

fix(auth): avoid negative-caching transient user-key failures#5599
JacobisEpic wants to merge 3 commits into
koala73:mainfrom
JacobisEpic:fix/5384-user-api-key-negative-cache

Conversation

@JacobisEpic

Copy link
Copy Markdown

Summary

Fixes #5384.

Distinguishes definitive invalid user API keys from transient or indeterminate Convex validation failures.

Previously, Convex 5xx responses, timeouts, missing configuration, and genuine unknown keys could all collapse into the same null result.
The cache layer interpreted that result as definitively invalid and stored the negative sentinel for 60 seconds.

This change preserves negative caching for genuine unknown keys while ensuring transient validation failures remain retryable.

Type of change

  • Bug fix
  • New feature
  • New data source / feed
  • New map layer
  • Refactor / code cleanup
  • Documentation
  • CI / Build / Infrastructure

Affected areas

  • Map / Globe
  • News panels / RSS feeds
  • AI Insights / World Brief
  • Market Radar / Crypto
  • Desktop app (Tauri)
  • API endpoints (/api/*)
  • Config / Settings
  • Other:

Checklist

  • Tested on worldmonitor.app variant
  • Tested on tech.worldmonitor.app variant (if applicable)
  • New RSS feed domains added to api/rss-proxy.js allowlist (not applicable)
  • No API keys or secrets committed
  • TypeScript compiles without errors (npm run typecheck)

Documentation Alignment Checklist

N/A - backend authentication/cache behavior only; no published documentation claims or generated artifacts changed.

Validation

  • ./node_modules/.bin/vitest run server/__tests__/user-api-key-validation.test.ts server/__tests__/user-api-key-negative-cache.test.ts - 2 files, 32 tests passed.
  • ./node_modules/.bin/tsx --test tests/redis-caching.test.mjs - 10 suites, 40 tests passed.
  • npm run test:convex - 56 files, 1,005 tests passed.
  • node --test api/_api-key.test.mjs api/_user-api-key.test.mjs - 77 tests passed.
  • ./node_modules/.bin/tsx --test tests/mcp-user-key-auth.test.mjs tests/mcp-usage-telemetry.test.mjs tests/premium-stock-gateway.test.mts - 5 suites, 40 tests passed.
  • ./node_modules/.bin/biome check server/_shared/redis.ts server/_shared/user-api-key.ts server/__tests__/user-api-key-negative-cache.test.ts tests/redis-caching.test.mjs - 4 files passed.
  • npm run typecheck:api - passed.
  • npm run typecheck - passed.
  • bash .husky/pre-push - all change-scoped gates passed, including 107 server handler tests and 40 changed-file cache tests.

No unrelated baseline failures.

Screenshots

N/A - backend authentication/cache behavior only.

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

@JacobisEpic is attempting to deploy a commit to the World Monitor Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the trust:safe Brin: contributor trust score safe label Jul 25, 2026
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
worldmonitor Ready Ready Preview, Comment Jul 25, 2026 8:04pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

trust:safe Brin: contributor trust score safe

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1] user-api-key: transient Convex failure is negative-cached as an invalid key for 60s

2 participants