fix(practice): fix circular import causing REINFORCEMENT_CONFIG.creditMultipliers to be undefined

The issue was that progress-manager.ts was importing REINFORCEMENT_CONFIG
from @/db/schema/player-skill-mastery, which re-exported it from
@/lib/curriculum/config. This created a circular dependency that caused
the config object's creditMultipliers property to be undefined in production.

Root cause found via logging:
```
REINFORCEMENT_CONFIG.creditMultipliers=undefined, helpLevel=0
```

Fix:
- Import REINFORCEMENT_CONFIG directly from @/lib/curriculum/config/fluency-thresholds
- Remove unused re-export from player-skill-mastery.ts

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-12-13 10:08:07 -06:00
parent 58192017c7
commit 147974a9f0
2 changed files with 3 additions and 6 deletions

View File

@ -1,12 +1,9 @@
import { createId } from '@paralleldrive/cuid2'
import { index, integer, sqliteTable, text, uniqueIndex } from 'drizzle-orm/sqlite-core'
// Import tunable constants from centralized config
import { FLUENCY_RECENCY, FLUENCY_THRESHOLDS, REINFORCEMENT_CONFIG } from '@/lib/curriculum/config'
import { FLUENCY_RECENCY, FLUENCY_THRESHOLDS } from '@/lib/curriculum/config'
import { players } from './players'
// Re-export for backwards compatibility
export { REINFORCEMENT_CONFIG }
/**
* Fluency state - computed from practice history, NOT stored in database
* - practicing: isPracticing=true but hasn't achieved fluency criteria yet
@ -144,7 +141,6 @@ export const FLUENCY_CONFIG = {
...FLUENCY_RECENCY,
} as const
// REINFORCEMENT_CONFIG imported from @/lib/curriculum/config and re-exported above
/**
* Check if a student has achieved fluency in a skill based on their practice history.

View File

@ -11,8 +11,9 @@ import {
type FluencyState,
type NewPlayerSkillMastery,
type PlayerSkillMastery,
REINFORCEMENT_CONFIG,
} from '@/db/schema/player-skill-mastery'
// Import directly from source to avoid circular dependency issues with re-exports
import { REINFORCEMENT_CONFIG } from '@/lib/curriculum/config/fluency-thresholds'
import type { NewPracticeSession, PracticeSession } from '@/db/schema/practice-sessions'
import type { HelpLevel } from '@/db/schema/session-plans'