Commit Graph

38 Commits

Author SHA1 Message Date
unknown
c2dd63d7ef fix: use module-level lock for save/save_cas across all store instances (P2-10)
The per-instance _cas_lock only serialized save_cas on the same
LearningStore instance. save() was unprotected and request handlers
create fresh instances. Moving to a module-level _cas_lock ensures
compare-and-semantics hold across concurrent requests.
2026-05-20 10:26:52 +08:00
unknown
c4c411abb0 fix: make save_cas atomic with a threading lock (P2-8)
The previous check-then-write was not atomic — two concurrent callers
with the same expected_version could both pass the version check and
write, with the last writer silently dropping the first update.
2026-05-20 10:16:17 +08:00
unknown
48d8fd7382 fix: clear stale review_queue on module replacement (P2-5)
replace_modules now filters review_queue to remove tasks whose
knowledge points no longer exist, preventing users from receiving
review tasks for deleted content.
2026-05-20 10:08:24 +08:00
unknown
d9f7128501 test: add replace/merge and CAS save tests (Block5)
- 3 merge_modules tests (add, update, alias)
- 7 replace_modules tests (remove old, clean stale KP state)
- 4 CAS save tests (match, mismatch, increment, nonexistent)
2026-05-20 00:22:09 +08:00
unknown
261865c2a5 fix: split init_modules into replace/merge (P2-2)
- Add replace_modules() that cleans stale KP state (mastery, repetition, errors, feynman)
- Rename init_modules to merge_modules, keep alias for backward compat
- Add /replace-modules API endpoint for full module replacement
2026-05-20 00:21:15 +08:00
unknown
783776ad26 fix: connect() closure deps (P1-6) + change_module race guard (P1-7)
- Add modules.length, moduleSelected, currentModuleId to connect() useCallback deps
- Add version field to LearningProgress and CAS save to LearningStore
- Cancel active turn before change_module (await task completion)
- Clear pending auto-advance timer on module_changed event
2026-05-20 00:18:50 +08:00
whf
a27b2749f0 fix: preserve question metadata in save_question_answers merge; clear feynman_retries on redo 2026-05-19 22:25:34 +08:00
whf
1e9f2a56d5 fix: load_question_answers backward compat with dict values from save_question_meta 2026-05-19 22:18:54 +08:00
unknown
1f7c3feae0 fix: use JSON-structured records in notebook prompt, prevent injection (Block2) 2026-05-19 22:07:07 +08:00
unknown
10a1936367 fix: add FEYNMAN_CHECK retry limit, skip after 3 failures (Block1) 2026-05-19 22:04:48 +08:00
unknown
9933509ca5 test: add 6 /answer endpoint regression tests (Block3) 2026-05-19 22:01:02 +08:00
unknown
e70a24d574 fix: server-side KP/module mapping, remove client-trusted fields (Block5) 2026-05-19 21:58:09 +08:00
unknown
2a49676a68 fix: unify grade_answer, remove substring false positive (Block4) 2026-05-19 21:52:16 +08:00
whf
95f4498942 Block 22: display module name on /learning cards instead of raw book_id
Backend: list_progress() derives display name from first module name,
falling back to book_id for empty-module books.
Frontend: ProgressSummary gains 'name' field, card heading uses
card.name || card.book_id instead of raw book_id.
Tests: 2 new negative tests (name from module, empty-module fallback).

