Files
mtusi2026lab2/openspec/changes/close-lab3-second-review-gaps/tasks.md
T
ArtyomandClaude Opus 5.5 d99a48a5db Put readiness behind a port and log the drain window through Logger
The /health/ready route imported the PostgreSQL adapter and kept the
drain flag in the HTTP layer, which gunicorn_conf imported to raise it.
Readiness is now a port of the shared application layer; its adapter in
shared/infrastructure checks the per-process drain flag and pings
PostgreSQL, and PlatformProvider assembles it. The route only knows the
port, and gunicorn_conf raises the flag through the infrastructure
module. Another critical dependency now changes the adapter and the
provider, not the HTTP layer.

The drain window was logged by a uvicorn logger with a printf string;
it is now the service.draining event of a StructlogLogger with the same
fields as the application, and failover-evidence looks for it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
2026-10-30 05:40:16 +03:00

28 lines
2.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 1. Платформа: остановка, готовность, журнал
- [x] 1.1 `RequestPipeline`: отмена задачи → `request.cancelled`, `503 unavailable` в общем формате, если ответ не начат, затем отмена пробрасывается
- [x] 1.2 `test_drain.py`: прерванный при остановке запрос — `503`, `application/json`, `error.code = unavailable`, `request_id` = `X-Request-Id`, непустой `X-Instance-Id`
- [x] 1.3 Порт `Readiness`, адаптер `DatabaseReadiness` с флагом `DRAINING` в `shared/infrastructure/readiness.py`, сборка в `PlatformProvider`, маршрут `/health/ready` через порт; тест состава модулей ядра
- [x] 1.4 `gunicorn_conf.py`: флаг из инфраструктуры, событие `service.draining` через `StructlogLogger`; `failover-evidence.sh` ищет его в логе
- [x] 1.5 `openspec/config.yaml`: карта модулей (`readiness` за портом)
- [x] 1.6 Проверка группы: `make lint`, `make student-test`, `make check`
## 2. Стенд и CI
- [ ] 2.1 `make up` ждёт все реплики в LB (`scripts/lb-wait.sh`)
- [ ] 2.2 CI: non-root по числовому uid `docker top -eo pid,uid,comm`; шаг `make retry-check`
- [ ] 2.3 Проверка группы: `make up` и сразу `make test-failover ACTION_SCRIPT=scripts/stop-one.sh`; проверка non-root на стенде и на контейнере от root
## 3. Обвязка доказательств
- [ ] 3.1 `probe.py retry` и `make retry-check`: потерянный ответ на живой и на убитой реплике → `evidence/retry.json`
- [ ] 3.2 `scripts/stand-usage.sh` в действиях `failover-each` и `rolling-update`; тег и ID образа в `rolling-update.sh`
- [ ] 3.3 `scaling.py`: `started` и метки `compose-up-failed.log` в UTC; `evidence/track1/README.md` — время прежних строк (MSK)
- [ ] 3.4 Проверка группы: `make lint`, `make check`, `sh -n` скриптов, `make retry-check` на стенде
## 4. Доказательства и отчёт
- [ ] 4.1 Уровни «3» и «4» заново на итоговом коде: `checks.txt` (с `git diff --stat upstream/main` контракта и тестов), `student-tests.txt`, стенд, `make retry-check`, `make level4`, чистый clone
- [ ] 4.2 `REPORT.md` и `evidence/README.md` по новым доказательствам; числа отчёта сверены скриптом с `evidence/`
- [ ] 4.3 Проверка группы: `make check`, `make lint`, `make student-test`, `openspec validate --all --strict`