Files
soroban-abacus-flashcards/apps/web
Thomas Hallock 0f3ec369bf fix: consolidate worksheet validation constants and increase MAX_PAGES to 100
**Problem**: Worksheet seeds were not persisting because configs with >20 pages
failed Zod schema validation (max was 20), even though the code elsewhere allowed
up to 2000 total problems. When validation failed, the config fell back to defaults,
losing the saved seed.

**Changes**:

1. Created `constants/validation.ts` with centralized limits:
   - MAX_PAGES: 100 (was 20 in schemas)
   - MAX_TOTAL_PROBLEMS: 2000
   - MAX_PROBLEMS_PER_PAGE: 100
   - MAX_COLS: 10
   - DIGIT_RANGE: { MIN: 1, MAX: 5 }
   - FONT_SIZE: { MIN: 8, MAX: 32 }
   - Helper function validateWorksheetLimits()

2. Updated all Zod schema versions (V1-V4) in `config-schemas.ts` to use constants

3. Updated runtime validation in `validation.ts` to use constants

4. Enhanced settings API (`route.ts`) to:
   - Validate worksheet limits before saving
   - Validate against Zod schema
   - Return clear error messages with actionable guidance

5. Enhanced auto-save hook (`useWorksheetAutoSave.ts`) to:
   - Return saveError state
   - Surface validation errors to user
   - Clear errors on successful save

6. Removed TEN-FRAMES DEBUG logging from displayRules.ts

**Impact**: Worksheet configs with 21-100 pages will now pass validation and
persist correctly, including the seed. Users will see clear error messages if
their config exceeds limits.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-12 08:57:00 -06:00
..
2025-11-11 11:44:40 -06:00
2025-11-11 11:44:40 -06:00

Test deployment - Mon Nov 3 16:31:57 CST 2025