Commit Graph

198 Commits

Author SHA1 Message Date
Josh Creek 92d6460765 fix(export): restrict provider endpoint overrides to loopback test servers
The endpoint overrides are read through `$env/dynamic/private`, so they are
evaluated per request in production, not baked in at build time. That made a
single injected environment variable enough to redirect the authorization-code
and refresh-token POSTs - which carry the OAuth client secret and the user's
refresh token - to an arbitrary host, and to redirect the user's authorize hop
to an arbitrary URL.

Overrides are now ignored unless ALLOW_PROVIDER_ENDPOINT_OVERRIDES is exactly
"true" and the value is a loopback URL. `npm run test:bdd` sets the flag;
nothing else should. resolveProviderEndpoints is pure so the refusals are unit
tested, including near-miss hosts such as http://127.0.0.1.example.

Also drops the unused `pokedex` parameter from buildCsv rather than silencing it
with `void`, and the dead hasGigantamaxed field from its fallback record.
2026-09-13 17:38:42 +01:00
Josh Creek f9b7bbdf0a fix(pwa): honour the adapter flag and precache an offline entry point
Three defects that together meant `npm run test:build` could not pass in any of
its four variants:

- svelte.config.js constructed adapter-netlify inline and never used the
  `adapter` export from adapter.mjs, so NODE_ADAPTER=true still produced a flat
  build/ directory while the build test expects the node adapter's build/client
  layout. adapter.mjs now returns netlify (the deployment target) or node, and
  svelte.config.js consumes it.

- No route is prerendered, so workbox's glob found no HTML document and a
  generateSW build precached nothing navigable: the app had no offline support
  in that mode at all. Adds the root entry and a navigation fallback, matching
  what prompt-sw.ts already did by hand for injectManifest builds.

- The build scripts used by the tests skipped the tailwind step that `build`
  runs, so static/output.css was never generated on a clean checkout and the
  app under test had no stylesheet.

The offline entry point assertion now also accepts the unquoted object key that
prompt-sw.ts's own precache call survives minification as.
2026-09-13 17:38:42 +01:00
Josh Creek de39dc78ea test: replace ad-hoc tests with a layered suite and CI workflow
Splits testing into five layers so a failure points at the responsible one:

- tests/unit    isolated utility, repository and service tests
- tests/data    validates the tracked Pokémon, game, region and dex files
- tests/integration  schema, views, constraints, RLS and repositories
- tests/bdd     executable Gherkin for user-visible behaviour
- tests/build   service worker and manifest artifacts per build variant

Replaces the two Playwright specs in client-test/ and the two Vitest files in
test/. Adds a GitHub Actions workflow running the layers as separate jobs, a
mock OAuth provider server so the Drive and Dropbox scenarios never touch real
accounts, and a wrapper that reads the local Supabase keys from
`supabase status` rather than hard-coding them.

Extracts the pure formatting helpers out of PokedexExportService so they can be
unit tested, and makes the provider endpoints configurable so the mock server
can stand in for Google and Dropbox.
2026-09-13 17:38:41 +01:00
Josh Creek 08c5e3271c style: format tracked files and ignore generated data exports
`prettier --check .` failed on 22 files, so gating CI on `npm run lint` was
never going to pass. These changes are whitespace only.

Adds the two remaining generated data exports to .prettierignore so this class
of churn cannot recur, along with machine-local settings files.
2026-09-13 17:38:35 +01:00
Josh Creek 676490b800 style(data): reformat generated Pokédex data files
These two files are generated exports that prettier was not ignoring, so
`prettier --check .` failed on them. Reformatting is isolated here because the
diff is ~124k lines and would otherwise bury real changes.

