feat: finish postgres-storage change

- keep engine and session factory in src/infra/db/session.py
- sync delta specs into openspec/specs, add db-migrations spec
- update rules, AGENTS.md and run skill for lab 2 storage
- fill REPORT.md for the storage part

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 16:20:49 +03:00
co-authored by Claude Opus 5.5
parent 90394ecdfb
commit 2d0a7c83e9
26 changed files with 947 additions and 357 deletions
+17 -3
View File
@@ -6,7 +6,8 @@
python3 .claude/skills/run-mtusi-messenger/driver.py [--port N] <cmd>
Команды:
start поднять `python -m src` в фоне (console, reload) и дождаться
start `make upgrade` (Postgres из compose и миграции), затем поднять
`python -m src` в фоне (console, reload) и дождаться
/health/ready; лог и pid — /tmp/mtusi-api-<port>.{log,pid}
status кто слушает порт и что отвечает /health/ready
flow сквозной сценарий по HTTP с проверками; код выхода 1 при провале
@@ -18,8 +19,9 @@
all start → flow → smoke → student (если есть student-tests/) → stop
Порт по умолчанию 18080, а не 8080: на 8080 обычно висит `make run_dev`
пользователя, и его состояние в памяти трогать не надо. flow, req, smoke
и student работают с любым сервером на порту, в том числе с контейнером
пользователя, и его процесс трогать не надо. Экземпляр драйвера пишет в
ту же рабочую базу Postgres, что и `make run_dev`. flow, req, smoke и
student работают с любым сервером на порту, в том числе с контейнером
(`make run_docker APP_OUT_PORT=<port>`).
"""
@@ -117,6 +119,18 @@ def cmd_start(port: int) -> int:
return 0
print(f"port {port} is busy:", listener_pids(port))
return 1
# без Postgres сервис стартует, но /health/ready отвечает 503
upgrade = subprocess.run(
["make", "upgrade"],
cwd=ROOT,
capture_output=True,
text=True,
check=False,
)
if upgrade.returncode != 0:
print("make upgrade failed:")
print((upgrade.stdout + upgrade.stderr)[-2000:])
return 1
env = os.environ | {"APP__RUN_MODE": "console", "APP__PORT": str(port)}
with log_path.open("wb") as log:
proc = subprocess.Popen(