fix(01-03): align Foundry path with pf2e-8.0.3 layout

- Foundry pf2e v8 nests pf2e packs under packs/pf2e/ (v7 had packs/classes/ directly)
- Update FOUNDRY_CLASSES_DIR path to packs/pf2e/classes/
- Document v8 layout in SEED-README and update failure-mode path string
- Pitfall #5 mitigation: comment in seed script explains version-specific path

Worked-example verification (Wizard end-to-end):
- 320 ClassProgression rows seeded (16 classes x 20 levels)
- Wizard L1..L19 carry ARCANE spell-slot increments + L1 has 5 cantrips
- Wizard L1 has choiceType=school, choiceOptionsRef=wizard-school
- 1 ClassFeatureOption row for wizard-school (battle-magic / School of Battle Magic)
- Idempotent on re-run: 0 created, 320 updated, 0 errors
This commit is contained in:
2026-04-27 14:53:46 +02:00
parent e85f790458
commit ce214ab70c
2 changed files with 19 additions and 2 deletions

View File

@@ -35,9 +35,16 @@ npm run db:seed:class-progression
Idempotent: running twice does not duplicate rows. Console output reports `created` and Idempotent: running twice does not duplicate rows. Console output reports `created` and
`updated` counts plus any errors. `updated` counts plus any errors.
## Foundry pf2e v8 layout note
In Foundry pf2e v8 (the pinned tag `pf2e-8.0.3`), class JSONs live under
`packs/pf2e/classes/`. Earlier major versions (v7) used `packs/classes/` directly. The
seed script reads from the v8 path; if you bump the pinned tag back to a v7 release,
update `FOUNDRY_CLASSES_DIR` in `server/prisma/seed-class-progression.ts` accordingly.
## Failure modes ## Failure modes
- **"Foundry pf2e clone not found at server/prisma/data/foundry-pf2e/packs/classes/"** — - **"Foundry pf2e clone not found at server/prisma/data/foundry-pf2e/packs/pf2e/classes/"** —
run the `git clone` step above. run the `git clone` step above.
- **"Class JSON does not match expected schema"** — Foundry pf2e changed the JSON shape - **"Class JSON does not match expected schema"** — Foundry pf2e changed the JSON shape
between major versions. Update the seed parser or pin to an older tag. between major versions. Update the seed parser or pin to an older tag.

View File

@@ -28,7 +28,17 @@ import { CLASS_FEATURE_OPTIONS } from './data/class-feature-options';
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL }); const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
const prisma = new PrismaClient({ adapter }); const prisma = new PrismaClient({ adapter });
const FOUNDRY_CLASSES_DIR = path.join(__dirname, 'data', 'foundry-pf2e', 'packs', 'classes'); // Foundry pf2e v8 nests packs under a system subdirectory: `packs/pf2e/classes/`.
// (RESEARCH §Pitfall 5: Foundry pf2e data shape may shift across major versions.
// In v7 this was `packs/classes/`. SEED-README pins us to pf2e-8.0.3.)
const FOUNDRY_CLASSES_DIR = path.join(
__dirname,
'data',
'foundry-pf2e',
'packs',
'pf2e',
'classes',
);
// The 16 D-16 classes. Filename in Foundry = lowercase classname. // The 16 D-16 classes. Filename in Foundry = lowercase classname.
const D16_CLASS_NAMES = [ const D16_CLASS_NAMES = [