Skip to content

Cache free-mode country access#660

Merged
jahooma merged 1 commit into
mainfrom
jahooma/cache-ipinfo-per-session
May 12, 2026
Merged

Cache free-mode country access#660
jahooma merged 1 commit into
mainfrom
jahooma/cache-ipinfo-per-session

Conversation

@jahooma
Copy link
Copy Markdown
Contributor

@jahooma jahooma commented May 12, 2026

Summary

Adds a Postgres-backed free-mode country/privacy cache keyed by user and hashed client IP so scaled web instances can reuse IPinfo decisions.
Wires the chat completions free-mode country gate through the cache with safe fallback logging, preserves raw-IP privacy, and includes TTLs for allowed, VPN/proxy, country-blocked, and transient-failure outcomes.
Adds the Drizzle migration/schema metadata and focused tests for cache hits, misses, refreshes, and TTL behavior.

Validation

  • bun test web/src/server/tests/free-mode-country-access-cache.test.ts web/src/server/tests/free-mode-country.test.ts web/src/app/api/v1/chat/completions/tests/completions.test.ts
  • bun --cwd web typecheck
  • bun --cwd packages/internal typecheck
  • bunx prettier --check packages/internal/src/db/migrations/meta/_journal.json packages/internal/src/db/migrations/meta/0051_snapshot.json

@jahooma jahooma merged commit f1b6ff3 into main May 12, 2026
35 checks passed
@jahooma jahooma deleted the jahooma/cache-ipinfo-per-session branch May 12, 2026 20:20
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