gendesign/tradein-mvp/backend/app/core
bot-backend 8142834555
All checks were successful
CI Trade-In / changes (pull_request) Successful in 8s
CI Trade-In / browser-tests (pull_request) Has been skipped
CI Trade-In / frontend-checks (pull_request) Has been skipped
CI / changes (pull_request) Successful in 11s
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI Trade-In / backend-tests (pull_request) Successful in 7m27s
fix(tgbot): stop CI-hanging busy-spin in rate-limit test, isolate shared client in tests
Root cause of the red PR #3494 CI job (9% progress, 75s life, no error line):
test_send_message_rate_limits_across_different_topics_same_chat mocked
asyncio.sleep as a pure no-op without advancing time.monotonic. The 3rd send
(over the test's limit=2) entered TelegramGroupRateLimiter.acquire(), which
recomputes wait_s from the real, unmocked clock every iteration - since the
fake sleep never advances it, the window never expires and the while-loop
busy-spins forever instead of actually waiting, until pytest-timeout kills it.
Fixed by advancing a fake monotonic clock inside fake_sleep, matching the
already-correct pattern used by the other tests in this file.

Also added _reset_telegram_shared_client (tests/conftest.py, same pattern as
_reset_estimate_rate_limiter): app.services.tgbot.shared._client is a
module-level singleton whose rate limiter otherwise accumulates real
wall-clock timestamps across the whole pytest session, not per test.

Documented honestly in config.py: the API-role budget is shared between
support web-chat mirrors and GlitchTip alerts with no priority between them,
so a large alert burst can make the web-chat wait out its own timeout and
return 502 - flagged as a known follow-up, not fixed here.

NOTE: a full `pytest -q --timeout=60` run still hangs further into the suite,
at tests/test_glitchtip_webhook.py::test_telegram_failure_returns_502_not_500.
Not root-caused within this session's budget - the test's _fake_telegram_client
fixture correctly monkeypatches glitchtip_module.get_telegram_client, but the
anyio worker thread running the ASGI request is seen parked in a real
event-loop poll/select wait, consistent with an actual (non-mocked) sleep
somewhere in that path. Needs a follow-up session with a fresh time budget.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JY6iWDnGDthdvsMWgK1BMG
2026-09-12 16:10:27 +03:00
..
__init__.py feat: add tradein-mvp subproject (Trade-In Estimator под /trade-in) 2026-05-21 00:25:39 +03:00
anon_session.py feat(mera/b2c): анти-абуз для анонимного трафика — этап 2 из 8 (#2546) 2026-08-25 16:27:02 +00:00
auth.py test(tradein): прод-конфигурация ролей в приёмке #3316 + компромисс фолбэка 2026-09-02 14:59:14 +05:00
auth_db.py fix(#3194): hide_parameters=True на всех движках, include_local_variables=False у scheduler 2026-08-30 14:53:41 +05:00
config.py fix(tgbot): stop CI-hanging busy-spin in rate-limit test, isolate shared client in tests 2026-09-12 16:10:27 +03:00
db.py Отмена по бюджету больше не оставляет сироту в сессии запроса (#3449) 2026-09-12 13:20:44 +05:00
fdw.py chore(tradein/geocoder): удалить Яндекс-геокодер (#2593) 2026-07-31 21:22:09 +03:00
http_errors.py fix(mera/public): Infinity/NaN во входе — 422, и бюджет считает такие запросы 2026-08-30 00:11:56 +05:00
log_scrub.py fix(tradein): маскировать секрет и в параметрах с префиксом (#3154) 2026-09-05 23:03:16 +05:00
password.py fix(tradein/auth): отказ по насыщению — до выборки из БД и с агрегированным следом (#2715) (#2734) 2026-08-06 14:27:26 +00:00
public_request.py fix(mera/b2c): семь дефектов публичного периметра, найденных состязательным ревью 2026-08-16 10:01:47 +03:00
ratelimit.py fix(support): доставленное сообщение не теряется при сбое БД, отказы Telegram расходуют бюджет 2026-09-12 10:53:45 +03:00
rbac.py fix(rbac): анониму на admin-префиксе отвечать 404, а не 401 2026-09-06 00:51:09 +05:00
request_audit.py fix(tradein/payments): тело нотификации не течёт в мониторинг и аудит, повторы банка не отбиваются лимитом 2026-08-07 16:17:59 +03:00
shutdown.py feat(tradein/scraper): cooperative SIGTERM-drain for graceful deploy (#1182 Phase 2) 2026-06-28 19:52:09 +03:00
version.py feat(tradein): версионирование продукта — единый источник, подвал, PDF, /versions (#2824) 2026-08-10 16:00:54 +00:00