Files
mtusi2026lab4/evidence/tests/failure-checks.md
T

1143 lines
81 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.
# `make failure_checks`: проверки отказов с уборщиком, согласованностью БД и S3, местами загрузки, сверкой и простоем S3
- Дата: 2026-10-23, 17:06:13–17:21:11 UTC.
- Commit: `ca0c4b2` (правки по verify change `track2-reconcile-cost`).
Рабочее дерево чистое, образ `mtusi-messenger:lab4` собран из него.
- Стенд отказов — как в снимке `723b6c3` ниже: проект
`mtusi-lab4-failures`, свои PostgreSQL, Valkey и S3 с bootstrap,
уборщик с grace 20 с, интервалом 1 с и без плановой сверки, четыре
API. Рабочий стенд `mtusi-lab4` в это время запущен на том же коде
(`make rolling_update APP_OUT_PORT=8090`: реплики `api-29`, `api-30`,
уборщик пересоздан, LB на `127.0.0.1:8090`), до и после прогона — те же
контейнеры.
- Проверки change `track2-reconcile-cost` — 5 исходных
(`test_reconcile_head_strategy_same_findings`,
`test_reconcile_deep_checksum`,
`test_reconcile_restore_needs_same_bytes`, `test_reconcile_rate_limit`,
`test_reconcile_limit_stops_rechecks`) и 2 по замечаниям verify
(`test_reconcile_row_with_other_id_key`,
`test_reconcile_fresh_overwrite_untouched`). Красные прогоны — разделы
«Красный прогон до кода `track2-reconcile-cost`» и «Красный прогон
тестов verify» в конце файла.
- Прежний снимок с `0072dbe` (до правок по verify): 54 из 54, pytest
712 с.
## Итог: код 0, 56 из 56
Код команды — 0, pytest — 877 с, вся команда — 898 с (54 из 54 за 712 с
на `0072dbe`: +2 проверки verify, ~1,5 мин, остальное — разброс шумного
хоста; 49 из 49 за 552 с в снимке `723b6c3`). Ниже
— вывод от запуска pytest до конца. Опущены сборка образа (из кэша),
старт хранилищ, миграции, bootstrap S3 и уборщик: они те же, что в
полном выводе снимка `723b6c3`. Путь к рабочему каталогу в строках
`platform` и `rootdir` заменён на `…`. В PostgreSQL стенда признаков
аварийного перезапуска нет. «too many clients» и «administrator command»
— следы проверок предела соединений и остановок PostgreSQL. Контейнеров,
volumes и сети проекта `mtusi-lab4-failures` после прогона нет.
```
$ make failure_checks
env ready: .env, config.toml
python3 student-tests/run_failures.py
[failure_checks] project=mtusi-lab4-failures (working stand: mtusi-lab4)
[failure_checks] build image
…
[failure_checks] start cleaner: grace 20 s, interval 1 s, reconcile interval 0 s (0 — off)
…
[failure_checks] start api containers
[failure_checks] ready: api=http://127.0.0.1:60328 tight=http://127.0.0.1:60332 uploads=http://127.0.0.1:60336 s3=http://127.0.0.1:60340
[failure_checks] pytest -m fault
============================= test session starts ==============================
platform darwin -- Python 3.12.12, pytest-9.1.1, pluggy-1.6.0 -- …/.venv/bin/python
cachedir: .pytest_cache
rootdir: …
configfile: pyproject.toml
testpaths: student-tests
plugins: anyio-4.15.1
collecting ... collected 254 items / 198 deselected / 56 selected
student-tests/test_failures.py::test_expired_token PASSED [ 1%]
student-tests/test_failures.py::test_use_does_not_extend_session PASSED [ 3%]
student-tests/test_failures.py::test_token_while_database_stopped PASSED [ 5%]
student-tests/test_failures.py::test_members_failure_rolls_back_chat PASSED [ 7%]
student-tests/test_failures.py::test_database_stopped_and_back PASSED [ 8%]
student-tests/test_failures.py::test_pool_exhausted PASSED [ 10%]
student-tests/test_failures.py::test_connection_limit_reached PASSED [ 12%]
student-tests/test_failures.py::test_pool_keeps_connections PASSED [ 14%]
student-tests/test_failures.py::test_readiness_without_database PASSED [ 16%]
student-tests/test_failures.py::test_readiness_without_cache PASSED [ 17%]
student-tests/test_failures.py::test_readiness_without_object_storage[stop] PASSED [ 19%]
student-tests/test_failures.py::test_readiness_without_object_storage[pause] PASSED [ 21%]
student-tests/test_failures.py::test_flush_cache PASSED [ 23%]
student-tests/test_failures.py::test_valkey_stopped PASSED [ 25%]
student-tests/test_failures.py::test_valkey_paused PASSED [ 26%]
student-tests/test_failures.py::test_valkey_back PASSED [ 28%]
student-tests/test_failures.py::test_message_failure_keeps_key_free PASSED [ 30%]
student-tests/test_failures.py::test_database_outage_keeps_key_free PASSED [ 32%]
student-tests/test_failures.py::test_key_free_after_ttl PASSED [ 33%]
student-tests/test_failures.py::test_upload_with_object_storage_stopped PASSED [ 35%]
student-tests/test_failures.py::test_rejected_uploads_leave_nothing PASSED [ 37%]
student-tests/test_failures.py::test_metadata_insert_failure PASSED [ 39%]
student-tests/test_failures.py::test_interrupted_body PASSED [ 41%]
student-tests/test_failures.py::test_ready_failure_compensated PASSED [ 42%]
student-tests/test_failures.py::test_killed_between_put_and_ready PASSED [ 44%]
student-tests/test_failures.py::test_ready_commit_outcome_unknown PASSED [ 46%]
student-tests/test_failures.py::test_upload_outlives_grace PASSED [ 48%]
student-tests/test_failures.py::test_cleaner_failure_after_object_delete PASSED [ 50%]
student-tests/test_failures.py::test_cleaner_survives_outages PASSED [ 51%]
student-tests/test_failures.py::test_object_storage_stopped PASSED [ 53%]
student-tests/test_failures.py::test_environment_does_not_change_limits PASSED [ 55%]
student-tests/test_failures.py::test_object_storage_paused PASSED [ 57%]
student-tests/test_failures.py::test_upload_slots_busy PASSED [ 58%]
student-tests/test_failures.py::test_rejections_before_queue PASSED [ 60%]
student-tests/test_failures.py::test_upload_waits_for_slot PASSED [ 62%]
student-tests/test_failures.py::test_slot_released_after_failures PASSED [ 64%]
student-tests/test_failures.py::test_slow_body PASSED [ 66%]
student-tests/test_failures.py::test_upload_after_idle_s3 PASSED [ 67%]
student-tests/test_failures.py::test_reconcile_finds_and_fixes PASSED [ 69%]
student-tests/test_failures.py::test_reconcile_keeps_fresh_used_and_unknown PASSED [ 71%]
student-tests/test_failures.py::test_reconcile_restored_original PASSED [ 73%]
student-tests/test_failures.py::test_reconcile_change_limit PASSED [ 75%]
student-tests/test_failures.py::test_reconcile_keeps_referenced_objects PASSED [ 76%]
student-tests/test_failures.py::test_reconcile_limit_keeps_cleanup PASSED [ 78%]
student-tests/test_failures.py::test_reconcile_foreign_key_untouched PASSED [ 80%]
student-tests/test_failures.py::test_reconcile_object_storage_stopped PASSED [ 82%]
student-tests/test_failures.py::test_reconcile_interrupted_by_database PASSED [ 83%]
student-tests/test_failures.py::test_reconcile_under_load PASSED [ 85%]
student-tests/test_failures.py::test_scheduled_reconcile PASSED [ 87%]
student-tests/test_failures.py::test_reconcile_head_strategy_same_findings PASSED [ 89%]
student-tests/test_failures.py::test_reconcile_deep_checksum PASSED [ 91%]
student-tests/test_failures.py::test_reconcile_restore_needs_same_bytes PASSED [ 92%]
student-tests/test_failures.py::test_reconcile_rate_limit PASSED [ 94%]
student-tests/test_failures.py::test_reconcile_limit_stops_rechecks PASSED [ 96%]
student-tests/test_failures.py::test_reconcile_row_with_other_id_key PASSED [ 98%]
student-tests/test_failures.py::test_reconcile_fresh_overwrite_untouched PASSED [100%]
==================================== PASSES ====================================
================ 56 passed, 198 deselected in 877.24s (0:14:37) ================
[failure_checks] postgres log: 466 lines, crash markers 0; "too many clients" 32, "administrator command" 148
[failure_checks] cleanup
…
Volume mtusi-lab4-failures_s3_data Removed
Volume mtusi-lab4-failures_postgres_data Removed
Network mtusi-lab4-failures_default Removed
[failure_checks] results: {'fault': 0, 'postgres': 0}
```
## Прежний снимок: `723b6c3`, 49 из 49 (вывод полный)
- Дата: 2026-10-22, 23:17:58–23:27:37 UTC.
- Commit: `723b6c3` (change `fix-upload-put-flake`: у клиента S3 нет срока
чтения aiohttp — с `b5983f0`, четвёртый API стенда отказов и
`test_upload_after_idle_s3` — с `4cfaab0`; от `b5983f0` код отличается
только комментарием в `src/infra/s3/client.py`). Рабочее дерево чистое,
образ собран из него.
- Стенд отказов: проект `mtusi-lab4-failures` — свои PostgreSQL, Valkey
и S3 (с bootstrap, пользователи `api` и `cleaner`, у уборщика список
только с префиксом `messenger/attachments/`), порты хранилищ не
публикуются; уборщик `cleaner` с grace 20 с, интервалом 1 с и **без
плановой сверки** (`RECONCILER__INTERVAL_SECONDS: "0"`,
`failures.compose.yml`, `restart: "no"`) — сверку запускают тесты через
hook; четыре API на `127.0.0.1`: обычный — с `MAX_UPLOAD_BYTES=1` и
`MAX_IMAGE_PIXELS=1` в окружении, «тесный» (сроки сессии и ключа 2 с,
пул 1), «узкий по загрузкам» (`UPLOADS_ENV`: 1 место, 1 в очереди,
ожидание 1 с, срок тела 3 с) и «с коротким сроком S3» (`S3_ENV`:
`S3__TIMEOUT_SECONDS=1`). Рабочий стенд `mtusi-lab4` в это время
запущен на образе `723b6c3` (реплики `api-25`, `api-26` и уборщик —
`make rolling_update APP_OUT_PORT=8090` и `docker compose up -d
--no-deps cleaner` в 23:15; LB — на `127.0.0.1:8090`: 8080 хоста занят
контейнером другого проекта).
Docker Desktop 29.9.1, Apple M3 Pro.
- Прежние снимки этого файла: commit `5b42bd2` — 29 из 29 за 190 с;
`87c48b9` — 32 из 32 за 224 с; `5889ca2` — 32 из 32 за 228 с;
`ce1ae2c` — 37 из 37 за 255 с; `9d2ee30` — 37 из 37 за 263 с;
`c1648d9` — 45 из 45 за 462 с (+8 проверок сверки: ожидания grace
стенда, 20 с, для объектов без строки и ~35 с нагрузки); `84f8c35` — 48
из 48 за 524 с (+3 проверки по замечаниям verify); `b5983f0` — 49 из 49
за 570 с (вывод был отфильтрован, без построчного списка тестов).
Сейчас — 49 из 49 за 552 с: +1 проверка `test_upload_after_idle_s3`
(раздел «Простой S3 после скачиваний») к `84f8c35`, ~17 с, остальное —
разброс хоста.
Вывод полный, без фильтра. Обезличено только одно: путь к рабочему
каталогу в строках `platform` и `rootdir` pytest заменён на `…`. Ещё
убран управляющий символ терминала перед `s3-bootstrap-1 exited`.
Секретов в выводе нет: bootstrap печатает только имена bucket и
пользователей.
```
$ date -u +%FT%TZ && make failure_checks; echo "exit=$?"; date -u +%FT%TZ
2026-10-22T23:17:58Z
env ready: .env, config.toml
python3 student-tests/run_failures.py
[failure_checks] project=mtusi-lab4-failures (working stand: mtusi-lab4)
[failure_checks] build image
Image mtusi-messenger:lab4 Building
#1 [internal] load local bake definitions
#1 reading from stdin 563B done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 2.87kB done
#2 DONE 0.0s
#3 [internal] load metadata for docker.io/library/python:3.12.14-slim-trixie@sha256:f77ac9e44ae96ef2c90b8053ea08c31f8be030f824196b0ae4db6d462c84e51f
#3 DONE 0.0s
#4 [internal] load metadata for ghcr.io/astral-sh/uv:0.12.17@sha256:10787c682e4184e4f290de1171fd4703dc63de99221f10fe1c99002ce7fa9acc
#4 DONE 0.0s
#5 [internal] load .dockerignore
#5 transferring context: 593B done
#5 DONE 0.0s
#6 [internal] load build context
#6 transferring context: 6.13kB done
#6 DONE 0.0s
#7 FROM ghcr.io/astral-sh/uv:0.12.17@sha256:10787c682e4184e4f290de1171fd4703dc63de99221f10fe1c99002ce7fa9acc
#7 resolve ghcr.io/astral-sh/uv:0.12.17@sha256:10787c682e4184e4f290de1171fd4703dc63de99221f10fe1c99002ce7fa9acc done
#7 DONE 0.0s
#8 [builder 1/5] FROM docker.io/library/python:3.12.14-slim-trixie@sha256:f77ac9e44ae96ef2c90b8053ea08c31f8be030f824196b0ae4db6d462c84e51f
#8 resolve docker.io/library/python:3.12.14-slim-trixie@sha256:f77ac9e44ae96ef2c90b8053ea08c31f8be030f824196b0ae4db6d462c84e51f 0.0s done
#8 DONE 0.0s
#9 [builder 5/5] RUN --mount=type=cache,target=/root/.cache/uv uv sync --locked --no-dev --no-install-project
#9 CACHED
#10 [builder 4/5] COPY pyproject.toml uv.lock ./
#10 CACHED
#11 [runtime 4/7] COPY --from=builder /app/.venv /app/.venv
#11 CACHED
#12 [runtime 5/7] COPY src ./src
#12 CACHED
#13 [runtime 2/7] RUN groupadd --system --gid 10001 app && useradd --system --uid 10001 --gid app --no-create-home --home-dir /nonexistent --shell /usr/sbin/nologin app
#13 CACHED
#14 [builder 3/5] WORKDIR /app
#14 CACHED
#15 [runtime 3/7] WORKDIR /app
#15 CACHED
#16 [builder 2/5] COPY --from=ghcr.io/astral-sh/uv:0.12.17@sha256:10787c682e4184e4f290de1171fd4703dc63de99221f10fe1c99002ce7fa9acc /uv /bin/uv
#16 CACHED
#17 [runtime 6/7] COPY alembic.ini ./
#17 CACHED
#18 [runtime 7/7] COPY migrations ./migrations
#18 CACHED
#19 exporting to image
#19 exporting layers done
#19 exporting manifest sha256:627e0709a95f0f1f9e24216d3b042e30465e42acc323fac52a36cd410487b26d done
#19 exporting config sha256:590133eeebe64883351f078dee9d6ed7eee4a747e3d33ee0c1e9b349f4900be1 done
#19 exporting attestation manifest sha256:fef012f7d572f550e85a096f310468b24db21b5d565d2f0855fc04067dda36a8 done
#19 exporting manifest list sha256:1ce6e5b7d4705aaf692d7a39a1dd67e2b29d6edcc595726b4819caed8d989d4e done
#19 naming to docker.io/library/mtusi-messenger:lab4 done
#19 unpacking to docker.io/library/mtusi-messenger:lab4 done
#19 DONE 0.0s
#20 resolving provenance for metadata file
#20 DONE 0.0s
Image mtusi-messenger:lab4 Built
[failure_checks] start postgres, valkey and s3
Network mtusi-lab4-failures_default Creating
Volume mtusi-lab4-failures_s3_data Creating
Volume mtusi-lab4-failures_s3_data Creating
Network mtusi-lab4-failures_default Creating
Volume mtusi-lab4-failures_postgres_data Creating
Volume mtusi-lab4-failures_postgres_data Creating
Volume mtusi-lab4-failures_s3_data Created
Volume mtusi-lab4-failures_s3_data Created
Volume mtusi-lab4-failures_postgres_data Created
Volume mtusi-lab4-failures_postgres_data Created
Network mtusi-lab4-failures_default Created
Network mtusi-lab4-failures_default Created
Container mtusi-lab4-failures-valkey-1 Creating
Container mtusi-lab4-failures-s3-1 Creating
Container mtusi-lab4-failures-postgres-1 Creating
Container mtusi-lab4-failures-s3-1 Created
Container mtusi-lab4-failures-valkey-1 Created
Container mtusi-lab4-failures-postgres-1 Created
Container mtusi-lab4-failures-s3-1 Starting
Container mtusi-lab4-failures-valkey-1 Starting
Container mtusi-lab4-failures-postgres-1 Starting
Container mtusi-lab4-failures-s3-1 Started
Container mtusi-lab4-failures-valkey-1 Started
Container mtusi-lab4-failures-postgres-1 Started
Container mtusi-lab4-failures-postgres-1 Waiting
Container mtusi-lab4-failures-valkey-1 Waiting
Container mtusi-lab4-failures-s3-1 Waiting
Container mtusi-lab4-failures-valkey-1 Healthy
Container mtusi-lab4-failures-postgres-1 Healthy
Container mtusi-lab4-failures-s3-1 Healthy
[failure_checks] migrations
Container mtusi-lab4-failures-postgres-1 Running
Container mtusi-lab4-failures-postgres-1 Waiting
Container mtusi-lab4-failures-postgres-1 Healthy
Container mtusi-lab4-failures-migrate-run-df05b43439f6 Creating
Container mtusi-lab4-failures-migrate-run-df05b43439f6 Created
{"event": "Running alembic", "instance_id": "9c7e96f81c3f", "module": "migrations", "host": "postgres", "port": 5432, "database": "messenger", "level": "info", "timestamp": "2026-10-22T23:18:07.604047Z", "lineno": 46, "func_name": "run_async_migrations", "filename": "env.py"}
{"event": "Context impl PostgresqlImpl.", "instance_id": "9c7e96f81c3f", "level": "info", "logger": "alembic.runtime.migration", "timestamp": "2026-10-22T23:18:07.678354Z"}
{"event": "Will assume transactional DDL.", "instance_id": "9c7e96f81c3f", "level": "info", "logger": "alembic.runtime.migration", "timestamp": "2026-10-22T23:18:07.678435Z"}
{"event": "Running upgrade -> 16c279725564, added messenger tables", "instance_id": "9c7e96f81c3f", "level": "info", "logger": "alembic.runtime.migration", "timestamp": "2026-10-22T23:18:07.688689Z"}
{"event": "Running upgrade 16c279725564 -> 42bc3b9be38f, added sessions and password hashes", "instance_id": "9c7e96f81c3f", "level": "info", "logger": "alembic.runtime.migration", "timestamp": "2026-10-22T23:18:07.697809Z"}
{"event": "Running upgrade 42bc3b9be38f -> 7652184b7016, added idempotency keys", "instance_id": "9c7e96f81c3f", "level": "info", "logger": "alembic.runtime.migration", "timestamp": "2026-10-22T23:18:07.702067Z"}
{"event": "Running upgrade 7652184b7016 -> e656d6bbe1a4, added message instance id", "instance_id": "9c7e96f81c3f", "level": "info", "logger": "alembic.runtime.migration", "timestamp": "2026-10-22T23:18:07.705023Z"}
{"event": "Running upgrade e656d6bbe1a4 -> ef25d50b01a8, added attachments tables", "instance_id": "9c7e96f81c3f", "level": "info", "logger": "alembic.runtime.migration", "timestamp": "2026-10-22T23:18:07.706245Z"}
{"event": "Running upgrade ef25d50b01a8 -> 739b8f04d5fb, added pending attachments index", "instance_id": "9c7e96f81c3f", "level": "info", "logger": "alembic.runtime.migration", "timestamp": "2026-10-22T23:18:07.714409Z"}
{"event": "Running upgrade 739b8f04d5fb -> 5c3e1f0a9b7d, added attachments lost_at", "instance_id": "9c7e96f81c3f", "level": "info", "logger": "alembic.runtime.migration", "timestamp": "2026-10-22T23:18:07.718875Z"}
{"event": "Finished alembic", "instance_id": "9c7e96f81c3f", "module": "migrations", "database": "messenger", "level": "info", "timestamp": "2026-10-22T23:18:07.723452Z", "lineno": 62, "func_name": "run_async_migrations", "filename": "env.py"}
[failure_checks] s3 bootstrap
Container mtusi-lab4-failures-s3-bootstrap-1 Creating
Container mtusi-lab4-failures-s3-bootstrap-1 Created
Attaching to s3-bootstrap-1
Container mtusi-lab4-failures-s3-bootstrap-1 Starting
Container mtusi-lab4-failures-s3-bootstrap-1 Started
s3-bootstrap-1 | s3-bootstrap: bucket messenger created
s3-bootstrap-1 | s3-bootstrap: user api created
s3-bootstrap-1 | s3-bootstrap: user cleaner created
s3-bootstrap-1 | s3-bootstrap: checks passed (api key put/get; cleaner key get/delete and list messenger/attachments/; api key list and bucket create, cleaner key put and list of the bucket, anonymous get and list denied)
s3-bootstrap-1 exited with code 0
Compose Stopping Aborting on container exit...
Container mtusi-lab4-failures-s3-bootstrap-1 Stopping
Container mtusi-lab4-failures-s3-bootstrap-1 Stopped
[failure_checks] start cleaner: grace 20 s, interval 1 s, reconcile interval 0 s (0 — off)
Container mtusi-lab4-failures-cleaner-1 Creating
Container mtusi-lab4-failures-cleaner-1 Created
Container mtusi-lab4-failures-cleaner-1 Starting
Container mtusi-lab4-failures-cleaner-1 Started
[failure_checks] start api containers
[failure_checks] ready: api=http://127.0.0.1:56529 tight=http://127.0.0.1:56538 uploads=http://127.0.0.1:56550 s3=http://127.0.0.1:56556
[failure_checks] pytest -m fault
============================= test session starts ==============================
platform darwin -- Python 3.12.12, pytest-9.1.1, pluggy-1.6.0 -- …/.venv/bin/python
cachedir: .pytest_cache
rootdir: …
configfile: pyproject.toml
testpaths: student-tests
plugins: anyio-4.15.1
collecting ... collected 247 items / 198 deselected / 49 selected
student-tests/test_failures.py::test_expired_token PASSED [ 2%]
student-tests/test_failures.py::test_use_does_not_extend_session PASSED [ 4%]
student-tests/test_failures.py::test_token_while_database_stopped PASSED [ 6%]
student-tests/test_failures.py::test_members_failure_rolls_back_chat PASSED [ 8%]
student-tests/test_failures.py::test_database_stopped_and_back PASSED [ 10%]
student-tests/test_failures.py::test_pool_exhausted PASSED [ 12%]
student-tests/test_failures.py::test_connection_limit_reached PASSED [ 14%]
student-tests/test_failures.py::test_pool_keeps_connections PASSED [ 16%]
student-tests/test_failures.py::test_readiness_without_database PASSED [ 18%]
student-tests/test_failures.py::test_readiness_without_cache PASSED [ 20%]
student-tests/test_failures.py::test_readiness_without_object_storage[stop] PASSED [ 22%]
student-tests/test_failures.py::test_readiness_without_object_storage[pause] PASSED [ 24%]
student-tests/test_failures.py::test_flush_cache PASSED [ 26%]
student-tests/test_failures.py::test_valkey_stopped PASSED [ 28%]
student-tests/test_failures.py::test_valkey_paused PASSED [ 30%]
student-tests/test_failures.py::test_valkey_back PASSED [ 32%]
student-tests/test_failures.py::test_message_failure_keeps_key_free PASSED [ 34%]
student-tests/test_failures.py::test_database_outage_keeps_key_free PASSED [ 36%]
student-tests/test_failures.py::test_key_free_after_ttl PASSED [ 38%]
student-tests/test_failures.py::test_upload_with_object_storage_stopped PASSED [ 40%]
student-tests/test_failures.py::test_rejected_uploads_leave_nothing PASSED [ 42%]
student-tests/test_failures.py::test_metadata_insert_failure PASSED [ 44%]
student-tests/test_failures.py::test_interrupted_body PASSED [ 46%]
student-tests/test_failures.py::test_ready_failure_compensated PASSED [ 48%]
student-tests/test_failures.py::test_killed_between_put_and_ready PASSED [ 51%]
student-tests/test_failures.py::test_ready_commit_outcome_unknown PASSED [ 53%]
student-tests/test_failures.py::test_upload_outlives_grace PASSED [ 55%]
student-tests/test_failures.py::test_cleaner_failure_after_object_delete PASSED [ 57%]
student-tests/test_failures.py::test_cleaner_survives_outages PASSED [ 59%]
student-tests/test_failures.py::test_object_storage_stopped PASSED [ 61%]
student-tests/test_failures.py::test_environment_does_not_change_limits PASSED [ 63%]
student-tests/test_failures.py::test_object_storage_paused PASSED [ 65%]
student-tests/test_failures.py::test_upload_slots_busy PASSED [ 67%]
student-tests/test_failures.py::test_rejections_before_queue PASSED [ 69%]
student-tests/test_failures.py::test_upload_waits_for_slot PASSED [ 71%]
student-tests/test_failures.py::test_slot_released_after_failures PASSED [ 73%]
student-tests/test_failures.py::test_slow_body PASSED [ 75%]
student-tests/test_failures.py::test_upload_after_idle_s3 PASSED [ 77%]
student-tests/test_failures.py::test_reconcile_finds_and_fixes PASSED [ 79%]
student-tests/test_failures.py::test_reconcile_keeps_fresh_used_and_unknown PASSED [ 81%]
student-tests/test_failures.py::test_reconcile_restored_original PASSED [ 83%]
student-tests/test_failures.py::test_reconcile_change_limit PASSED [ 85%]
student-tests/test_failures.py::test_reconcile_keeps_referenced_objects PASSED [ 87%]
student-tests/test_failures.py::test_reconcile_limit_keeps_cleanup PASSED [ 89%]
student-tests/test_failures.py::test_reconcile_foreign_key_untouched PASSED [ 91%]
student-tests/test_failures.py::test_reconcile_object_storage_stopped PASSED [ 93%]
student-tests/test_failures.py::test_reconcile_interrupted_by_database PASSED [ 95%]
student-tests/test_failures.py::test_reconcile_under_load PASSED [ 97%]
student-tests/test_failures.py::test_scheduled_reconcile PASSED [100%]
==================================== PASSES ====================================
================ 49 passed, 198 deselected in 552.47s (0:09:12) ================
[failure_checks] postgres log: 463 lines, crash markers 0; "too many clients" 35, "administrator command" 147
[failure_checks] cleanup
Container mtusi-lab4-failures-cleaner-1 Stopping
Container mtusi-lab4-failures-valkey-1 Stopping
Container mtusi-lab4-failures-valkey-1 Stopped
Container mtusi-lab4-failures-valkey-1 Removing
Container mtusi-lab4-failures-valkey-1 Removed
Container mtusi-lab4-failures-cleaner-1 Stopped
Container mtusi-lab4-failures-cleaner-1 Removing
Container mtusi-lab4-failures-cleaner-1 Removed
Container mtusi-lab4-failures-s3-bootstrap-1 Stopping
Container mtusi-lab4-failures-postgres-1 Stopping
Container mtusi-lab4-failures-s3-bootstrap-1 Stopped
Container mtusi-lab4-failures-s3-bootstrap-1 Removing
Container mtusi-lab4-failures-s3-bootstrap-1 Removed
Container mtusi-lab4-failures-s3-1 Stopping
Container mtusi-lab4-failures-postgres-1 Stopping
Container mtusi-lab4-failures-postgres-1 Stopped
Container mtusi-lab4-failures-postgres-1 Removing
Container mtusi-lab4-failures-postgres-1 Removed
Container mtusi-lab4-failures-s3-1 Stopped
Container mtusi-lab4-failures-s3-1 Removing
Container mtusi-lab4-failures-s3-1 Removed
Volume mtusi-lab4-failures_s3_data Removing
Volume mtusi-lab4-failures_postgres_data Removing
Network mtusi-lab4-failures_default Removing
Volume mtusi-lab4-failures_s3_data Removed
Volume mtusi-lab4-failures_postgres_data Removed
Network mtusi-lab4-failures_default Removed
[failure_checks] results: {'fault': 0, 'postgres': 0}
exit=0
2026-10-22T23:27:37Z
```
Код команды — 0, вся команда — 9 мин 39 с (23:17:58–23:27:37). Образ
собран из кэша: это тот же образ `723b6c3`, что и у реплик рабочего
стенда. «too many clients» и «administrator command» — следы проверок
«Предел соединений PostgreSQL исчерпан» (`fill-connections`) и
остановок PostgreSQL, признаков аварийного перезапуска нет. Реплики
рабочего стенда до и после прогона те же: `api-25` и `api-26`, старт в
23:15. Контейнеров, volumes и сети проекта `mtusi-lab4-failures` после
прогона нет, docker volumes — 155.
## Прежний снимок: `84f8c35`, 48 из 48
Вывод сборки образа (BuildKit), строки `Container …` compose, записи
alembic, вывод bootstrap S3 и журналы контейнеров стенда опущены; путь к
рабочему каталогу в строках `platform` и `rootdir` pytest заменён на `…`.
Дата — 2026-10-22, 18:04:24–18:13:30 UTC, три API.
```
$ make failure_checks
python3 student-tests/run_failures.py
[failure_checks] project=mtusi-lab4-failures (working stand: mtusi-lab4)
[failure_checks] build image
[failure_checks] start postgres, valkey and s3
[failure_checks] migrations
[failure_checks] s3 bootstrap
[failure_checks] start cleaner: grace 20 s, interval 1 s, reconcile interval 0 s (0 — off)
[failure_checks] start api containers
[failure_checks] ready: api=http://127.0.0.1:54563 tight=http://127.0.0.1:54569 uploads=http://127.0.0.1:54573
[failure_checks] pytest -m fault
platform darwin -- Python 3.12.12, pytest-9.1.1, pluggy-1.6.0 -- …
collecting ... collected 246 items / 198 deselected / 48 selected
student-tests/test_failures.py::test_expired_token PASSED [ 2%]
student-tests/test_failures.py::test_use_does_not_extend_session PASSED [ 4%]
student-tests/test_failures.py::test_token_while_database_stopped PASSED [ 6%]
student-tests/test_failures.py::test_members_failure_rolls_back_chat PASSED [ 8%]
student-tests/test_failures.py::test_database_stopped_and_back PASSED [ 10%]
student-tests/test_failures.py::test_pool_exhausted PASSED [ 12%]
student-tests/test_failures.py::test_connection_limit_reached PASSED [ 14%]
student-tests/test_failures.py::test_pool_keeps_connections PASSED [ 16%]
student-tests/test_failures.py::test_readiness_without_database PASSED [ 18%]
student-tests/test_failures.py::test_readiness_without_cache PASSED [ 20%]
student-tests/test_failures.py::test_readiness_without_object_storage[stop] PASSED [ 22%]
student-tests/test_failures.py::test_readiness_without_object_storage[pause] PASSED [ 25%]
student-tests/test_failures.py::test_flush_cache PASSED [ 27%]
student-tests/test_failures.py::test_valkey_stopped PASSED [ 29%]
student-tests/test_failures.py::test_valkey_paused PASSED [ 31%]
student-tests/test_failures.py::test_valkey_back PASSED [ 33%]
student-tests/test_failures.py::test_message_failure_keeps_key_free PASSED [ 35%]
student-tests/test_failures.py::test_database_outage_keeps_key_free PASSED [ 37%]
student-tests/test_failures.py::test_key_free_after_ttl PASSED [ 39%]
student-tests/test_failures.py::test_upload_with_object_storage_stopped PASSED [ 41%]
student-tests/test_failures.py::test_rejected_uploads_leave_nothing PASSED [ 43%]
student-tests/test_failures.py::test_metadata_insert_failure PASSED [ 45%]
student-tests/test_failures.py::test_interrupted_body PASSED [ 47%]
student-tests/test_failures.py::test_ready_failure_compensated PASSED [ 50%]
student-tests/test_failures.py::test_killed_between_put_and_ready PASSED [ 52%]
student-tests/test_failures.py::test_ready_commit_outcome_unknown PASSED [ 54%]
student-tests/test_failures.py::test_upload_outlives_grace PASSED [ 56%]
student-tests/test_failures.py::test_cleaner_failure_after_object_delete PASSED [ 58%]
student-tests/test_failures.py::test_cleaner_survives_outages PASSED [ 60%]
student-tests/test_failures.py::test_object_storage_stopped PASSED [ 62%]
student-tests/test_failures.py::test_environment_does_not_change_limits PASSED [ 64%]
student-tests/test_failures.py::test_object_storage_paused PASSED [ 66%]
student-tests/test_failures.py::test_upload_slots_busy PASSED [ 68%]
student-tests/test_failures.py::test_rejections_before_queue PASSED [ 70%]
student-tests/test_failures.py::test_upload_waits_for_slot PASSED [ 72%]
student-tests/test_failures.py::test_slot_released_after_failures PASSED [ 75%]
student-tests/test_failures.py::test_slow_body PASSED [ 77%]
student-tests/test_failures.py::test_reconcile_finds_and_fixes PASSED [ 79%]
student-tests/test_failures.py::test_reconcile_keeps_fresh_used_and_unknown PASSED [ 81%]
student-tests/test_failures.py::test_reconcile_restored_original PASSED [ 83%]
student-tests/test_failures.py::test_reconcile_change_limit PASSED [ 85%]
student-tests/test_failures.py::test_reconcile_keeps_referenced_objects PASSED [ 87%]
student-tests/test_failures.py::test_reconcile_limit_keeps_cleanup PASSED [ 89%]
student-tests/test_failures.py::test_reconcile_foreign_key_untouched PASSED [ 91%]
student-tests/test_failures.py::test_reconcile_object_storage_stopped PASSED [ 93%]
student-tests/test_failures.py::test_reconcile_interrupted_by_database PASSED [ 95%]
student-tests/test_failures.py::test_reconcile_under_load PASSED [ 97%]
student-tests/test_failures.py::test_scheduled_reconcile PASSED [100%]
================ 48 passed, 198 deselected in 523.74s (0:08:43) ================
[failure_checks] postgres log: 458 lines, crash markers 0; "too many clients" 31, "administrator command" 143
[failure_checks] cleanup
[failure_checks] results: {'fault': 0, 'postgres': 0}
exit=0
```
Вся команда — 9 мин 06 с (18:04:24–18:13:30). «too many clients» и
«administrator command» — следы проверок «Предел соединений PostgreSQL
исчерпан» (`fill-connections`) и остановок PostgreSQL, признаков
аварийного перезапуска нет.
## Уборка и рабочий стенд (снимок `84f8c35`)
```
$ docker inspect -f '{{.Name}} {{.State.StartedAt}}' $(docker compose ps -q) # до и после прогона — одинаково
/mtusi-lab4-api-21 2026-10-22T16:38:07.188747593Z
/mtusi-lab4-api-22 2026-10-22T16:37:49.487956001Z
/mtusi-lab4-cleaner-1 2026-10-22T16:42:59.905412465Z
/mtusi-lab4-haproxy-1 2026-10-22T16:37:23.189875503Z
/mtusi-lab4-postgres-1 2026-10-22T16:36:57.034778213Z
/mtusi-lab4-s3-1 2026-10-22T16:37:12.007644429Z
/mtusi-lab4-valkey-1 2026-10-22T16:36:57.056768422Z
$ docker ps -aq --filter label=com.docker.compose.project=mtusi-lab4-failures | wc -l
0
$ docker volume ls -q | wc -l
155
```
- Все контейнеры `mtusi-lab4` стартовали раньше прогона (последние — после
`make test-persistence`, `make test-failover` и остановки уборщика для
`evidence/reconcile/service.md` в 16:36–16:43; прогон — с 18:04:24), и
время старта после прогона то же: рабочий стенд не тронут. Список docker
volumes до и после прогона один и тот же (155 имён).
- У проекта `mtusi-lab4-failures` не осталось ни контейнеров, ни volumes.
## Сверка bucket и БД (change `track2-reconciler`)
Hook вносит расхождения с обеих сторон (`put-object` — процесс в
контейнере обычного API его ключами, `delete-object` — `weed shell fs.rm`,
`delete-row`, `set-size`, `age-row` — psql) и запускает разовую сверку
(`reconcile dry-run|apply [предел]` — одноразовый контейнер уборщика
стенда, записи журнала и код выхода). Записи фильтруются по своим `id` и
ключам, код выхода сверяется с записями того же прохода. Объекты
состарить нельзя (`LastModified` ставит S3) — тесты с объектом без строки
ждут G + 1 = 21 с; строки состаривает `age-row`.
- «Расхождения с обеих сторон найдены», «Исправление расхождений»,
«Повторная сверка», `attachments` «Потерянный оригинал»
(`test_reconcile_finds_and_fixes`; уборщик стенда остановлен на время
теста): A в сообщении без объекта, B без строки, C с другим размером, O
мимо API, P — обрыв COMMIT (строка `pending` и объект); dry-run — у
каждого свой класс (`missing_object`, `orphan_object` ×2,
`size_mismatch`, `stale_pending`), возраст ≥ G, код 3, строки, объекты и
пометки не изменились, байты A — 500; `--apply` — O и объект B удалены,
у P ни строки, ни объекта, A и C помечены, байты A — 404, метаданные A
равны ответу загрузки; повтор — своих записей нет, код соответствует
записям.
- «Свежие не тронуты», «Используемое вложение не удаляется», «Чужой
объект не удаляется» (`…_keeps_fresh_used_and_unknown`): у вложения в
сообщении объект удалён — помечено, метаданные 200, история отдаёт его
`id`, ни одна `ready` строка не пропала; свежие объект без строки и
вложение без объекта — не тронуты, `fresh_objects` и `fresh_rows` ≥ 1;
ключ `…/attachments/x-<uuid>` — «unknown_object», код 3, следующий
проход снова его видит.
- «Оригинал вернулся» (`…_restored_original`): помечено → те же байты под
ключом → `--apply` — `restored_object` / `cleared_lost`, байты 200 с тем
же SHA-256, следующий dry-run — ни одной записи о нём.
- «Предел изменений» (`…_change_limit`): три потери при пределе 2 — код
3, `error` «Reconcile changes exceed limit» с `changes` ≥ 3 и
`max_changes` 2, итог `warning` с `refused: true`, ни одной пометки; с
пределом 100 — помечены все три.
- «S3 недоступен во время сверки» (`…_object_storage_stopped`): S3
остановлен — код 1, `interrupted_by: object_storage`, ни одного «Fixed»;
после возврата — помечено.
- «Прерванная сверка доводится повтором» (`…_interrupted_by_database`):
триггер роняет пометку одного вложения (08006) — код 1,
`interrupted_by: database`; после снятия — помечены оба, dry-run их не
находит.
- «Сверка под нагрузкой» (`…_under_load`): два объекта без строки и две
потери; 4 потока ~35 с загружают PNG ~100 KiB из шума и отправляют
сообщения, поток сверки — `--apply` раз в 3 с: внесённое исправлено,
каждое 201 скачивается с тем же SHA-256, каждое сообщение отдаёт своё
вложение, новые пометки — только внесённые, ни один проход не прерван.
- «Плановая сверка без команды» (`test_scheduled_reconcile`): отдельный
уборщик `<проект>-cleaner-scheduled` с `RECONCILER__INTERVAL_SECONDS=1`
на 6 с — в журнале «Finished reconcile pass» с `apply: true`, потеря
помечена без разового прохода.
По замечаниям verify (hook `set-key` меняет только `object_key` строки):
- «Объект, на который ссылается строка, не удаляется»
(`…_keeps_referenced_objects`): у X ключ `…/attachments/x-other-<uuid>`
без объекта, Y ссылается на `<Z>/original` (строки Z нет, объект есть),
после G + 1 dry-run и `--apply` — `<X>/original`, `<Y>/original` и
`<Z>/original` — `unknown_object` и на месте, код 3; X помечено
(`missing_object` по своему ключу), Y — нет; в `finally` ключи
возвращены, объект Z удалён hook.
- «Предел не останавливает уборку зависших» (`…_limit_keeps_cleanup`):
уборщик стенда стоит, обрыв COMMIT даёт зависшую P (`age-row`), три
потери при пределе 2 — код 3, `error` о пределе, `refused: true`, ни
одной пометки, а P убрана (`removed_pending`, ни строки, ни объекта);
затем с пределом 100 помечены все три.
- «Ключ вне префикса вложений не трогается»
(`…_foreign_key_untouched`): готовой строке и зависшей загрузке `set-key`
ставит `<база>/elsewhere/<id>`; dry-run и `--apply` — обе
`unknown_object`, код 3, ни одной записи «Fixed»: строки `ready` и
`pending` на месте, готовая не помечена, их объекты под префиксом
вложений целы.
## Места загрузки и срок тела (change `upload-memory`)
«Узкий по загрузкам» API: 1 место, 1 в очереди, ожидание 1 с, срок тела
3 с; тесты сверяют это окружение (`FAULT_UPLOADS_ENV`). Место держит
загрузка A, тело которой стоит на `threading.Event` теста. Срок тела
поднят с 2 до 3 с по verify (design change `upload-memory`, «Уточнения
apply», п. 15): A отпускается через ~1,3–1,5 с после того, как заняла
место, и при 2 с запас был ~0,5 с.
- «Все места заняты», «Очередь ожидания полна», `api-conventions` «Лимит
одновременных загрузок» (`test_upload_slots_busy`): A держит место, B
ждёт, C получает 429 `rate_limited` быстрее 0,5 с, B — 429 не раньше
1 с; у обоих `Retry-After` — положительное целое ≥ 1, формат ошибки и
`X-Instance-Id`; A после отпускания — 201; новые строка и объект —
только у A.
- «Отказ раньше очереди» (`test_rejections_before_queue`): при полной
очереди посторонний — 404, 30 MiB с `Content-Length` 31 457 280 — 413,
`Content-Type: text/plain` — 415, каждый быстрее срока ожидания и
раньше 429 ожидавшей B.
- «Ожидание места» и `storage-consistency` «Ожидание места не входит в
возраст загрузки» (`test_upload_waits_for_slot`): B ждёт и получает
201, `B.created_at` позже `A.updated_at`, обе скачиваются побайтно.
- «Место освобождается» (`test_slot_released_after_failures`): после 413
по счётчику, 415 по содержимому, 400 по сроку тела, обрыва тела и 503
при остановленном S3 следующая загрузка — 201 быстрее срока ожидания.
- «Медленный клиент», «Медленная передача в срок» (`test_slow_body`):
тело частями за 4 с (дольше срока 3 с) — 400 «Upload body was not
received in time»,
ни строки, ни объекта; мелкими частями в срок — 201 с тем же SHA-256.
## Что проверяют проверки вложений и уборщика
Строки и объекты тесты сравнивают множествами `id` от hook
(`attachment-ids` — psql, `object-ids` — файлы `original` под
`/buckets/<bucket>/<база>/attachments` по `weed shell fs.tree`), а не
счётчиками: уборщик стенда убирает строки прежних тестов параллельно, а
пустой каталог `<id>/` после DELETE SeaweedFS держит ещё ~2 мин. Объекты
без строки — `object-ids − attachment-ids`. G = 20 с, I = 1 с, запас
поверх G + I — 5 с.
- «Запись в S3 не удалась», «Незавершённая загрузка не видна»
(`test_upload_with_object_storage_stopped`): S3 остановлен → загрузка
503 быстрее срока вызова S3; ровно одна новая строка, она `pending` и
совпадает с `last-pending`, готовые — те же; по её `id` метаданные,
байты и сообщение со ссылкой — 404 с тем же `message`, что у
случайного `id`; текстовое сообщение — 201; после `start` та же
загрузка — 201.
- «Отклонённая загрузка ничего не оставляет»: 404 постороннему, 413 по
`Content-Length`, 413 частями, 413 по пикселям, 415 по типу и 415 по
целостности — ни новых строк, ни новых объектов (перед этим одна
настоящая загрузка: её `id` есть в обоих списках).
- «Сбой записи метаданных» (`test_metadata_insert_failure`): триггер
роняет вставку строки этого `filename` с SQLSTATE 08006 → 503; ни
строки, ни объекта.
- «Обрыв передачи тела» (`test_interrupted_body`): тело-итератор бросает
исключение после 1 MiB → у клиента ошибка; ни строки, ни объекта;
следующая загрузка того же участника — 201.
- «Фиксация ready не удалась», «Свежая загрузка не тронута», «Зависшая
загрузка убрана» (`test_ready_failure_compensated`): триггер роняет
перевод в `ready` → 503, строка `pending` осталась, объекта уже нет
(компенсация до ответа), по API не видна; на G/2 строка ещё на месте
(уборщик сделал ~10 проходов); не позже G + I + 5 с нет ни строки, ни
объекта, объектов без строки нет.
- «Объект без фиксации убран» (`test_killed_between_put_and_ready`):
триггер задерживает перевод в `ready` на 4 с → в это окно есть строка
`pending` и объект → `kill-api` (docker kill обычного API) → 201 до
клиента не дошёл, строка и объект на месте → `start-api` → после grace
ни строки, ни объекта, объектов без строки нет; загрузка — 201.
- «Исход фиксации неизвестен» (`test_ready_commit_outcome_unknown`,
verify W2): отложенный триггер ограничения роняет COMMIT перевода в
`ready` (08006) → 503, строка `pending`, по API не видна, **объект на
месте** сразу после ответа (исход для API неизвестен, компенсации
нет); не позже G + I + 5 с ни строки, ни объекта, объектов без строки
нет.
- «Загрузка дольше grace» (`test_upload_outlives_grace`, verify W3):
строка вставлена на час старше (`created_at` и `updated_at` вместе),
перевод в `ready` ждёт в триггере уровня оператора `BEFORE UPDATE OF
status`, пока уборщик стенда не уберёт строку → 503, а не 201 и не 500;
ни строки, ни объекта, объектов без строки нет.
- «Сбой уборки после удаления объекта»
(`test_cleaner_failure_after_object_delete`, verify W1): то же, но
удаление строки падает с 08006 уже после удаления объекта — в той же
транзакции уборки (второй шаг), то есть её откат после удачного DELETE
в S3 → 503, а не 201; строка `pending` (помечена первым шагом), по API
не видна, вложений `ready` без объекта нет; после снятия триггера
следующий проход убирает строку, объектов без строки нет.
- «S3 недоступен во время уборки», «БД недоступна во время уборки»,
«Готовые вложения не тронуты» (`test_cleaner_survives_outages`):
готовое вложение R; S3 остановлен → загрузка 503 (строка X);
PostgreSQL остановлен на 3 с и запущен; к G + 3I при остановленном S3
X ещё `pending` (проходы прерываются); S3 запущен → X убрана не позже
I + 5 с, объектов без строки нет; R — метаданные 200 `ready`, байты с
тем же SHA-256. Уборщик всё это время работал без перезапуска (`restart:
"no"`: упавший процесс не убрал бы X).
- «S3 завис» и «Зависшая загрузка убрана» (`test_object_storage_paused`):
`docker pause` S3 → загрузка и скачивание — 503 не позже 5 с + 0,6 с;
после `unpause` скачивание — те же байты; строка загрузки во время
заморозки убрана после grace, объект после разморозки не дописался.
- «S3 остановлен» и «Окружение не меняет лимит» — как в прежнем снимке:
скачивание 503, метаданные и история без S3 — 200; `sample.png` при
`MAX_UPLOAD_BYTES=1` в окружении — 201.
## Красный прогон до кода (apply, 2026-10-21)
Новые тесты и hook против прежней ветки `mark_ready` без компенсации
(временная правка `AttachmentService.upload`, возвращена) и без уборщика
(`docker compose -p mtusi-lab4-failures stop cleaner` сразу после
старта), `FAULT_ARGS='-k "object_storage or cleaner or interrupted or
metadata or killed or ready_failure or rejected"'`: 4 failed, 7 passed.
```
student-tests/test_failures.py::test_ready_failure_compensated FAILED
student-tests/test_failures.py::test_killed_between_put_and_ready FAILED
student-tests/test_failures.py::test_cleaner_survives_outages FAILED
student-tests/test_failures.py::test_object_storage_paused FAILED
E AssertionError: assert '4fc5db0e-…' not in {'3ec2dd25-…', '4fc5db0e-…', …} # объект остался после 503
E AssertionError: attachment 76904e3d-… is not cleaned 26.6s after upload: row pending, object True
E AssertionError: pending 9a93edaf-… is still there 6.5s after S3 came back
E AssertionError: attachment 359413af-… is not cleaned 26.4s after upload: row pending, object False
=========== 4 failed, 7 passed, 215 deselected in 127.26s (0:02:07) ============
```
«Сбой записи метаданных», «Обрыв передачи тела» и «Незавершённая
загрузка не видна» прежний код уже выполнял — эти тесты закрепляют
поведение.
## Красные прогоны тестов по замечаниям verify (2026-10-21)
Новые тесты и режимы hook против кода `f2dc0b3` (рабочее дерево до
правки уборщика; `make failure_checks FAULT_ARGS='-k "commit_outcome or
outlives or failure_after_object"'`):
```
student-tests/test_failures.py::test_ready_commit_outcome_unknown PASSED [ 33%]
student-tests/test_failures.py::test_upload_outlives_grace PASSED [ 66%]
student-tests/test_failures.py::test_cleaner_failure_after_object_delete FAILED [100%]
E AssertionError: POST /api/v1/chats/0ba258db-…/attachments: expected 503; got 201 {"id":"2dd20f36-…", …}
================= 1 failed, 2 passed, 226 deselected in 31.21s =================
```
- W1 на прежнем коде — 201 за 4,6 с: уборщик удалил объект, его
транзакция откатилась на DELETE строки, и ждавший `mark_ready`
перевёл строку в `ready` без объекта. Тест после этого не менялся
(правка `5889ca2` меняет только порядок шагов уборщика), поэтому этот
красный прогон в силе и для текущего кода.
- W2 и W3 на прежнем коде зелёные: эти ветки были верны, тесты их
закрепляют. Краснеют на временных регрессиях (правки возвращены, `git
diff src/core/services/attachment.py` пуст): «компенсация на любой
сбой» и возврат `RuntimeError` вместо 503
(`FAULT_ARGS='-k "commit_outcome or outlives"'`):
```
student-tests/test_failures.py::test_ready_commit_outcome_unknown FAILED [ 50%]
student-tests/test_failures.py::test_upload_outlives_grace FAILED [100%]
E AssertionError: assert '2b1ccadf-…' in set() # объект удалён после неизвестного COMMIT
E AssertionError: POST /api/v1/chats/e6a74a0b-…/attachments: expected 503; got 500 {"error":{"code":"internal_error","message":"Internal server error","request_id":"…"}}
====================== 2 failed, 227 deselected in 3.49s =======================
```
## Красный прогон до кода `upload-memory` (apply, 2026-10-21)
Новые тесты мест загрузки и срока тела (tasks change `upload-memory`,
1.2–1.4) и третий API стенда отказов (`UPLOADS_ENV`) против кода
`f894040` (HEAD `fc1524d`, в `src/` правок ещё нет): `make
failure_checks FAULT_ARGS='-k "slot or queue or slow_body"'`. Прежний API
секцию `[uploads]` не знает и окружение `UPLOADS__*` игнорирует:
5 failed.
```
[failure_checks] ready: api=http://127.0.0.1:50458 tight=http://127.0.0.1:50462 uploads=http://127.0.0.1:50467
collecting ... collected 235 items / 230 deselected / 5 selected
student-tests/test_failures.py::test_upload_slots_busy FAILED [ 20%]
student-tests/test_failures.py::test_rejections_before_queue FAILED [ 40%]
student-tests/test_failures.py::test_upload_waits_for_slot FAILED [ 60%]
student-tests/test_failures.py::test_slot_released_after_failures FAILED [ 80%]
student-tests/test_failures.py::test_slow_body FAILED [100%]
E AssertionError: POST /api/v1/chats/c6d00a36-…/attachments: expected 429; got 201 {"id":"9f6d3dcd-…", …}
E AssertionError: POST /api/v1/chats/f25be5c6-…/attachments: expected 429; got 201 {"id":"0d558e8b-…", …}
E assert '2026-10-21T20:29:49.137493Z' > '2026-10-21T20:29:49.331772Z'
E AssertionError: POST /api/v1/chats/b9f1daa1-…/attachments: expected 400; got 201 {"id":"24f4bc9f-…", …}
E AssertionError: POST /api/v1/chats/acec553a-…/attachments: expected 400; got 201 {"id":"820f7582-…", …}
====================== 5 failed, 230 deselected in 12.08s ======================
[failure_checks] postgres log: 56 lines, crash markers 0; "too many clients" 0, "administrator command" 0
[failure_checks] results: {'fault': 1, 'postgres': 0}
```
Причины — дефект прежнего кода, а не тестов и не стенда (мест и срока тела
у него нет):
- `test_upload_slots_busy` — загрузка при занятом месте и полной очереди
принята (201), а не 429;
- `test_rejections_before_queue` — ожидавшая в очереди загрузка B
принята сразу (201): «очередь полна», условие сценария, на прежнем коде
недостижимо. Тест проверяет его до ранних отказов (404, 413, 415), иначе
быстрые отказы ничего бы не доказывали;
- `test_upload_waits_for_slot` — B не ждала места: её `created_at`
раньше `updated_at` загрузки, которая держала место;
- `test_slot_released_after_failures` — 413 по счётчику и 415 по
содержимому с последующей загрузкой прошли, а тело дольше срока
(шаг 3) принято (201): срока тела нет;
- `test_slow_body` — тело дольше срока принято (201), а не 400.
Tasks (1.5) ждали зелёными `test_slot_released_after_failures` и
`test_rejections_before_queue`. Первый включает шаг «400 по сроку тела»
(design, решение 11), которого прежний код не выполняет; второй проверяет
полную очередь (ответ 429 ожидавшей) — design change `upload-memory`,
«Уточнения apply», п. 2.
## Красный прогон до кода `track2-reconciler` (apply, 2026-10-22)
Окончательные тесты, hook, `run_failures.py` и `failures.compose.yml`
change против кода приложения `c13df14` (последний commit до кода change;
код тот же, что `5f4b9ff`): `git archive c13df14` во временный каталог,
поверх — `student-tests/` рабочего дерева apply, `python3
student-tests/run_failures.py -k reconcile` из него (16:07–16:09 UTC).
Рабочий стенд не трогался.
```
[failure_checks] project=mtusi-lab4-failures (working stand: mtusi-lab4)
s3-bootstrap: checks passed (api key put/get; cleaner key get/delete; api key list and bucket create, cleaner key put and list, anonymous get and list denied)
student-tests/test_failures.py::test_reconcile_finds_and_fixes FAILED [ 12%]
student-tests/test_failures.py::test_reconcile_keeps_fresh_used_and_unknown FAILED [ 25%]
student-tests/test_failures.py::test_reconcile_restored_original FAILED [ 37%]
student-tests/test_failures.py::test_reconcile_change_limit FAILED [ 50%]
student-tests/test_failures.py::test_reconcile_object_storage_stopped FAILED [ 62%]
student-tests/test_failures.py::test_reconcile_interrupted_by_database FAILED [ 75%]
student-tests/test_failures.py::test_reconcile_under_load FAILED [ 87%]
student-tests/test_failures.py::test_scheduled_reconcile FAILED [100%]
E AssertionError: fault hook lost-ids: ERROR: column "lost_at" does not exist
E AssertionError: assert {} == {'messenger/attachments/x-…': 'unknown_object'}
E AssertionError: assert {} == {'1c6bae15-…': 'missing_object'}
E assert 2 == 3 # Reconcile(records=[], exit_code=2)
E assert 2 == 1 # Reconcile(records=[], exit_code=2)
E AssertionError: fault hook fail-attachments mark fault-….png: … ERROR: column "lost_at" of relation "attachments" does not exist
E AssertionError: fault hook lost-ids: ERROR: column "lost_at" does not exist
E AssertionError: {"event": "Started cleaner", …} {"event": "Stopped cleaner", …} # assert passes — итога сверки нет
================= 8 failed, 235 deselected in 95.20s (0:01:35) =================
[failure_checks] postgres log: 67 lines, crash markers 0; "too many clients" 0, "administrator command" 0
[failure_checks] results: {'fault': 1, 'postgres': 0}
```
Причины — отсутствие нового поведения в прежнем коде, а не тестов и не
стенда:
| Тест | Падение | Причина |
|---|---|---|
| `test_reconcile_finds_and_fixes` | `lost-ids`: нет колонки `lost_at` | миграции change нет |
| `test_reconcile_keeps_fresh_used_and_unknown` | ни одной записи «Found» | команды `reconcile` нет: argparse, код 2 |
| `test_reconcile_restored_original` | ни одной записи «Fixed» | то же |
| `test_reconcile_change_limit` | код 2 вместо 3 | то же |
| `test_reconcile_object_storage_stopped` | код 2 вместо 1 | то же |
| `test_reconcile_interrupted_by_database` | триггер `BEFORE UPDATE OF lost_at` не создать | колонки нет |
| `test_reconcile_under_load` | `lost-ids`: нет колонки | то же |
| `test_scheduled_reconcile` | в журнале уборщика только «Started» и «Stopped cleaner» | плановой сверки нет |
Первый красный прогон того же кода (с тестами до правок apply — design
change `track2-reconciler`, «Уточнения apply», пп. 15 и 17) тоже дал 8
failed за 99,5 с; его вывод сохранился не полностью, поэтому снят этот.
На новом коде первые два прогона `-k reconcile` падали на дефектах
самих тестов и hook (`start cleaner` через `compose start` требовал
контейнер `migrate`; сравнение метаданных строк, которые изменил сам
hook), не кода: после их правки — 8 из 8 и полный прогон 45 из 45.
## Красные прогоны тестов по замечаниям verify `track2-reconciler` (2026-10-22)
Три новые проверки (tasks, группа 13) — с тестами и hook `84f8c35`, в
двух временных каталогах из `git archive` (рабочее дерево не менялось).
Рабочий стенд не трогался; после прогонов образ `mtusi-messenger:lab4`
пересобран из `84f8c35` (`docker compose build api`, контейнеры стенда не
пересоздавались), каталоги удалены.
**13.2, W2 — код приложения `a6071da`** (до правок; `git archive a6071da`,
поверх — `student-tests/` из `84f8c35`), 18:14:37–18:15:58:
```
$ python3 student-tests/run_failures.py -k "referenced_objects or limit_keeps_cleanup or foreign_key_untouched"
[failure_checks] project=mtusi-lab4-failures (working stand: mtusi-lab4)
[failure_checks] start cleaner: grace 20 s, interval 1 s, reconcile interval 0 s (0 — off)
student-tests/test_failures.py::test_reconcile_keeps_referenced_objects PASSED [ 33%]
student-tests/test_failures.py::test_reconcile_limit_keeps_cleanup PASSED [ 66%]
student-tests/test_failures.py::test_reconcile_foreign_key_untouched FAILED [100%]
E AssertionError: assert {'95d43699-44...tale_pending'} == {'95d43699-44...known_object'}
E Differing items:
E {'95d43699-44d0-463d-b168-a44f99b0d141': 'missing_object'} != {'95d43699-44d0-463d-b168-a44f99b0d141': 'unknown_object'}
E {'b8dd6a9a-884a-4868-afd1-2e5dc3192d4a': 'stale_pending'} != {'b8dd6a9a-884a-4868-afd1-2e5dc3192d4a': 'unknown_object'}
student-tests/test_failures.py:2001: AssertionError
================= 1 failed, 2 passed, 243 deselected in 59.97s =================
[failure_checks] postgres log: 62 lines, crash markers 0; "too many clients" 0, "administrator command" 0
[failure_checks] results: {'fault': 1, 'postgres': 0}
```
- `…_foreign_key_untouched` красный: прежний код считал готовую строку с
ключом `<база>/elsewhere/<id>` «метаданными без объекта» (HEAD чужого
префикса, с `--apply` — пометка), а зависшую с таким ключом —
`stale_pending` (уборка удалила бы объект по чужому ключу);
- оба теста W1 на прежнем коде зелёные: эти ветки были верны, замечание —
об их покрытии.
**13.1, W1 — `84f8c35` с двумя временными регрессиями** в
`src/core/services/attachment_reconcile.py` временного каталога:
`_recheck_orphan` без проверки ссылок (`references = []`) и `_act`,
пропускающий при отказе по пределу и зависшие загрузки (`if
state.refused: continue`), 18:16:04–18:17:05:
```
$ python3 student-tests/run_failures.py -k "referenced_objects or limit_keeps_cleanup"
student-tests/test_failures.py::test_reconcile_keeps_referenced_objects FAILED [ 50%]
student-tests/test_failures.py::test_reconcile_limit_keeps_cleanup FAILED [100%]
E Differing items:
E {'messenger/attachments/d39923b2-57c5-4e3d-8d86-0967932df378/original': 'orphan_object'} != {'messenger/attachments/d39923b2-57c5-4e3d-8d86-0967932df378/original': 'unknown_object'}
student-tests/test_failures.py:1884: AssertionError
E AssertionError: assert {} == {'50635edf-66...tale_pending'}
E Right contains 1 more item:
E {'50635edf-667c-44a7-878c-ea7298b94ef6': 'stale_pending'}
student-tests/test_failures.py:1950: AssertionError
====================== 2 failed, 244 deselected in 41.34s ======================
[failure_checks] postgres log: 59 lines, crash markers 0; "too many clients" 0, "administrator command" 0
[failure_checks] results: {'fault': 1, 'postgres': 0}
```
- без проверки ссылок объект `<Z>/original`, на который ссылается Y, стал
«объектом без метаданных» (`orphan_object`) — тест ловит удаление
используемого объекта;
- при уборке зависших под пределом P не убрана (ни одной записи
`removed_pending`) — тест ловит остановку уборки отказом по пределу.
Те же три теста на `84f8c35` без регрессий — зелёные в полном прогоне
выше (48 из 48).
## Простой S3 после скачиваний (change `fix-upload-put-flake`, 2026-10-22)
Спек `attachments`, «Загрузка после простоя S3»; design change
`fix-upload-put-flake`, решение 3. `test_upload_after_idle_s3` ходит
только по HTTP в четвёртый API стенда — «с коротким сроком S3»
(`<проект>-api-s3`, `S3__TIMEOUT_SECONDS=1`, тест сверяет `FAULT_S3_ENV`).
Один раз загружается PNG из шума ~4 MiB. Раунд (до 8): 10 одновременных
скачиваний за барьером, у каждого своё соединение, 2 мс на блок 64 KiB,
байты равны загруженным; простой 1,5 с без запросов к этому API; 12
загрузок `sample.png` по одной — каждая 201.
Вывод в обоих наборах отфильтрован: `grep -E "failure_checks\]|AssertionError|passed|failed|ReadTimeoutError"`
(красные) и `grep -E "ready:|passed|failed|results|Error"` (зелёные).
### Красный: `4cfaab0` — тест есть, правки клиента нет
Три прогона подряд, 22:05:16–22:06:30 UTC, каждый — `make: ***
[failure_checks] Error 1`, `results: {'fault': 1, 'postgres': 0}`:
| Прогон | Начало (UTC) | Отказ | pytest | журнал `api-s3` |
|---|---|---|---|---|
| 1 | 22:05:16 | раунд 1, загрузка 4 — 503 `unavailable` | 1 failed, 2,85 с | `put_object`, `ReadTimeoutError`, `duration_ms` 1 |
| 2 | 22:05:42 | раунд 1, загрузка 8 — 503 `unavailable` | 1 failed, 2,77 с | то же, `duration_ms` 1 |
| 3 | 22:06:05 | раунд 1, загрузка 3 — 503 `unavailable` | 1 failed, 2,81 с | то же, `duration_ms` 1 |
Прогон 1 целиком (после фильтра; `user_id` и `instance_id` из стенда
отказов, удалённого после прогона):
```
$ make failure_checks FAULT_ARGS='-k idle_s3'
[failure_checks] project=mtusi-lab4-failures (working stand: mtusi-lab4)
[failure_checks] build image
[failure_checks] start postgres, valkey and s3
[failure_checks] migrations
[failure_checks] s3 bootstrap
s3-bootstrap-1 | s3-bootstrap: checks passed (api key put/get; cleaner key get/delete and list messenger/attachments/; api key list and bucket create, cleaner key put and list of the bucket, anonymous get and list denied)
[failure_checks] start cleaner: grace 20 s, interval 1 s, reconcile interval 0 s (0 — off)
[failure_checks] start api containers
[failure_checks] ready: api=http://127.0.0.1:62495 tight=http://127.0.0.1:62511 uploads=http://127.0.0.1:62518 s3=http://127.0.0.1:62523
[failure_checks] pytest -m fault
E AssertionError: POST /api/v1/chats/903973d2-0a88-4ced-b95f-de23cdb98e11/attachments: round 1, upload 4 after 1.5s of S3 idle; got 503 {"error":{"code":"unavailable","message":"Service is temporarily unavailable","request_id":"ef84c2de12e94fa2942742e25740b2b0"}}
student-tests/test_failures.py:1575: AssertionError
====================== 1 failed, 246 deselected in 2.85s =======================
[failure_checks] postgres log: 56 lines, crash markers 0; "too many clients" 0, "administrator command" 0
[failure_checks] last 50 lines of mtusi-lab4-failures-api
[failure_checks] last 50 lines of mtusi-lab4-failures-api-tight
[failure_checks] last 50 lines of mtusi-lab4-failures-api-uploads
[failure_checks] last 50 lines of mtusi-lab4-failures-api-s3
{"request_id": "ef84c2de12e94fa2942742e25740b2b0", "event": "Object storage is unavailable", "user_id": "507576c5-cec4-4664-be65-f839571e5e82", "instance_id": "d9978707c495", "module": "object_storage", "operation": "put_object", "endpoint": "s3:8333", "bucket": "messenger", "key": "messenger/attachments/0b6a8404-60d0-4858-9884-2f306b399c96/original", "duration_ms": 1, "error_type": "ReadTimeoutError", "level": "warning", "timestamp": "2026-10-22T22:05:38.812050Z", "filename": "client.py", "lineno": 447, "func_name": "_failure"}
[failure_checks] last 50 lines of mtusi-lab4-failures-cleaner-scheduled
[failure_checks] last 50 lines of cleaner
[failure_checks] cleanup
[failure_checks] results: {'fault': 1, 'postgres': 0}
make: *** [failure_checks] Error 1
```
Прогоны 2 и 3 — тот же вывод, отличаются строки:
```
RUN 2: AssertionError: POST /api/v1/chats/1802f339-64e7-468b-8bb2-9bcb4bd515d8/attachments: round 1, upload 8 after 1.5s of S3 idle; got 503 {"error":{"code":"unavailable",…,"request_id":"de66e584746746a5a1ea740c88caf324"}}
RUN 2: {"request_id": "de66e584746746a5a1ea740c88caf324", "event": "Object storage is unavailable", …, "operation": "put_object", …, "duration_ms": 1, "error_type": "ReadTimeoutError", "level": "warning", "timestamp": "2026-10-22T22:06:01.316433Z", …}
RUN 3: AssertionError: POST /api/v1/chats/04b230fc-2cc0-4296-8924-f7429118a2b2/attachments: round 1, upload 3 after 1.5s of S3 idle; got 503 {"error":{"code":"unavailable",…,"request_id":"8a379890584b408391cb6b5951062ee5"}}
RUN 3: {"request_id": "8a379890584b408391cb6b5951062ee5", "event": "Object storage is unavailable", …, "operation": "put_object", …, "duration_ms": 1, "error_type": "ReadTimeoutError", "level": "warning", "timestamp": "2026-10-22T22:06:26.971178Z", …}
```
Каждый раз — уже первый раунд: порча чаще, чем p ≈ 0,28 пробы propose,
оценка промаха 8 раундов в докстринге (≈ 4e-12) консервативна. 503 за
1 мс — не срок вызова (1 с), а соединение пула, испорченное сроком
чтения aiohttp (`evidence/s3/idle-connection.md`).
### Зелёный: `b5983f0` — `read_timeout=None`
```
=== RUN 1 2026-10-22T22:14:35Z
[failure_checks] ready: api=http://127.0.0.1:63927 tight=http://127.0.0.1:63930 uploads=http://127.0.0.1:63935 s3=http://127.0.0.1:63962
====================== 1 passed, 246 deselected in 17.03s ======================
[failure_checks] results: {'fault': 0, 'postgres': 0}
=== RUN 2 2026-10-22T22:15:19Z
[failure_checks] ready: api=http://127.0.0.1:64099 tight=http://127.0.0.1:64104 uploads=http://127.0.0.1:64114 s3=http://127.0.0.1:64128
====================== 1 passed, 246 deselected in 16.49s ======================
[failure_checks] results: {'fault': 0, 'postgres': 0}
=== RUN 3 2026-10-22T22:16:00Z
[failure_checks] ready: api=http://127.0.0.1:64328 tight=http://127.0.0.1:64333 uploads=http://127.0.0.1:64338 s3=http://127.0.0.1:64343
====================== 1 passed, 246 deselected in 16.77s ======================
[failure_checks] results: {'fault': 0, 'postgres': 0}
```
8 раундов × (скачивания + 1,5 с простоя + 12 загрузок) ≈ 17 с, все 96
загрузок — 201. Полный прогон того же commit — 49 из 49 (раздел «Прежний
снимок: `723b6c3`»). После каждого прогона контейнеров и volumes проекта
`mtusi-lab4-failures` нет, docker volumes — 155.
## Красный прогон до кода `track2-reconcile-cost` (apply, 2026-10-23)
Задача 1.3 change: тесты групп 2–4 уже в дереве, а код —
`7f4e626`, последний commit до change. Прогон начался 2026-10-23 в
00:52 UTC. Ожидание — падают все пять новых проверок, каждая по своей
причине. Ниже — строки pytest и строки `E` каждой проверки (traceback,
журналы API и уборщика опущены), путь к рабочему каталогу заменён на
`…`.
```
$ make failure_checks FAULT_ARGS='-k "head_strategy or deep_checksum or restore_needs or rate_limit or limit_stops"'
python3 student-tests/run_failures.py -k "head_strategy or deep_checksum or restore_needs or rate_limit or limit_stops"
[failure_checks] project=mtusi-lab4-failures (working stand: mtusi-lab4)
…
[failure_checks] pytest -m fault
collecting ... collected 252 items / 247 deselected / 5 selected
student-tests/test_failures.py::test_reconcile_head_strategy_same_findings FAILED [ 20%]
student-tests/test_failures.py::test_reconcile_deep_checksum FAILED [ 40%]
student-tests/test_failures.py::test_reconcile_restore_needs_same_bytes FAILED [ 60%]
student-tests/test_failures.py::test_reconcile_rate_limit FAILED [ 80%]
student-tests/test_failures.py::test_reconcile_limit_stops_rechecks FAILED [100%]
__________________ test_reconcile_head_strategy_same_findings __________________
> assert head.kinds(FOUND, ids=ids, keys=keys.values()) == expected
E AssertionError: assert {} == {'messenger/a...ismatch', ...}
E Right contains 5 more items:
E {'0234ecaa-6e55-4776-8659-d3af27a60292': 'stale_pending',
E '1180cb24-5584-4bd0-a931-5f11067a858e': 'missing_object',
E '7bf4df74-37c8-436a-8a90-f7c1a0356082': 'size_mismatch',
E 'messenger/attachments/5a41bab0-6f81-4777-9dea-8a662b6811a6/original': 'orphan_object',
E 'messenger/attachments/7164a0e0-747b-4f5f-919e-6ba7213edb8d/original': 'orphan_object'}...
_________________________ test_reconcile_deep_checksum _________________________
> assert shallow.finished["deep"] is False
E KeyError: 'deep'
___________________ test_reconcile_restore_needs_same_bytes ____________________
wrong = run_reconcile(stand, "apply")
> assert not wrong.about(FIXED, ids=ids)
E AssertionError: assert not [{'event': 'Fixed storage discrepancy', 'instance_id': 'b19a29def666', 'module': 'attachment_reconcile_service', 'method': 'reconcile', ...}]
__________________________ test_reconcile_rate_limit ___________________________
> (record,) = self.events(FINISHED)
E ValueError: not enough values to unpack (expected 1, got 0)
_____________________ test_reconcile_limit_stops_rechecks ______________________
> assert error["changes"] == limit + 1, error
E AssertionError: {'event': 'Reconcile changes exceed limit', 'instance_id': 'f2ffbe88ca96', 'module': 'attachment_reconcile_service', 'method': 'reconcile', ...}
E assert 7 == (2 + 1)
================ 5 failed, 247 deselected in 117.17s (0:01:57) =================
[failure_checks] postgres log: 59 lines, crash markers 0; "too many clients" 0, "administrator command" 0
…
[failure_checks] results: {'fault': 1, 'postgres': 0}
make: *** [failure_checks] Error 1
```
Причины — те, что ожидались:
- `head` и предел скорости: прежний уборщик не знает `--strategy` и
`--max-objects-per-second`. Ошибка argparse (код 2), прохода и его
итога нет: пустой набор находок и нет «Finished reconcile pass»;
- глубокая: в итоге прохода нет поля `deep`;
- возврат оригинала: пометку снял объект того же размера с другими
байтами (прежний код сравнивал только размер);
- предел: прежний код перепроверил всех кандидатов, и в ошибке
`changes` 7, а не `max_changes + 1` = 3.
Стенд отказов после прогона убран. Зелёный прогон всех пяти на коде
change — раздел «Итог» в начале файла (вместе с остальными 49).
## Красный прогон тестов verify `track2-reconcile-cost` (2026-10-23)
Тесты по замечаниям verify W2 и S1 — в их окончательном виде (commit
`ca0c4b2`) — против `src` на `16f2cde`, коде до правки: дерево `git
archive 16f2cde` во временном каталоге, поверх — `student-tests/` из
`ca0c4b2`; образ `mtusi-messenger:lab4` собран `make failure_checks` из
этого дерева. 2026-10-23 ~17:00 UTC, стенд отказов — тот же проект
`mtusi-lab4-failures`. После — образ пересобран из `ca0c4b2` до замены
реплик и полного прогона выше. `.env` временного дерева — свои случайные
секреты, каталог удалён.
```
$ make failure_checks FAULT_ARGS='-k "row_with_other_id_key or fresh_overwrite_untouched"'
…
collecting ... collected 254 items / 252 deselected / 2 selected
student-tests/test_failures.py::test_reconcile_row_with_other_id_key FAILED [ 50%]
student-tests/test_failures.py::test_reconcile_fresh_overwrite_untouched FAILED [100%]
…
> assert own_findings(batch, FOUND, keys.values()) == expected
E AssertionError: assert {('unknown_ob...20e65b34a17')} == {('checksum_m...20e65b34a17')}
E Extra items in the right set:
E ('checksum_mismatch', 'messenger/attachments/a0ccf942-ff0b-4556-84bd-2d7488cd883c/original', 'b279c2a6-a273-42d7-8cf1-d2e8c81d9010')
E ('size_mismatch', 'messenger/attachments/c0a74af8-d37a-42dc-b03a-a20e65b34a17/original', '640601f0-ad14-4436-9af1-94f57dd06609')
…
> assert not run.about(FIXED, ids=ids), run.finished
E AssertionError: {'event': 'Finished reconcile pass', …}
E assert not [{'event': 'Fixed storage discrepancy', …}]
====================== 2 failed, 252 deselected in 44.01s ======================
…
[failure_checks] results: {'fault': 1, 'postgres': 0}
```
Причины — те, что ожидались:
- `…_row_with_other_id_key` (W2): `batch` не сравнил Y1 и Y2 с объектами
`<Z1>/original` и `<Z2>/original`, на которые они ссылаются: в его
отчёте только четыре чужих объекта, `size_mismatch` Y1 и
`checksum_mismatch` Y2 нет (стратегия `head` их находила);
- `…_fresh_overwrite_untouched` (S1): первый проход `--deep --apply`
пометил потерянным вложение, объект которого только что перезаписан
байтами другого размера: запись «Fixed storage discrepancy» —
`size_mismatch`, `marked_lost`, `size_bytes` 9332, `stored_size` 9333.
Первый красный прогон (16:30 UTC, дерево с `src` `16f2cde` до правки)
был с прежним видом `…_fresh_overwrite_untouched`: оба прохода в одном
окне grace. Падения те же. Тест поменян после него не из-за красного:
на коде с правкой два глубоких прохода подряд заняли 23,4 с, больше
grace стенда 20 с (глубокий проход читает весь bucket), и проверка
времени срабатывала раньше проверок сверки. Теперь объекты
перезаписываются перед каждым проходом. Поэтому этот красный прогон
снят заново с окончательной версией.
W1 (сигнал в паузе предела) тестом отказов не проверяется — hook не
шлёт сигнал посреди прохода. Красный и зелёный прогоны — `driver.py
reconcile-signal --pace [--apply]`, `evidence/reconcile/service.md`.