Phase 8: Launch Packs

Status: Complete Spec ID prefix: PACKPhase: 8 Completed: 2026-02-20

Overview

Launch packs are the initial set of curated challenge packs that ship with the platform. Three packs cover JavaScript (Express), React (TSX), and Python (FastAPI) with 10 challenges each, totaling 30 challenges. Each pack is defined as JSON files in packs/ and seeded to Spring Boot via tools/seed.ts. A validation tool (tools/validate-packs.ts) ensures all reference solutions pass their assertions before deployment. Behavioral tests verify that reference solutions work at runtime (not just structurally).

Dependencies

  • [VRFY-01] through [VRFY-19] (verification engine for validating assertions)
  • [AUTH-04], [AUTH-05] (Spring Boot JPA entities for storing packs/challenges)
  • [DSST-01], [DSST-02], [DSST-03] (Pack, Challenge, Assertion types)

User Flows

Pack Validation (Author Time)

  1. Author writes pack JSON (packs/<pack-slug>/pack.json) and challenge JSONs (packs/<pack-slug>/challenges/*.json)
  2. Author runs pnpm validate to verify all reference solutions pass their assertions
  3. Structural validation checks assertion format and reference solution completeness
  4. Behavioral tests (pnpm validate:behavioral / pnpm validate:python) run reference solutions against runtime test suites

Pack Seeding (Deployment)

  1. Admin sets SPRING_BOOT_URL and ADMIN_SECRET
  2. Admin runs pnpm seed to upsert packs and challenges to Spring Boot
  3. With --sync flag, stale packs not in the local set are deleted

Acceptance Criteria

Pack Content

  • [ ] PACK-01 -- Three launch packs exist: express-basics (JavaScript), react-fundamentals (TSX), and fastapi-basics (Python), each with 10 challenges.
  • [ ] PACK-02 -- Each challenge has a reference solution that passes all its assertions when verified by the verification engine.
  • [ ] PACK-03 -- Challenges are ordered by difficulty within each pack (Beginner -> Intermediate -> Advanced).

Structural Validation

  • [ ] PACK-04 -- pnpm validate runs the verification engine against every challenge's reference solution and reports pass/fail per challenge.
  • [ ] PACK-05 -- Validation exits with a non-zero code if any challenge fails.

Behavioral Validation

  • [ ] PACK-06 -- pnpm validate:behavioral runs Express and React behavioral tests using supertest and @testing-library/react respectively.
  • [ ] PACK-07 -- pnpm validate:python runs FastAPI behavioral tests using pytest via uv.
  • [ ] PACK-08 -- All 65 behavioral tests pass (25 Express + 30 React + 10 FastAPI).

Seeding

  • [ ] PACK-09 -- pnpm seed upserts all packs and challenges to Spring Boot via POST /api/admin/seed, matching by slug. Existing packs are updated, new packs are created.
  • [ ] PACK-10 -- pnpm seed -- --sync deletes Spring Boot packs whose slugs are not in the local pack set via POST /api/admin/sync.

Technical Context

Key Files

FileRole
packs/express-basics/pack.jsonExpress.js pack metadata
packs/react-fundamentals/pack.jsonReact pack metadata
packs/fastapi-basics/pack.jsonFastAPI pack metadata
packs/express-basics/challenges/*.json10 Express challenge definitions
packs/react-fundamentals/challenges/*.json10 React challenge definitions
packs/fastapi-basics/challenges/*.json10 FastAPI challenge definitions
tools/validate-packs.tsStructural validation via verification engine
tools/seed.tsSpring Boot seeding via POST /api/admin/seed and POST /api/admin/sync
packs/vitest.config.mtsBehavioral test config (root resolves via __dirname)
packs/test-helpers.tswriteChallengeToTmp, importModule helpers
packs/python-test-helpers.tsuv-based Python test execution
packs/requirements.txtPython test dependencies (fastapi, httpx, pytest, pydantic)

Patterns and Decisions

  • JSON-based challenge definitions -- challenges are static JSON, not code. The reference solution is stored as files (FileEntry array) in the JSON.
  • Pack files map to referenceSolution -- the files field in pack JSON maps directly to referenceSolution in Spring Boot. No naming transformation.
  • tools/ use direct imports -- tools/ scripts import from relative paths, not workspace packages, since the repo root is not a workspace dep consumer.
  • fileURLToPath(import.meta.url) -- used for __dirname in tools/ scripts because import.meta.dirname is undefined in npx tsx.
  • uv for Python -- all Python operations use uv (not pip/python). Behavioral tests create a shared venv and run pytest via uv run.

Spring Boot Endpoints

EndpointPurpose
POST /api/admin/seedUpsert packs and their challenges
POST /api/admin/syncUpsert all packs, delete stale ones

Test Coverage

Behavioral Tests (Express)

CriterionTest FileTest Description
PACK-02, PACK-06packs/express-basics/__tests__/01-hello-world.test.tsGET /api/hello returns correct response
PACK-02, PACK-06packs/express-basics/__tests__/02-route-params.test.tsGET /api/users/:id returns user
PACK-02, PACK-06packs/express-basics/__tests__/03-post-json.test.tsPOST /api/items accepts JSON
PACK-02, PACK-06packs/express-basics/__tests__/04-query-filtering.test.tsGET /api/items filters by category
PACK-02, PACK-06packs/express-basics/__tests__/05-multiple-routes.test.tsGET + POST /api/items
PACK-02, PACK-06packs/express-basics/__tests__/06-custom-middleware.test.tsmiddleware calls next()
PACK-02, PACK-06packs/express-basics/__tests__/07-error-handling.test.tserror middleware returns 500
PACK-02, PACK-06packs/express-basics/__tests__/08-express-router.test.tsrouter-mounted endpoints
PACK-02, PACK-06packs/express-basics/__tests__/09-static-and-cors.test.tsCORS headers + health endpoint
PACK-02, PACK-06packs/express-basics/__tests__/10-full-rest-api.test.tsFull CRUD lifecycle

Behavioral Tests (React)

CriterionTest FileTest Description
PACK-02, PACK-06packs/react-fundamentals/__tests__/01-counter.test.tsxCounter increments on click
PACK-02, PACK-06packs/react-fundamentals/__tests__/02-props-display.test.tsxRenders name prop
PACK-02, PACK-06packs/react-fundamentals/__tests__/03-useeffect-loader.test.tsxFetches and renders data
PACK-02, PACK-06packs/react-fundamentals/__tests__/04-conditional-rendering.test.tsxRenders based on status
PACK-02, PACK-06packs/react-fundamentals/__tests__/05-event-handling.test.tsxToggle on/off
PACK-02, PACK-06packs/react-fundamentals/__tests__/06-list-with-keys.test.tsxRenders todo list
PACK-02, PACK-06packs/react-fundamentals/__tests__/07-custom-hook.test.tsxuseLocalStorage persistence
PACK-02, PACK-06packs/react-fundamentals/__tests__/08-controlled-form.test.tsxControlled inputs + submit
PACK-02, PACK-06packs/react-fundamentals/__tests__/09-component-composition.test.tsxCard with children
PACK-02, PACK-06packs/react-fundamentals/__tests__/10-usereducer-todo.test.tsxuseReducer add/toggle

Behavioral Tests (Python)

CriterionTest FileTest Description
PACK-02, PACK-07packs/fastapi-basics/__tests__/*.py10 FastAPI endpoint tests via pytest

Spring Boot Tests

CriterionTest LocationTest Description
PACK-09services/api/src/test/java/...AdminController integration test: seed creates a pack and challenges
PACK-09services/api/src/test/java/...AdminController integration test: seed upserts on duplicate slug
PACK-10services/api/src/test/java/...AdminController integration test: sync creates and cleans up stale

Open Questions

  • None at this time.