🌊 Волна 9: серверный perfect_streak + rate limiter doc (2 бага)

- client_controlled_achievement_values: current_streak в user_progress,
  сервер считает streak в check_word, complete_level читает из БД
  (game.py + database.py)
- inmemory_rate_limiter: docstring + TODO на Redis (main.py)
  Сейчас воркер один — проблема неактуальна.

Аудит: Issue #4, backend 2/20 задач
This commit is contained in:
2026-09-23 15:45:56 +00:00
parent 6a870e691b
commit 037b340cee
3 changed files with 80 additions and 12 deletions
+14
View File
@@ -149,6 +149,20 @@ async def init_db():
""")
logger.info("Added level column to user_progress")
# 🔧 ФИКС (23.09.2026): client_controlled_achievement_values —
# серверный perfect_streak. Раньше считался на клиенте и приходил
# в body — можно было подделать.
col_exists = await conn.fetchval("""
SELECT 1 FROM information_schema.columns
WHERE table_name = 'user_progress' AND column_name = 'current_streak'
""")
if not col_exists:
await conn.execute("""
ALTER TABLE user_progress
ADD COLUMN current_streak INT DEFAULT 0
""")
logger.info("Added current_streak column to user_progress")
# ============ sentences ============
await conn.execute("""
CREATE TABLE IF NOT EXISTS sentences (