docs: report reconcile cost results and evidence

Add the baseline label results to REPORT.md: H1, H2, H3 and S4
confirmed, H4 not verified (the fast-unlimited contrast did not
saturate S3, r 1.08). Keep 2000 objects/s as a bound on the S3 share
and give head/deep limits by S3 CPU per object. Refresh failure_checks
(54/54, red run of task 1.3), test_isolated and the pace stop evidence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 19:14:08 +03:00
co-authored by Claude Opus 5.5
parent 0072dbee94
commit 16f2cdeddb
7 changed files with 595 additions and 26 deletions
+190 -5
View File
@@ -1,5 +1,126 @@
# `make failure_checks`: проверки отказов с уборщиком, согласованностью БД и S3, местами загрузки, сверкой и простоем S3
- Дата: 2026-10-23, ~15:55–16:07:13 UTC.
- Commit: `0072dbe` (change `track2-reconcile-cost`: код — `8d4cf7e`,
после него `src` не менялся; `d8b8ae3` и `0072dbe` — проверка строк
стенда `bench/` и каталог метки). Рабочее дерево чистое, образ
`mtusi-messenger:lab4` собран из него.
- Стенд отказов — как в снимке `723b6c3` ниже: проект
`mtusi-lab4-failures`, свои PostgreSQL, Valkey и S3 с bootstrap,
уборщик с grace 20 с, интервалом 1 с и без плановой сверки, четыре
API. Рабочий стенд `mtusi-lab4` в это время запущен на том же образе
(`make run_docker APP_OUT_PORT=8090`: реплики `api-27`, `api-28`,
уборщик, LB на `127.0.0.1:8090`), до и после прогона — те же
контейнеры.
- +5 проверок change `track2-reconcile-cost`:
`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`. Их красный прогон на коде до
change — раздел «Красный прогон до кода `track2-reconcile-cost`» в
конце файла.
## Итог: код 0, 54 из 54
Код команды — 0, pytest — 712 с (49 из 49 за 552 с в снимке
`723b6c3`: +5 проверок сверки, ~2,5 мин — ожидания grace стенда). Ниже
— вывод от запуска 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:51536 tight=http://127.0.0.1:51544 uploads=http://127.0.0.1:51549 s3=http://127.0.0.1:51555
[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 252 items / 198 deselected / 54 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 [ 9%]
student-tests/test_failures.py::test_pool_exhausted PASSED [ 11%]
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 [ 18%]
student-tests/test_failures.py::test_readiness_without_object_storage[stop] PASSED [ 20%]
student-tests/test_failures.py::test_readiness_without_object_storage[pause] PASSED [ 22%]
student-tests/test_failures.py::test_flush_cache PASSED [ 24%]
student-tests/test_failures.py::test_valkey_stopped PASSED [ 25%]
student-tests/test_failures.py::test_valkey_paused PASSED [ 27%]
student-tests/test_failures.py::test_valkey_back PASSED [ 29%]
student-tests/test_failures.py::test_message_failure_keeps_key_free PASSED [ 31%]
student-tests/test_failures.py::test_database_outage_keeps_key_free PASSED [ 33%]
student-tests/test_failures.py::test_key_free_after_ttl PASSED [ 35%]
student-tests/test_failures.py::test_upload_with_object_storage_stopped PASSED [ 37%]
student-tests/test_failures.py::test_rejected_uploads_leave_nothing PASSED [ 38%]
student-tests/test_failures.py::test_metadata_insert_failure PASSED [ 40%]
student-tests/test_failures.py::test_interrupted_body PASSED [ 42%]
student-tests/test_failures.py::test_ready_failure_compensated PASSED [ 44%]
student-tests/test_failures.py::test_killed_between_put_and_ready PASSED [ 46%]
student-tests/test_failures.py::test_ready_commit_outcome_unknown PASSED [ 48%]
student-tests/test_failures.py::test_upload_outlives_grace PASSED [ 50%]
student-tests/test_failures.py::test_cleaner_failure_after_object_delete PASSED [ 51%]
student-tests/test_failures.py::test_cleaner_survives_outages PASSED [ 53%]
student-tests/test_failures.py::test_object_storage_stopped PASSED [ 55%]
student-tests/test_failures.py::test_environment_does_not_change_limits PASSED [ 57%]
student-tests/test_failures.py::test_object_storage_paused PASSED [ 59%]
student-tests/test_failures.py::test_upload_slots_busy PASSED [ 61%]
student-tests/test_failures.py::test_rejections_before_queue PASSED [ 62%]
student-tests/test_failures.py::test_upload_waits_for_slot PASSED [ 64%]
student-tests/test_failures.py::test_slot_released_after_failures PASSED [ 66%]
student-tests/test_failures.py::test_slow_body PASSED [ 68%]
student-tests/test_failures.py::test_upload_after_idle_s3 PASSED [ 70%]
student-tests/test_failures.py::test_reconcile_finds_and_fixes PASSED [ 72%]
student-tests/test_failures.py::test_reconcile_keeps_fresh_used_and_unknown PASSED [ 74%]
student-tests/test_failures.py::test_reconcile_restored_original PASSED [ 75%]
student-tests/test_failures.py::test_reconcile_change_limit PASSED [ 77%]
student-tests/test_failures.py::test_reconcile_keeps_referenced_objects PASSED [ 79%]
student-tests/test_failures.py::test_reconcile_limit_keeps_cleanup PASSED [ 81%]
student-tests/test_failures.py::test_reconcile_foreign_key_untouched PASSED [ 83%]
student-tests/test_failures.py::test_reconcile_object_storage_stopped PASSED [ 85%]
student-tests/test_failures.py::test_reconcile_interrupted_by_database PASSED [ 87%]
student-tests/test_failures.py::test_reconcile_under_load PASSED [ 88%]
student-tests/test_failures.py::test_scheduled_reconcile PASSED [ 90%]
student-tests/test_failures.py::test_reconcile_head_strategy_same_findings PASSED [ 92%]
student-tests/test_failures.py::test_reconcile_deep_checksum PASSED [ 94%]
student-tests/test_failures.py::test_reconcile_restore_needs_same_bytes PASSED [ 96%]
student-tests/test_failures.py::test_reconcile_rate_limit PASSED [ 98%]
student-tests/test_failures.py::test_reconcile_limit_stops_rechecks PASSED [100%]
==================================== PASSES ====================================
================ 54 passed, 198 deselected in 712.49s (0:11:52) ================
[failure_checks] postgres log: 461 lines, crash markers 0; "too many clients" 30, "administrator command" 147
[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 стенда отказов и
@@ -33,8 +154,6 @@
(раздел «Простой S3 после скачиваний») к `84f8c35`, ~17 с, остальное —
разброс хоста.
## Итог: код 0, 49 из 49
Вывод полный, без фильтра. Обезличено только одно: путь к рабочему
каталогу в строках `platform` и `rootdir` pytest заменён на `…`. Ещё
убран управляющий символ терминала перед `s3-bootstrap-1 exited`.
@@ -891,6 +1010,72 @@ RUN 3: {"request_id": "8a379890584b408391cb6b5951062ee5", "event": "Object stora
```
8 раундов × (скачивания + 1,5 с простоя + 12 загрузок) ≈ 17 с, все 96
загрузок — 201. Полный прогон того же commit — 49 из 49 (раздел «Итог»).
После каждого прогона контейнеров и volumes проекта `mtusi-lab4-failures`
нет, docker volumes — 155.
загрузок — 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).
+55 -3
View File
@@ -3,7 +3,7 @@
- Спек `student-tests`: «Прогон на временной базе» (уборка префикса
`test_<db>/`, «Хвост прошлого прогона», «Сохранить базу для разбора»).
Design change `s3-storage`, решение 9 и «Уточнения apply», п. 11.
- Раздел 0 — пересъёмка после change `fix-upload-put-flake` (зелёная).
- Раздел 0 — пересъёмка после change `track2-reconcile-cost` (зелёная).
Разделы 1–3 сняты на `f57635a` (change `s3-storage`): механизм уборки с
тех пор не менялся (`student-tests/run_isolated.py`), а красное в них —
ожидаемое до `attachments`, как сказано ниже. Прежние снимки раздела
@@ -13,9 +13,61 @@
/ 36; `ce1ae2c` (change `upload-memory`) — 193 passed, 5 skipped, 37
deselected, сверка 227 / 210 / 45 / 17; `c1648d9` (change
`track2-reconciler`) — 193 passed, 5 skipped, 45 deselected, сверка
240 / 223 / 58 / 17.
240 / 223 / 58 / 17; `723b6c3` (change `fix-upload-put-flake`) — 193
passed, 5 skipped, 49 deselected, сверка 244 / 227 / 62 / 17.
## 0. Пересъёмка: код 0 (change `fix-upload-put-flake`)
## 0. Пересъёмка: код 0 (change `track2-reconcile-cost`)
- Дата: 2026-10-23, 16:10:04–16:11:55 UTC.
- Commit: `0072dbe`, рабочее дерево — только evidence и документы этой
задачи, вне кода (`src`, `student-tests`, `Dockerfile` не менялись).
Код приложения — `8d4cf7e`.
- Что изменилось с `723b6c3`:
- пять новых проверок отказов сверки и 6 сценариев спеков, покрытых
проверками отказов (`deselected` 54 вместо 49, сверка 250 / 233 /
68 / 17);
- тестов вне `fault` столько же — 193 и 5 пропусков,
`test_exclusion_evidence_exists` зелёный.
- Стенд: рабочий `mtusi-lab4` на образе этого кода (сборка из кэша; `make run_docker
APP_OUT_PORT=8090`: реплики `api-27`, `api-28`, уборщик), в остальном
— как в снимке ниже.
```
$ make test_isolated
[test_isolated] database=test_messenger objects=/buckets/messenger/test_messenger/ container=mtusi-lab4-test-api base_url=http://127.0.0.1:18088
[test_isolated] remove objects /buckets/messenger/test_messenger/
[test_isolated] build image
[test_isolated] create database test_messenger
[test_isolated] migrations
[test_isolated] start api container
[test_isolated] ready
[test_isolated] make test
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
[test_isolated] make student_test
coverage: 250 scenarios in 13 specs, 233 tested (68 by make failure_checks), 17 excluded
SKIPPED [1] student-tests/test_attachments.py:701: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
SKIPPED [1] student-tests/test_idempotency.py:372: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
SKIPPED [1] student-tests/test_load_balancing.py:18: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
SKIPPED [1] student-tests/test_load_balancing.py:34: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
SKIPPED [1] student-tests/test_race.py:169: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
=========== 193 passed, 5 skipped, 54 deselected in 98.15s (0:01:38) ===========
[test_isolated] cleanup
[test_isolated] remove objects /buckets/messenger/test_messenger/
[test_isolated] results: {'test': 0, 'student_test': 0}
exit=0
$ printf 'fs.ls /buckets/messenger/test_messenger\n' | docker compose exec -T s3 sh -c "exec weed shell -master=127.0.0.1:9333 2>&1" | wc -l
0
$ psql … -d postgres -tAc "SELECT count(*) FROM pg_database WHERE datname = 'test_messenger'"
0
$ docker ps -a --filter name=mtusi-lab4-test-api -q | wc -l
0
```
Вывод отфильтрован: строки `Container …` compose, сборка образа и
построчный список pytest опущены. Префикс `test_messenger/` пуст,
временной базы и контейнера нет.
## Прежний снимок: `723b6c3`, код 0 (change `fix-upload-put-flake`)
- Дата: 2026-10-22, 23:15:18–23:17:11 UTC.
- Commit: `723b6c3`, рабочее дерево чистое (до записи этого файла). Код