feat(game): serve panorama index from Neon Postgres

- panoramas + pano_provinces tables replace 28MB bundled JSON; pano-index.js
  now draws via cached COUNT + ORDER BY id OFFSET with rejection sampling,
  composite (province,id)/(district,id) indexes support the skip
- scripts/seed-pano-db.mjs validates pipeline artifacts (the old real-data
  vitest invariants, extracted to scripts/lib/pano-artifacts.mjs), stages
  into panoramas_next, verifies, renames into place in one transaction,
  keeps panoramas_old as backup; --province reseeds in place; --check
  validates only
- pipeline writes gitignored data-build/panos/; pano barrel removed
- tests run against PGlite mocked in at the @neondatabase/serverless
  boundary, mirroring the fake-upstash pattern; fixtures replace real data
- infrastructure errors rethrow instead of reading as missing coverage;
  session ids via crypto.randomUUID (uuid package dropped)
This commit is contained in:
tiennm99 committed 2026-08-31 09:44:03 +07:00
1 parent da7a715478
commit 6569f095c9
45 files changed
+1510 -425270

No files matched your search

+3
View File
@@ -9,6 +9,9 @@ export default defineConfig({
env: {
UPSTASH_REDIS_REST_URL: 'http://fake-upstash.test',
UPSTASH_REDIS_REST_TOKEN: 'fake-token',
// lib/pano-db.js refuses to build a handle without this. The tests mock
// the Neon SDK itself (PGlite behind it), so the value is never dialled.
DATABASE_URL: 'postgres://fake-neon.test/fake',
// Pinned so the assertions on physical keys hold regardless of what the
// developer's .env sets.
KEY_PREFIX: 'vngeoguessr:',