Skip to content

feat: combat flavor pools behind flavorVersion with fv URL param (#89)#153

Merged
Daren9m merged 4 commits into
mainfrom
claude/flavor-pool-versioning-89
Jul 20, 2026
Merged

feat: combat flavor pools behind flavorVersion with fv URL param (#89)#153
Daren9m merged 4 commits into
mainfrom
claude/flavor-pool-versioning-89

Conversation

@Daren9m

@Daren9m Daren9m commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

Third slice of Phase 1 (milestone: LLM Generators — Phase 1). Implements spec §5's flavor-pool versioning mechanism for the combat generator:

  • src/lib/flavor-pools.ts — the four inline pools (20 scenario hooks, 14×3 tactics, 4×4 treasure, 10 name prefixes) extracted verbatim (review verified byte-identity programmatically against the pre-extraction source: 88/88 strings identical, key order preserved) behind getFlavorPools(version) with a single POOLS_BY_VERSION indirection point that issue First generation run, review PR, and v2 golden pins #93 will repoint at generated data. v2 currently resolves to frozen v1 content.
  • flavorVersion?: 1 | 2 threaded through GenerateOptionslibrary default 1, so every existing caller and all seed-contract tests are untouched by construction. No RNG draw-order changes; random.ts untouched.
  • fv URL param on /encounters: new generations use flavorVersion 2 and write fv=2; hydration maps anything else to v1, so pre-existing share links reproduce exactly what they did.
  • .gitignore: local SRD reference extracts (build-time input, scripts/vendor/ precedent).

Notes for review

  • One existing test file changed by design: scripts/flavor/schemas.test.ts swapped its source-text scrape of the (now relocated) pool consts for real imports of getFlavorPools(1) — assertions equivalent-or-stronger. The scrape only existed because the earlier issue's scope fence forbade touching src/.
  • v2===v1 pin tests carry delete-on-First generation run, review PR, and v2 golden pins #93 comments.
  • Known minor: recipe share links also carry an inert fv=2 (recipes don't draw flavor pools) — deliberate config uniformity, noted for First generation run, review PR, and v2 golden pins #93.

Test plan

  • npm run typecheck clean · npx vitest run 42 files, 652/652 · npm run lint 0 errors · npm run flavor:check exit 0 · npm run build static export succeeds
  • New TDD suites: flavor-pools verbatim pins (first/last/length per pool), default-is-v1 deep-equal, v2===v1 temporary pin, parseFlavorVersionParam mapping

Closes #89

Daren9m added 4 commits July 19, 2026 21:00
Relocate the four inline combat prose pools (scenario hooks,
tactics-by-type, treasure-by-tier, name prefixes) verbatim from
encounter-generator.ts into src/lib/flavor-pools.ts, exported through
getFlavorPools(version) with FlavorVersion = 1 | 2. Version 2 currently
resolves to the same frozen v1 content through the single
POOLS_BY_VERSION indirection point; issue #93 repoints it at generated
src/data/encounter-flavor.ts. GenerateOptions gains flavorVersion
(default 1) and every prose helper draws from the resolved pools, so
same seed + same flavorVersion stays byte-identical and existing
callers are untouched by construction.

Also swap schemas.test.ts's tactics/treasure cross-checks from scraping
encounter-generator.ts source text to importing the real exported v1
pools: the scrape existed only because Task B's scope fence forbade
touching src/, the extraction mandated by issue #89 invalidates that
workaround, and importing the actual pool objects is a strictly
stronger cross-check. Assertions are unchanged in meaning (schema enum
keys must exactly match the engine pool keys).
New generations call the generator with flavorVersion: 2 and write fv=2
into the share URL alongside the seed. Hydration maps fv=2 to version 2
and anything else (including its absence) to version 1 via the pure
parseFlavorVersionParam helper, so pre-versioning share links keep
replaying their original v1 prose byte-for-byte.
@Daren9m
Daren9m merged commit 556e8f5 into main Jul 20, 2026
1 check passed
@Daren9m
Daren9m deleted the claude/flavor-pool-versioning-89 branch July 20, 2026 03:29
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.

Combat flavor pool extraction + flavorVersion/fv versioning (v1 default)

1 participant