Report track 2 and check levels 3 and 4 after it

REPORT.md gets the track 2 section: what the reconciler does and why it
is safe, the hypotheses written before the first run, the method of the
demo and the cost matrix with its screening, both result tables, the
verdicts and the limits. H1 holds. H2 holds for the pass cost: time is
linear (t(30k)/t(10k) = 3.73, 3.05 in the series of 29.10), the listing
is 95 % of it, list requests are ceil(N/1000) and SQL one more for the
empty last keyset page, RSS stays at 82.5-83.8 MiB; --deep is 4.3-5
times dearer per object, not ten. The criteria table, the failure table,
the limits, AGENTS.md and the openspec context name the track rows, and
evidence/reconcile/README.md describes every file.

On a stand from a clean state make test, test-persistence,
test-failover, restore, reconcile, lint, check, validate and
student-test (342 passed) all pass; the dry-run after these scenarios
finds 3 objects, 3 rows and no discrepancy.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
This commit is contained in:
Artyom
2026-10-30 07:19:16 +03:00
co-authored by Claude Opus 5.5
parent 8cb5a664c6
commit 58cae16ef8
6 changed files with 363 additions and 11 deletions
+34
View File
@@ -0,0 +1,34 @@
# Трек 2 «Согласованность двух хранилищ»: сырые данные
Отчёты сверки — stdout `python -m messenger.attachments.entrypoints.reconcile` (поля описаны в
`openspec/specs/lab4-storage-reconciler/spec.md`) плюс `exit_code` и `wall_seconds` (время `docker compose run`
вместе со стартом контейнера). Независимая проверка — `scripts/reconcile_check.py`: листинг bucket через `rc`
под root-ключом, строки через `psql`, SHA-256 каждого объекта через `rc object show | sha256sum`, без кода API.
Время в JSON — UTC.
| Файл | Что внутри | Чем получен |
| --- | --- | --- |
| `demo.json` | итог сценария: коммит, внедрённые ключи и id по классам, 12 проверок с деталями, `ok` | `make reconcile-demo` |
| `ready-before.json`, `ready-untouched.json` | id → SHA-256 готовых вложений до внедрения; то же без повреждаемых — ожидаемый набор после `apply` | `reconcile_check.py --save-ready` |
| `check-before.json`, `check-after.json` | независимая проверка (`--deep`) после внедрения и после двух `apply` | `reconcile_check.py` |
| `dry-run.json`, `apply-1.json`, `apply-2.json` | `--dry-run --deep`, затем `--apply --deep` дважды, `--grace 60 --skew 0` | сервис `reconciler` |
| `healed.json` | `--apply` после возврата объекта вложения в карантине `missing` | сервис `reconciler` |
| `lock-busy.json` | проход, пока `pg_advisory_lock(20260004)` держит другой сеанс: `skipped` | сервис `reconciler` |
| `s3-down.json` | проход при остановленном `s3`: код, время, stdout, строки журнала `reconcile.*` | сервис `reconciler` |
| `ready-load.json` | id → SHA-256 всех вложений, которые должны пережить нагрузку: готовые до неё и каждое `201` под ней | `reconcile_track.py` |
| `under-load.json`, `check-under-load.json` | 75 с загрузок через LB (3 потока, каждое 10-е вложение — в сообщение) и `--apply` подряд: ответы, время проходов, исправленное, увиденное свежим; проверка `--deep --expect-ready` после | `reconcile_track.py` |
| `cost/n<N>-<режим>-<повтор>.json` | отчёт прохода `--dry-run` на N объектах и строках; режимы `shallow` (страница 1000), `deep` (`--deep`), `page100` (страница 100); `screen` — чужая нагрузка CPU за окно прогона | `make reconcile-cost` |
| `cost/disturbed/*.json` | отбракованные прогоны (чужого CPU больше 2 ядер во всей VM или 0,25 на закреплённых ядрах сверх запуска контейнера); каждый повторён после 15 с тишины | `make reconcile-cost` |
| `cost/summary.json`, `cost/summary.txt` | медианы трёх прогонов на точку, запросы, RSS, CPU, наибольшая чужая нагрузка, число отбракованных; закрепление CPU и лимиты `s3`/`postgres`; время наполнения | `make reconcile-cost` |
| `cost/host-docker-stats.txt` | `docker stats --all` и `docker ps` всего хоста до и после серии, loadavg macOS | `make reconcile-cost` |
| `cost-2026-10-29/` | первая полная серия той же матрицы (`5ca2cdc`, 29.10): без отбраковки и без `cpu_seconds`, рядом шёл k6 другой лабы; для сравнения между днями, `NOTE.txt` | `make reconcile-cost` на `5ca2cdc` |
| `after-checks.txt` | после трека на стенде из чистого состояния: `make test`, `test-persistence`, `test-failover`, `restore`, `reconcile`, `lint`, `check`, `validate`, `student-test` | команды внутри файла |
| `cost-aborted/` | две прерванные попытки наполнить RustFS до 100k объектов и их точки 1k/10k; диагноз — `NOTE.txt` | `make reconcile-cost` до `5ca2cdc` |
Поля `screen`: `window_seconds` — окно между двумя чтениями счётчиков VM (`/proc/uptime`), `ours_cores` — CPU
`s3`, `postgres` и процесса сверки за окно, `other_cores` и `other_on_pinned_cores` — чужой CPU во всей VM и на
ядрах `s3`/`postgres`/`reconciler` сверх запуска контейнера (1,5 и 0,5 ядро·с), в ядрах, `disturbed` — прогон
отбракован. Итоговая серия снята на `b191623`: её `summary.json` записывает пороги, но не запас на запуск
контейнера и число повторов — это значения по умолчанию сценария этого коммита (1,5 и 0,5 ядро·с, 3 повтора);
начиная с `8cb5a66` они пишутся в `summary.json`. Объём данных в матрице — синтетические вложения
`student-tests/tools/seed_storage.py` (PNG 8 × 8, 264 B, строки `ready` двухчасовой давности).
+150
View File
@@ -0,0 +1,150 @@
date: 2026-10-30T04:08:39Z commit: 8cb5a66 стенд из чистого состояния: make reset-data && make up
$ make test
python3 tests/smoke.py --base-url "http://127.0.0.1:18084"
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
exit=0
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:18084"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
exit=0
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:18084"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 128, "failed_attempts": 0, "first_recovery_seconds": 2.704}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
exit=0
$ make restore
scripts/restore.sh
Container mtusi2026lab4-api-1 Running
Container mtusi2026lab4-api-2 Starting
Container mtusi2026lab4-api-2 Started
Container mtusi2026lab4-api-1 Waiting
Container mtusi2026lab4-api-2 Waiting
Container mtusi2026lab4-api-1 Healthy
Container mtusi2026lab4-api-2 Healthy
exit=0
$ make reconcile
docker compose run --rm --no-deps reconciler
{
"mode": "dry-run",
"skipped": false,
"grace_seconds": 3600,
"skew_seconds": 60,
"deep": false,
"page_size": 1000,
"scanned": {
"objects": 3,
"rows": 3
},
"found": {
"orphan_stale": 0,
"orphan_fresh": 0,
"missing": 0,
"size_mismatch": 0,
"sha_mismatch": 0,
"pending_stale": 0,
"pending_fresh": 0,
"quarantined": 0,
"healed": 0
},
"fixed": {
"orphan_stale": 0,
"missing": 0,
"size_mismatch": 0,
"sha_mismatch": 0,
"pending_stale": 0,
"healed": 0
},
"rechecked": {},
"errors": 0,
"samples": {},
"cost": {
"seconds": 0.019,
"requests": {
"s3_list": 1,
"s3_head": 0,
"s3_get": 0,
"s3_delete": 0,
"sql": 1
},
"waited_seconds": {
"s3_list": 0.01,
"sql": 0.003
},
"hashed_bytes": 0,
"cpu_seconds": 0.455,
"max_rss_mib": 80.3
}
}
exit=0
$ make lint
.venv/bin/ruff check src student-tests scripts/probe.py scripts/limits.py scripts/lab4_scenarios.py scripts/lab4_seed.py scripts/upload_memory.py scripts/reconcile_check.py scripts/reconcile_track.py
All checks passed!
.venv/bin/ruff format --check src student-tests scripts/probe.py scripts/limits.py scripts/lab4_scenarios.py scripts/lab4_seed.py scripts/upload_memory.py scripts/reconcile_check.py scripts/reconcile_track.py
143 files already formatted
.venv/bin/ty check src student-tests
All checks passed!
exit=0
$ make check
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
exit=0
$ make validate
.venv/bin/python scripts/validate_openapi.py
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
exit=0
$ make student-test
.venv/bin/pytest
============================= test session starts ==============================
platform darwin -- Python 3.14.5, pytest-9.1.1, pluggy-1.6.0
rootdir: <repo>
configfile: pyproject.toml
testpaths: student-tests
plugins: asyncio-1.4.0, anyio-4.15.1
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collected 359 items / 17 deselected / 342 selected
student-tests/adapters/test_s3_storage.py ... [ 0%]
student-tests/api/test_access.py ......... [ 3%]
student-tests/api/test_attachments.py .................................. [ 13%]
... [ 14%]
student-tests/api/test_bounded_contexts.py .................. [ 19%]
student-tests/api/test_cache.py ...... [ 21%]
student-tests/api/test_concurrency.py .... [ 22%]
student-tests/api/test_consistency.py ........ [ 24%]
student-tests/api/test_drain.py .. [ 25%]
student-tests/api/test_events.py ...... [ 27%]
student-tests/api/test_idempotency.py ............... [ 31%]
student-tests/api/test_instance.py .... [ 32%]
student-tests/api/test_message_attachments.py ........... [ 35%]
student-tests/api/test_migrations.py ....... [ 38%]
student-tests/api/test_negative.py ..................................... [ 48%]
[ 48%]
student-tests/api/test_operability.py .............. [ 52%]
student-tests/api/test_pagination.py .................. [ 58%]
student-tests/api/test_pool.py .. [ 58%]
student-tests/api/test_reconciler.py ...... [ 60%]
student-tests/api/test_sessions.py .................. [ 65%]
student-tests/api/test_timeout.py ...... [ 67%]
student-tests/api/test_upload_consistency.py ......... [ 70%]
student-tests/api/test_wire_format.py .. [ 70%]
student-tests/unit/test_attachments_domain.py .......................... [ 78%]
. [ 78%]
student-tests/unit/test_authentication.py ..................... [ 84%]
student-tests/unit/test_cursor.py ........... [ 88%]
student-tests/unit/test_domain.py ...................................... [ 99%]
.. [ 99%]
student-tests/unit/test_timeouts.py . [100%]
===================== 342 passed, 17 deselected in 38.62s ======================
exit=0