docs(03-01): complete data layer foundation plan

- SUMMARY.md with execution results
- STATE.md updated with position and decisions
- ROADMAP.md updated with plan progress

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 13:43:44 +02:00
co-authored by Claude Opus 4.6
parent 3640fd5463
commit 0bda51df7a
4 changed files with 139 additions and 11 deletions
+4 -4
View File
@@ -37,7 +37,7 @@ Requirements for initial release (MVP). Each maps to roadmap phases.
- [x] **TYPE-03**: Falscher Tastendruck: Nichts passiert, richtige Taste blinkt sanft auf Tastatur - [x] **TYPE-03**: Falscher Tastendruck: Nichts passiert, richtige Taste blinkt sanft auf Tastatur
- [x] **TYPE-04**: Adaptives Tempo: Start 3s, nach 2× richtig -200ms (min 1.5s), nach Fehler +500ms (max 4s) - [x] **TYPE-04**: Adaptives Tempo: Start 3s, nach 2× richtig -200ms (min 1.5s), nach Fehler +500ms (max 4s)
- [ ] **TYPE-05**: Phase "Entdecken": Begleitfigur stellt neuen Buchstaben vor, Taste leuchtet auf - [ ] **TYPE-05**: Phase "Entdecken": Begleitfigur stellt neuen Buchstaben vor, Taste leuchtet auf
- [ ] **TYPE-06**: Phase "Wörter bauen": 34 Wörter aus gelernten Buchstaben, Buchstabe für Buchstabe tippen - [x] **TYPE-06**: Phase "Wörter bauen": 34 Wörter aus gelernten Buchstaben, Buchstabe für Buchstabe tippen
- [ ] **TYPE-07**: Alle 3 Phasen fliessend verbunden: Entdecken → Üben → Wörter → Belohnung - [ ] **TYPE-07**: Alle 3 Phasen fliessend verbunden: Entdecken → Üben → Wörter → Belohnung
### Levels ### Levels
@@ -45,7 +45,7 @@ Requirements for initial release (MVP). Each maps to roadmap phases.
- [x] **LEVL-01**: Stufen 16 definiert gemäss Progressionstabelle (F/J bis E/I) - [x] **LEVL-01**: Stufen 16 definiert gemäss Progressionstabelle (F/J bis E/I)
- [x] **LEVL-02**: Stufe gilt als abgeschlossen nach einmaligem Durchspielen (nicht perfekt) - [x] **LEVL-02**: Stufe gilt als abgeschlossen nach einmaligem Durchspielen (nicht perfekt)
- [x] **LEVL-03**: Nächste Stufe sofort freigeschaltet, alle gespielten Stufen wiederholbar - [x] **LEVL-03**: Nächste Stufe sofort freigeschaltet, alle gespielten Stufen wiederholbar
- [ ] **LEVL-04**: Wortlisten pro Stufe (nur mit bereits gelernten Buchstaben, max 5 Buchstaben) - [x] **LEVL-04**: Wortlisten pro Stufe (nur mit bereits gelernten Buchstaben, max 5 Buchstaben)
- [ ] **LEVL-05**: Review-Mechanik: Jede 3. Einheit mischt Buchstaben der letzten 23 Stufen - [ ] **LEVL-05**: Review-Mechanik: Jede 3. Einheit mischt Buchstaben der letzten 23 Stufen
- [ ] **LEVL-06**: Wiederholungs-Schutz: Nach 2× gleicher Stufe Ermutigung + Neugier-Trigger - [ ] **LEVL-06**: Wiederholungs-Schutz: Nach 2× gleicher Stufe Ermutigung + Neugier-Trigger
@@ -188,9 +188,9 @@ Which phases cover which requirements. Updated during roadmap creation.
| COMP-03 | Phase 2 | Complete | | COMP-03 | Phase 2 | Complete |
| COMP-04 | Phase 2 | Complete | | COMP-04 | Phase 2 | Complete |
| TYPE-05 | Phase 3 | Pending | | TYPE-05 | Phase 3 | Pending |
| TYPE-06 | Phase 3 | Pending | | TYPE-06 | Phase 3 | Complete |
| TYPE-07 | Phase 3 | Pending | | TYPE-07 | Phase 3 | Pending |
| LEVL-04 | Phase 3 | Pending | | LEVL-04 | Phase 3 | Complete |
| LEVL-05 | Phase 3 | Pending | | LEVL-05 | Phase 3 | Pending |
| LEVL-06 | Phase 3 | Pending | | LEVL-06 | Phase 3 | Pending |
| FRST-01 | Phase 3 | Complete | | FRST-01 | Phase 3 | Complete |
+1 -1
View File
@@ -71,7 +71,7 @@ Plans:
**Plans:** 5 plans **Plans:** 5 plans
Plans: Plans:
- [ ] 03-01-PLAN.md — Word lists per level, Progress type extension, rate limit update - [x] 03-01-PLAN.md — Word lists per level, Progress type extension, rate limit update
- [ ] 03-02-PLAN.md — Lesson 3-phase state machine (discover/practice/words), review + repetition logic - [ ] 03-02-PLAN.md — Lesson 3-phase state machine (discover/practice/words), review + repetition logic
- [x] 03-03-PLAN.md — Forest visual scene (SVG background, 4x3 grid, element rendering from IndexedDB) - [x] 03-03-PLAN.md — Forest visual scene (SVG background, 4x3 grid, element rendering from IndexedDB)
- [ ] 03-04-PLAN.md — Reward screen with pre-generation, full flow wiring (lesson -> reward -> forest) - [ ] 03-04-PLAN.md — Reward screen with pre-generation, full flow wiring (lesson -> reward -> forest)
+9 -6
View File
@@ -3,14 +3,14 @@ gsd_state_version: 1.0
milestone: v1.0 milestone: v1.0
milestone_name: milestone milestone_name: milestone
status: executing status: executing
stopped_at: Completed 03-03-PLAN.md stopped_at: Completed 03-01-PLAN.md
last_updated: "2026-03-29T11:42:33.082Z" last_updated: "2026-03-29T11:43:32.896Z"
last_activity: 2026-03-29 last_activity: 2026-03-29
progress: progress:
total_phases: 4 total_phases: 4
completed_phases: 2 completed_phases: 2
total_plans: 15 total_plans: 15
completed_plans: 11 completed_plans: 12
percent: 0 percent: 0
--- ---
@@ -26,7 +26,7 @@ See: .planning/PROJECT.md (updated 2026-03-29)
## Current Position ## Current Position
Phase: 03 (komplettes-spielerlebnis) — EXECUTING Phase: 03 (komplettes-spielerlebnis) — EXECUTING
Plan: 2 of 5 Plan: 3 of 5
Status: Ready to execute Status: Ready to execute
Last activity: 2026-03-29 Last activity: 2026-03-29
@@ -63,6 +63,7 @@ Progress: [░░░░░░░░░░] 0%
| Phase 02 P03 | 6min | 2 tasks | 12 files | | Phase 02 P03 | 6min | 2 tasks | 12 files |
| Phase 02 P05 | 3min | 3 tasks | 7 files | | Phase 02 P05 | 3min | 3 tasks | 7 files |
| Phase 03 P03 | 2min | 2 tasks | 3 files | | Phase 03 P03 | 2min | 2 tasks | 3 files |
| Phase 03 P01 | 3min | 2 tasks | 7 files |
## Accumulated Context ## Accumulated Context
@@ -90,6 +91,8 @@ Recent decisions affecting current work:
- [Phase 02]: Asset generation script skips existing files for idempotent re-runs - [Phase 02]: Asset generation script skips existing files for idempotent re-runs
- [Phase 02]: Vite static imports for avatar PNGs with onerror emoji fallback pattern - [Phase 02]: Vite static imports for avatar PNGs with onerror emoji fallback pattern
- [Phase 03]: Object URLs tracked in module-level array and revoked on re-render to prevent memory leaks - [Phase 03]: Object URLs tracked in module-level array and revoked on re-render to prevent memory leaks
- [Phase 03]: Levels 1-2 use letter combos (no real German words with F/J/D/K only)
- [Phase 03]: Rate limits raised to 10 text / 5 image per day for practical usage
### Pending Todos ### Pending Todos
@@ -101,6 +104,6 @@ None yet.
## Session Continuity ## Session Continuity
Last session: 2026-03-29T11:42:33.074Z Last session: 2026-03-29T11:43:32.889Z
Stopped at: Completed 03-03-PLAN.md Stopped at: Completed 03-01-PLAN.md
Resume file: None Resume file: None
@@ -0,0 +1,125 @@
---
phase: 03-komplettes-spielerlebnis
plan: 01
subsystem: game-data
tags: [word-lists, typing, progress-tracking, rate-limiting]
requires:
- phase: 01-technische-basis
provides: "Level definitions with allKeys, Progress interface, IndexedDB storage"
- phase: 02-gemini-integration
provides: "Gemini API with rate limiting"
provides:
- "Static word lists per level (1-6) with getWordsForLevel()"
- "Extended Progress interface with accuracy tracking fields"
- "LessonPhase type (discover | practice | words)"
- "Updated rate limits: 10 text / 5 image per day"
affects: [03-02-lesson-flow, 03-03-reward-system, 03-04-parent-area]
tech-stack:
added: []
patterns: ["TDD for game data validation", "letter-only validation against level allKeys"]
key-files:
created:
- src/game/words.ts
- src/game/words.test.ts
modified:
- src/types.ts
- src/api/gemini.ts
- src/ui/screens.ts
- src/api/gemini.test.ts
- src/storage/db.test.ts
key-decisions:
- "Levels 1-2 use letter combos (no real German words possible with F/J/D/K)"
- "Rate limits raised to 10 text / 5 image per day for real usage"
patterns-established:
- "Word list validation: every word checked against getKeysUpToLevel() at test time"
requirements-completed: [LEVL-04, TYPE-06]
duration: 3min
completed: 2026-03-29
---
# Phase 03 Plan 01: Data Layer Foundation Summary
**Word lists for levels 1-6 with TDD validation, extended Progress with accuracy stats, rate limits 10/5 per day**
## Performance
- **Duration:** 3 min
- **Started:** 2026-03-29T11:39:57Z
- **Completed:** 2026-03-29T11:42:37Z
- **Tasks:** 2
- **Files modified:** 7
## Accomplishments
- Word lists for levels 1-6 (8-10 words each), validated to only use learned letters per level
- getWordsForLevel() with without-replacement and with-replacement sampling
- Progress interface extended with totalCorrect, totalErrors, errorKeyCounts, lastPlayedLevels
- LessonPhase type exported for lesson flow phases
- Rate limits updated from 1/1 to 10 text / 5 image per day
## Task Commits
Each task was committed atomically:
1. **Task 1: Word lists per level with validation tests** - `420c0e1` (test: RED), `5a6ba70` (feat: GREEN)
2. **Task 2: Extend Progress type and update rate limits** - `d4207bf` (feat)
## Files Created/Modified
- `src/game/words.ts` - Static word lists per level, getWordsForLevel() function
- `src/game/words.test.ts` - 8 tests validating word lists against level keys
- `src/types.ts` - Extended Progress interface, new LessonPhase type
- `src/api/gemini.ts` - Rate limit constants TEXT_RATE_LIMIT=10, IMAGE_RATE_LIMIT=5
- `src/ui/screens.ts` - New Progress field defaults in welcome screen
- `src/api/gemini.test.ts` - Updated rate limit tests for new limits
- `src/storage/db.test.ts` - Updated Progress test fixture with new fields
## Decisions Made
- Levels 1-2 use letter combination patterns since no real German words can be formed with only F/J/D/K
- Rate limits raised to 10 text / 5 image per day (was 1 each) for practical usage
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug] Fixed invalid letters in word lists**
- **Found during:** Task 1 (TDD GREEN phase)
- **Issue:** Plan's suggested words contained letters not in level allKeys (e.g., "halb" has "b" not in level 5, "salad" has letters not in level 4)
- **Fix:** Replaced invalid words with valid alternatives using only level-appropriate letters
- **Files modified:** src/game/words.ts
- **Verification:** All 8 word validation tests pass
- **Committed in:** 5a6ba70 (Task 1 GREEN commit)
**2. [Rule 1 - Bug] Updated existing tests for new rate limits and Progress shape**
- **Found during:** Task 2 (verification step)
- **Issue:** Existing tests expected old rate limit of 1 and old Progress shape without new fields
- **Fix:** Updated gemini.test.ts to call incrementApiCall 10/5 times, added new fields to db.test.ts fixture
- **Files modified:** src/api/gemini.test.ts, src/storage/db.test.ts
- **Verification:** All 76 tests pass, tsc --noEmit clean
- **Committed in:** d4207bf (Task 2 commit)
---
**Total deviations:** 2 auto-fixed (2 bugs)
**Impact on plan:** Both fixes necessary for correctness. No scope creep.
## Issues Encountered
None beyond the auto-fixed deviations above.
## User Setup Required
None - no external service configuration required.
## Next Phase Readiness
- Word lists ready for lesson flow (03-02)
- Progress stats fields ready for parent area (03-04)
- LessonPhase type ready for lesson screen phases (03-02)
- Rate limits configured for reward system API calls (03-03)
---
*Phase: 03-komplettes-spielerlebnis*
*Completed: 2026-03-29*