92/92 passing.
2026-05-18 20:40:47 +08:00
whf
97496d6511 Block 9: backend endpoint tests (21 new + 3 list_all), fix stale local HTTPException imports 2026-05-17 02:42:09 +08:00
whf
fb7787b089 Block 5+6: DELETE/redo endpoints, change_module WS, LLM progress hints 2026-05-16 23:33:56 +08:00
whf
3fd2d8e809 Block 2: backend list_all + list_progress + GET /progress endpoint 2026-05-16 21:53:22 +08:00
unknown
80ccbe9dfb Block 7.5: Practice quiz phase, auto-advance fix, cancel streaming safety
- Add PRACTICE_QUIZ stage between Feynman Check and Error Diagnosis
- Generate 5-10 practice questions per module, record attempts but don't gate mastery
- Fix auto-advance race: move stagesRef updates outside React setState callbacks
- Fix stale handleStreamEvent closure via ref pattern
- Fix PLAN stage permanent deadlock when modules not initialized
- Clear error state unconditionally on new stage_start
- Add cancelStreamingTurn to sidebar and chat page for proper cleanup
- Fix cancelStreamingTurn to handle missing turnId gracefully
- Keep empty page_ids refs for whole-book resolution in guided learning
2026-05-16 11:33:45 +08:00
whf
6f3070f8d3 Block 21: Auto-mastery calculation, mock module cleanup, quiz_attempts tracking, global review passed 2026-05-15 00:58:34 +08:00
whf
5451aa60b4 Block 19: Interactive diagnostic phases — wait_for_input, server-side grading, answer stripping, correct_count, CLI timeout 2026-05-14 23:15:47 +08:00
whf
526bc1c550 Block 17: Server-side question answer persistence, eliminate client-supplied expected_answer 2026-05-14 21:05:52 +08:00
whf
e82b5374cf Block 15: Phase 3 — enum values English + _missing_() backward compat, __init__.py docstring, i18n keys, 66/66 tests 2026-05-14 11:01:49 +08:00
whf
43973c7bc0 Block A: Fix _call_llm fail-open → fail-closed, raise on error, stage retries on failure 2026-05-14 00:39:04 +08:00
whf
a8e154fc18 Block 5+6: 12 integration tests for LLM+RAG, 64/64 full regression, moved complete import to module level 2026-05-13 21:24:37 +08:00
whf
e65893feca Block 3: Structured prompt templates in deeptutor/learning/prompts.py, 11 stages with format() placeholders 2026-05-13 20:59:13 +08:00
unknown
fb2f8d7d77 fix(L1): improve init_modules merge — update existing modules instead of skipping (codex P2) 2026-05-12 18:12:21 +08:00
unknown
f213b1c228 fix(L1): incremental merge in init_modules to preserve existing modules and progress 2026-05-12 17:59:31 +08:00
unknown
acadcf6c47 fix(H8): remove unused 'key' variable in record_quiz_attempt 2026-05-12 17:30:43 +08:00
unknown
19bc959b9a fix(H1): persist new LearningProgress immediately in get_or_create to prevent race condition 2026-05-12 17:25:30 +08:00
unknown
fc4d4f7ca2 fix(H4): add complete_review_task to clean finished tasks from queue 2026-05-12 14:56:59 +08:00
unknown
7af85c5781 fix(H2): deduplicate error records, use RetryAttempt, graduate on correct answer 2026-05-12 14:52:43 +08:00
unknown
08e1829fde fix(C4): remove router singleton race condition + use unique tmp filenames in atomic write 2026-05-12 14:45:59 +08:00
whf
44a77b4afd Fix #3+#5: add init-modules endpoint + DEBUG_MODE (LEARNING_DEBUG=1 for second-level intervals) 2026-05-07 21:54:04 +08:00
whf
de8fbdfed8 Block 5: Add LearningService — business logic layer for progress, modules, quiz recording, mastery tracking 2026-05-06 02:29:14 +08:00
whf
0c33efb878 Block 4: Add pytest unit tests for models (21), storage (13), scheduler (18) — 52/52 pass 2026-05-06 02:19:33 +08:00
whf
b252bf7e5a Block 3: Add spaced repetition scheduler (Framework v1.8.2 §9.1 interval sequence algorithm) 2026-05-06 02:10:13 +08:00
whf
50a6e14793 Block 2: Add JSON storage layer for LearningProgress with path traversal protection 2026-05-06 01:54:13 +08:00
whf
a177d2b22b Block 1: Add learning data models (4 enums + 9 Pydantic models per Framework v1.8.2) 2026-05-06 01:40:28 +08:00