fix: 10 пунктов ревью — /run (кортеж store.add), валидация limit/offset в панели, close() соединений SQLite, троттлинг под локом, read-only бот без OMNI_BOT_OWNERS, eviction JOBS, push_new отдаёт свежие записи, ai.py не спит после последней попытки, дедуп реестра, подключён abuse-реестр (+191 источник); tests/test_regress.py 16 проверок + CI py3.10-3.12
Some checks failed
ci / test (3.10) (push) Has been cancelled
ci / test (3.11) (push) Has been cancelled
ci / test (3.12) (push) Has been cancelled

This commit is contained in:
ENI
2026-10-26 20:15:50 +03:00
parent 136aa88dd6
commit c9c0a11ef7
16 changed files with 806 additions and 54 deletions

34
tools/_verify2.py Normal file
View File

@@ -0,0 +1,34 @@
"""Точные замеры: живые sqlite-соединения, логика владельца бота, реальность rank.py."""
import gc
import os
import re
import sqlite3
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT))
os.environ.setdefault("PYTHONIOENCODING", "utf-8")
def count_conns():
gc.collect()
return sum(1 for o in gc.get_objects() if isinstance(o, sqlite3.Connection))
from omni import store # noqa: E402
base = count_conns()
for _ in range(50):
store.top(limit=1)
print("sqlite conn живых: до", base, "после 50 вызовов", count_conns())
src = (ROOT / "omni" / "bot.py").read_text(encoding="utf-8")
m = re.search(r"if not OWNERS:.*?(?=\n\s*fn = |\n\s*cmd = )", src, re.S)
print("owner-блок:\n", (m.group(0).strip()[:400] if m else "не найден"))
print("OMNI_BOT_OWNERS в коде:", "OMNI_BOT_OWNERS" in src)
cli = (ROOT / "omni" / "cli.py").read_text(encoding="utf-8")
print("rank в cli.py:", [ln.strip()[:80] for ln in cli.splitlines() if "rank" in ln][:4])
rank = (ROOT / "omni" / "rank.py").read_text(encoding="utf-8")
print("rank.py функций:", re.findall(r"def (\w+)", rank))