Quick reference for running and testing this repo in cloud/CI or local dev.
Do not:
- Use sudo.
- Run long-lived processes (dev servers, watch, etc).
- Run interactive commands (git rebase -i, git add -i, nano).
- Change git config.
- Push to remote unless explicitly requested.
Do:
- Use approved file tools (Read/LS/Grep/Glob) instead of cat/ls/find/grep.
- Use absolute paths.
- Keep edits minimal and follow existing style.
- Do all test/script IO only under /tmp.
- Python 3.11+ (3.12 recommended)
- MongoDB (local or Atlas)
- Telegram bot token (for the bot)
- Create env file:
cp .env.example .env
- Start:
python main.pyLOG_LEVEL=DEBUG python main.py(verbose)
Option A (simple local):
cd webapppython app.py
Option B (Render/production-friendly wrapper):
./scripts/start_webapp.sh
Option C (webapp + AI explain service together):
./scripts/run_all.sh
./scripts/start_with_worker.sh- Starts the optional Node push worker (if enabled) and then runs
python main.py.
- Starts the optional Node push worker (if enabled) and then runs
Bot:
BOT_TOKENMONGODB_URL
Webapp (minimum):
SECRET_KEYMONGODB_URLBOT_TOKENBOT_USERNAMEWEBAPP_URL
Admin (optional):
ADMIN_USER_IDS(comma-separated Telegram user IDs)
Quickstart:
- Set env for tests:
export DISABLE_ACTIVITY_REPORTER=1export DISABLE_DB=1export BOT_TOKEN=xexport MONGODB_URL='mongodb://localhost:27017/test'
- Install test deps:
pip install -U pytest pytest-asyncio pytest-cov
- Run:
pytest -q
Performance tests:
pytest -q -m performanceONLY_LIGHT_PERF=1 pytest -q -m performance
Safety rules for tests:
- Use
tmp_pathfor file IO. - Delete only under
/tmpand only with a safe wrapper.
- Use Conventional Commits: feat | fix | docs | test | refactor | chore | perf
- Prefer heredoc messages, for example:
git commit -m "$(cat <<'EOF'docs: short why-oriented message- ``
- Key change- ``
EOF)"
pip install pre-commitpre-commit run --all-files
README.md(bot setup + deployment)webapp/README.md(webapp setup)docs/testing.rst(testing guide)docs/performance-tests.rst(performance tests)
- Enable shadow mode first, then move to blocking.
- Key env vars:
RATE_LIMIT_ENABLED=trueRATE_LIMIT_SHADOW_MODE=trueRATE_LIMIT_STRATEGY=moving-window(orfixed-window)ADMIN_USER_IDS=123,456REDIS_URL=rediss://...(prod)