Skip to content

Scheduling issues #814

@NiloCK

Description

@NiloCK

Card Scheduling System Issues

Title: Fix: Card scheduling system has multiple critical issues causing repetitive cards and buried reviews

Labels: bug, high-priority, scheduling, spaced-repetition

Body:

Card Scheduling System Issues

Problem Summary

The spaced repetition system exhibits "wonky" behavior where cards are repeatedly shown during sessions while others are effectively buried. Analysis of production logs reveals multiple interconnected issues.

Root Causes Identified

🔴 Critical Issues

  1. seenCardIds mechanism broken - Each queue (new/review/failed) has separate seenCardIds arrays, allowing same cards to appear multiple times as they move between queues
  2. Race conditions in card scheduling - Async operations in scheduleReview() not properly synchronized, causing cards to be scheduled before old reviews are removed
  3. K-value implementation missing - Calculated k-values are ignored in ELO updates, preventing proper difficulty adaptation

🟡 High Priority Issues

  1. Timestamp format bug - Uses kk (1-24) instead of HH (00-23) for UTC timestamps, causing parsing inconsistencies
  2. Router error preventing session cleanup - this.router is undefined prevents proper session termination, corrupting state
  3. Fire-and-forget database operations - DB operations use void without error handling, causing silent failures

🟠 Medium Priority

  1. ELO-scheduling disconnection - ELO scores don't influence spaced repetition intervals

Affected Components

  • packages/common-ui/src/components/StudySession.vue
  • packages/db/src/study/SessionController.ts
  • packages/db/src/impl/common/userDBHelpers.ts
  • packages/platform-ui/src/views/Study.vue
  • packages/common/src/elo.ts

Proposed Solution Priority

Phase 1: Critical Fixes

  • Centralize seenCardIds mechanism across all queues
  • Synchronize async operations in scheduleReview()
  • Fix router error with proper Vue 3 routing

Phase 2: High Priority

  • Correct timestamp format (requires migration)
  • Add proper error handling to DB operations
  • Implement k-value interpretation

Phase 3: Optimization

  • Integrate ELO scores with spaced repetition intervals

Testing Requirements

  • Unit tests for individual components
  • Integration tests for async operation sequences
  • E2E tests for complete study session flows
  • Performance tests for database operations

Migration Notes

  • Timestamp fix requires careful migration of existing scheduled cards
  • K-value implementation applies to future interactions only
  • Router fix requires updating Vue component patterns

This issue affects core learning functionality and should be prioritized for the next release.

Technical Details

Detailed analysis available in agent/a.2.complete-analysis.md with specific code locations, examples, and recommended fixes for each issue.

Evidence

Production logs show pattern of repeated card IDs within sessions and timestamp-related scheduling inconsistencies. Router errors occur consistently at session termination.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions