test: add deterministic csv fixtures for fast random checks
Some checks failed
CI / build (push) Waiting to run
Preview Performance Regression Gate / preview-perf (push) Waiting to run
Editorial Lint / lint-editorial (push) Has been cancelled

This commit is contained in:
matt 2025-09-27 16:44:38 -07:00
parent 3b4ae36a11
commit 0e2eb29258
10 changed files with 36 additions and 2 deletions

6
.gitignore vendored
View file

@ -8,7 +8,10 @@
test.py
!requirements.txt
__pycache__/
csv_files/
# Keep main CSV datasets out of Git, but allow the tiny deterministic fixtures used by CI.
csv_files/*
!csv_files/testdata/
!csv_files/testdata/**/*
dist/
logs/
!logs/
@ -17,7 +20,6 @@ logs/*
logs/perf/*
!logs/perf/theme_preview_warm_baseline.json
deck_files/
csv_files/
config/themes/catalog/
!config/card_lists/*.json
!config/themes/*.json

View file

@ -13,6 +13,9 @@ This format follows Keep a Changelog principles and aims for Semantic Versioning
- Link PRs/issues inline when helpful, e.g., (#123) or [#123]. Reference-style links at the bottom are encouraged for readability.
## [Unreleased]
### Added
- Included the tiny `csv_files/testdata` fixture set so CI fast determinism tests have consistent sample data.
### Changed
- Theme catalog schema now accepts optional `id` values on entries so refreshed catalogs validate cleanly.
- CI installs `httpx` with the rest of the web stack and runs pytest via `python -m pytest` so FastAPI tests resolve the local `code` package correctly.

View file

@ -4,6 +4,7 @@
- Hardened theme catalog schema to accept optional IDs and refreshed the preview performance baseline to keep CI checks green.
- CI updates install the missing `httpx` dependency and run pytest through `python -m` to ensure the web stack tests import the local package correctly.
- Fast-path catalog validation now tolerates empty synergy lists while still flagging missing fields or non-string entries.
- Committed deterministic CSV fixtures under `csv_files/testdata` so CI random-mode checks have a stable dataset.
- Delivered multi-theme random builds with deterministic cascade, strict match support, and polished HTMX/UI flows.
- Added opt-in telemetry counters, reroll throttling safeguards, and structured diagnostics exports.
- Expanded tooling, documentation, and QA coverage for theme governance, performance profiling, and seed history management.
@ -33,6 +34,7 @@
- Theme catalog schema now accepts optional IDs and the preview performance warm baseline was regenerated to restore the regression gate.
- GitHub Actions now includes `httpx` in the default dependency install and executes pytest via `python -m` so FastAPI TestClient suites run without import errors.
- Fast path validator treats empty synergy arrays as acceptable and only warns on missing or malformed data, reducing noise during automated catalog generation.
- Tracked the tiny `csv_files/testdata` dataset in Git to guarantee fast determinism tests run against a consistent fixture set.
## Detailed changes
### Added

10
csv_files/testdata/README.md vendored Normal file
View file

@ -0,0 +1,10 @@
Frozen test dataset for deterministic tests.
Use by setting environment variable CSV_FILES_DIR=csv_files/testdata (or absolute path in Docker).
Expected minimal files:
- cards.csv (flattened all-cards dataset for validation endpoints)
- commander_cards.csv
- *_cards.csv per color identity needed by tests (e.g., colorless_cards.csv)
Keep this tiny and representative; avoid adding large data.

6
csv_files/testdata/cards.csv vendored Normal file
View file

@ -0,0 +1,6 @@
name,faceName,edhrecRank,colorIdentity,colors,manaCost,manaValue,type,creatureTypes,text,power,toughness,keywords,themeTags,layout,side
Shock,,,,R,{R},1,Instant,,Deal 2 damage to any target.,,,,[Burn],normal,
Plains,,,,W,,0,Land,,{T}: Add {W}.,,,,[Land],normal,name,faceName,edhrecRank,colorIdentity,colors,manaCost,manaValue,type,creatureTypes,text,power,toughness,keywords,themeTags,layout,side
Sol Ring,,1,Colorless,,{1},{1},Artifact,,{T}: Add {C}{C}.,,,Mana,Utility,normal,
Llanowar Elves,,5000,G,G,{G},{1},Creature,Elf Druid,{T}: Add {G}.,1,1,Mana,Tribal;Ramp,normal,
Island,,9999,U,U,,,Land,,{T}: Add {U}.,,,Land,,normal,
1 name,faceName,edhrecRank,colorIdentity,colors,manaCost,manaValue,type,creatureTypes,text,power,toughness,keywords,themeTags,layout,side
2 Shock,,,,R,{R},1,Instant,,Deal 2 damage to any target.,,,,[Burn],normal,
3 Plains,,,,W,,0,Land,,{T}: Add {W}.,,,,[Land],normal,name,faceName,edhrecRank,colorIdentity,colors,manaCost,manaValue,type,creatureTypes,text,power,toughness,keywords,themeTags,layout,side
4 Sol Ring,,1,Colorless,,{1},{1},Artifact,,{T}: Add {C}{C}.,,,Mana,Utility,normal,
5 Llanowar Elves,,5000,G,G,{G},{1},Creature,Elf Druid,{T}: Add {G}.,1,1,Mana,Tribal;Ramp,normal,
6 Island,,9999,U,U,,,Land,,{T}: Add {U}.,,,Land,,normal,

View file

@ -0,0 +1,2 @@
name,type_line,tags
Swampshade Test,Creature,B
1 name type_line tags
2 Swampshade Test Creature B

View file

@ -0,0 +1,2 @@
name,type_line,tags
MyrTest,Artifact Creature,Colorless
1 name type_line tags
2 MyrTest Artifact Creature Colorless

View file

@ -0,0 +1,2 @@
name,type_line,tags
Mountainling Test,Creature,R
1 name type_line tags
2 Mountainling Test Creature R

View file

@ -0,0 +1,2 @@
name,type_line,tags
Plainscycler Test,Creature,W
1 name type_line tags
2 Plainscycler Test Creature W

View file

@ -0,0 +1,3 @@
name,faceName,edhrecRank,colorIdentity,colors,manaCost,manaValue,type,creatureTypes,text,power,toughness,keywords,themeTags,layout,side
Krenko, Mob Boss,,1200,R,R,{2}{R}{R},4,Legendary Creature,['Goblin'],Tap: Create X 1/1 red Goblin tokens.,3,3,,['Goblin Kindred'],normal,
Isamaru, Hound of Konda,,2500,W,W,{W},1,Legendary Creature,['Hound'],Legendary creature.,2,2,,['Dog Kindred'],normal,
1 name,faceName,edhrecRank,colorIdentity,colors,manaCost,manaValue,type,creatureTypes,text,power,toughness,keywords,themeTags,layout,side
2 Krenko, Mob Boss,,1200,R,R,{2}{R}{R},4,Legendary Creature,['Goblin'],Tap: Create X 1/1 red Goblin tokens.,3,3,,['Goblin Kindred'],normal,
3 Isamaru, Hound of Konda,,2500,W,W,{W},1,Legendary Creature,['Hound'],Legendary creature.,2,2,,['Dog Kindred'],normal,