The only semantic change in this commit is the apostrophe in Farfetch'd and
Sirfetch'd: U+0027 -> U+2019, matching the spelling the rest of the data
already used. Everything else is whitespace.
2026-09-13 17:34:35 +01:00
Josh Creek bfd74a2985 Merge pull request #93 from jcreek/codex/fix-default-form-filtering
Fix default-form filtering and complete dex mappings
2026-09-13 12:56:17 +01:00
Josh Creek 7c32813cf2 fix: preserve default forms and complete dex mappings 2026-09-13 12:50:42 +01:00
Josh Creek c5a47439d9 Merge pull request #92 from jcreek/91-forms-only-work-when-all-games-is-selected
91 forms only work when all games is selected
2026-06-16 15:49:07 +01:00
Josh Creek 19e4d7b727 refactor(#91): Address PR comments 2026-06-16 15:46:12 +01:00
Josh Creek 8255fb4c67 fix(#91): correct form game coverage and fix canonical sort order 2026-06-16 15:28:07 +01:00
Josh Creek 069f7f41fa fix(data): add missing female form entries to pokemon_origin_games
Female Sneasel was absent from all 5 Gen 2 games (Gold, Silver, Crystal,
HeartGold, SoulSilver) and Female Indeedee was absent from Sword, despite
their base forms being present. Both found during QA of the form dex
game-scope feature.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 14:00:10 +01:00
Josh Creek 955cba1aaa fix(forms): supplement game-scoped dex entries with alternate forms
When a Pokédex has a game scope set and isFormDex=true, alternate forms
were not appearing because game_pokedex_entries only contains base-form
Pokémon. This adds fetchFormsForGame() to pull supplemental form entries
from pokedex_entries filtered by gamesToCatchIn, then merges and sorts
them using the base form's regional dex number so ordering is preserved.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 13:16:29 +01:00
Josh Creek c5a503f5b5 fix(my-pokedexes): preserve original desktop header and stack actions on mobile 2026-02-06 13:15:24 +00:00
Josh Creek 71cfbce7e3 feat(*): Add evolution data and notes 2026-01-25 17:19:51 +00:00
Josh Creek 4f2fe5e333 build(*): Update supabase version 2026-01-25 09:09:49 +00:00
Josh Creek 575aafbc28 build(*): Enable running db migrations in build 2026-01-24 17:59:28 +00:00
Josh Creek 6ecaa0f30f Merge pull request #90 from jcreek/89-add-backup-functionality-for-google-drive-and-dropbox
feat(#89): Add backup functionality for google drive and dropbox
2026-01-24 17:44:00 +00:00
Josh Creek e55d511141 refactor(#89): Address PR comments 2026-01-24 17:40:59 +00:00
Josh Creek 86e8d6f5e6 refactor(#89): Address PR comments 2026-01-24 17:26:55 +00:00
Josh Creek 8141bd624b refactor(#89): Address PR comments 2026-01-24 17:18:57 +00:00
Josh Creek ab82f75dc6 feat(#89): Add backup functionality for google drive and dropbox 2026-01-24 13:32:10 +00:00
Josh Creek 3f5c14a8bc data(*): Add evolution info 2026-01-24 10:09:23 +00:00
Josh Creek 8775e05ba7 Merge pull request #86 from jcreek/84-improve-performance-and-efficiency-of-service-worker
feat(#84): Improve performance and efficiency of service worker
2026-01-22 21:27:51 +00:00
Josh Creek c5c63ab8ef feat(#84): Improve performance and efficiency of service worker 2026-01-22 21:21:57 +00:00
Josh Creek dd9ced17d8 Merge pull request #83 from jcreek/82-improve-data-seeding-performance
82 improve data seeding performance
2026-01-19 12:26:44 +00:00
Josh Creek 606fcbb201 chore(*): Remove commented out code 2026-01-19 12:20:31 +00:00
Josh Creek dfa0569119 feat(*): Make pokemon sprite bigger 2026-01-19 12:18:25 +00:00
Josh Creek e819929898 feat(#84): Improve data seeding performance 2026-01-19 12:17:40 +00:00
Josh Creek decf6ca1fb Merge pull request #81 from jcreek/data/dexes
Improve data seeding and structure
2026-01-18 13:45:24 +00:00
Josh Creek 6d54c93700 fix(*): Address PR comment 2026-01-18 13:38:22 +00:00
Josh Creek 07ce2b3421 fix(*): Address PR comment 2026-01-18 13:25:54 +00:00
Josh Creek 0c25bba236 fix(*): Address PR comment 2026-01-18 13:18:55 +00:00
Josh Creek eba34158fe data(*): Fix remaining sprites 2026-01-18 13:14:18 +00:00
Josh Creek 71df0de3df fix(*): Address PR comments 2026-01-18 10:41:12 +00:00
Josh Creek 46351c9af0 data(*): Add final data changes 2026-01-17 23:30:40 +00:00
Josh Creek 479b3ae7a0 data(*): Add native game dexes 2026-01-17 22:42:12 +00:00
Josh Creek a26f38bca1 data(*): Improve ordering of forms 2026-01-17 21:08:21 +00:00
Josh Creek f302721119 data(*): Add working regenerated data structure 2026-01-17 20:39:55 +00:00
Josh Creek a604fe2526 data(*): Further corrections 2026-01-17 16:42:02 +00:00
Josh Creek 88d8344706 data(*): Remove old spreadsheet 2026-01-17 15:43:47 +00:00
Josh Creek bfef2fd4a7 data(*): Make corrections to csv 2026-01-17 15:42:01 +00:00
Josh Creek ee73c01afe feat(*): Change how data is set up 2026-01-16 21:11:21 +00:00
Josh Creek 3f0003b006 chore(*): Update csv 2026-01-15 19:34:28 +00:00
Josh Creek 874a6bd78e data(*): Add reference data 2026-01-11 21:20:27 +00:00
Josh Creek d40d4aa4e1 data(*): Add sinnoh data 2026-01-11 21:20:06 +00:00
Josh Creek bde3d71e6c data(*): Add hoenn data 2026-01-11 20:50:24 +00:00
Josh Creek a871da5d59 Merge pull request #80 from jcreek/48-add-dark-mode-toggle
48 add dark mode toggle
2026-01-10 21:53:08 +00:00
Josh Creek d437c05770 refactor(#48): Address PR comment 2026-01-10 21:50:56 +00:00
Josh Creek 9d14b2d2f1 refactor(#48): Address PR comments 2026-01-10 21:44:19 +00:00
Josh Creek ad8c8a847d feat(#48): Make box cells square on mobile 2026-01-10 21:35:14 +00:00