fix(отказ): называем сам предел, а не «задано 4 из 1»

Предел могли снизить после того, как человек уже спрашивал, и пара чисел читалась как
ошибка счёта (увидел на дев-версии).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RuEU1u9Rz24zmoy9TuvWc2
This commit is contained in:
anor
2026-09-10 21:31:18 +10:00
co-authored by Claude Opus 5
parent 8f56c39038
commit 2a98bb7fa2
2 changed files with 18 additions and 2 deletions
+13
View File
@@ -155,3 +155,16 @@ def test_the_journal_says_which_dialogue_it_was(env):
client.post("/api/chat", json={"message": "привет", "tab_id": "t7"}, headers=h)
rows = [r for r in db.get_audit_log(50) if r["action"] == "chat_limit_hit"]
assert rows and "tab=t7" in (rows[0]["detail"] or ""), rows[0]["detail"]
def test_wording_does_not_look_like_a_miscount(env):
"""Предел снизили после того, как человек уже спросил — «задано 4 из 1» читается как
ошибка счёта (увидел на дев-версии 10.09.2026). Называем сам предел, а не пару чисел.
Порча: вернуть «задано X из Y» → упадёт."""
db, client, h = env
db.set_user_daily_limit("joe@x", 1)
for _ in range(4):
db.log_action("joe@x", "chat", "POST", "/api/chat", "", None, 200)
text = _ask(client, h).json()["detail"]
assert "из 1" not in text, text
assert "не больше 1" in text, text