mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-20 23:31:31 +02:00
The comment rule in CLAUDE.md is one line maximum, never narration: no multi-line blocks, no module-header explainers, no sentences that explain or justify the code to the reader. The tree had drifted a long way from it, and most of the drift is mine. Removed: 232 lines of multi-line comment blocks 203 single-line comments that argued instead of stating 154 comments joined by so/because/otherwise/rather-than 143 narrating comments in the frontend 112 test docstrings (the test name already says what it asserts) 25 test module docstrings and 25 decorative section dividers Collapsed: 324 multi-line docstrings to one factual line 271 one-line docstrings that had a justifying clause bolted on Kept: functional directives, section dividers, short field labels, alembic revision headers, and the eight FastAPI route docstrings that render in /docs. Where a fact was load-bearing it is in CLAUDE.md, which is where it belongs. 284 python tests and 34 frontend tests pass, ruff and ruff-format clean across ten packages, svelte-check 0 errors, prettier and eslint clean, app.main imports. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013dKUV96WkQQETZBMoAG98C
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
import pytest
|
|
|
|
from app.config import settings
|
|
from app.core.database import check_capacity, pool_demand
|
|
|
|
pytestmark = pytest.mark.api
|
|
|
|
|
|
def test_demand_counts_every_pool():
|
|
per_child = settings.WORKER_DB_POOL_SIZE + settings.WORKER_DB_MAX_OVERFLOW
|
|
expected = (
|
|
settings.DB_POOL_SIZE
|
|
+ settings.DB_MAX_OVERFLOW
|
|
+ settings.CELERY_SCAN_CONCURRENCY * per_child
|
|
+ per_child
|
|
)
|
|
assert pool_demand() == expected
|
|
assert pool_demand() > settings.DB_POOL_SIZE, "a worker pool is a pool too"
|
|
|
|
|
|
async def test_the_configured_pools_fit_the_configured_server(caplog):
|
|
with caplog.at_level(logging.WARNING):
|
|
await check_capacity()
|
|
assert "outgrow" not in caplog.text
|
|
|
|
|
|
async def test_it_warns_rather_than_failing_when_they_do_not(monkeypatch, caplog):
|
|
monkeypatch.setattr(settings, "DB_MAX_OVERFLOW", 10_000)
|
|
with caplog.at_level(logging.WARNING):
|
|
await check_capacity()
|
|
assert "outgrow" in caplog.text, "a silent exhaustion is a production incident"
|