Files
mtusi2026lab2/openspec/changes/archive/2026-10-30-add-lab4-storage-reconciler/tasks.md
T
ArtyomandClaude Opus 5.5 81dd816df2 Archive the storage reconciler change
Track 2 of lab 4 is closed. One reconciler pass merges the sorted bucket
listing with keyset pages of attachments by object key, finds objects
without a row, ready rows without an object or with other bytes and
abandoned intents, deletes only old objects without a row after a
second look at the row and old intents under SKIP LOCKED, and puts
damaged ready rows into a reversible quarantine instead of deleting
them. On the stand the dry-run found exactly the 22 injected
discrepancies of seven classes, apply fixed the 18 fixable ones, the
repeat did nothing, and 75 passes during 3418 uploads lost no ready
attachment. A shallow pass costs 0.105 / 1.000 / 3.729 s for 1k / 10k /
30k objects at a flat 83 MiB, 95 % of it in the RustFS listing; --deep
is 4.3-5 times dearer per object.

For the defence: make reconcile-demo shows injection, dry-run, apply,
the repeat, quarantine through the API, healing, the held lock, a
stopped S3 and the run under uploads in about four minutes; the cost
matrix is evidence/reconcile/cost/summary.txt (make reconcile-cost
repeats it on a fresh stand in about seven).

The lab4-storage-reconciler spec is added and the quarantine rule of
lab4-attachments is updated in the main specs.

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

47 lines
4.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 1. Схема и миграции
- [x] 1.1 `0004_attachment_quarantine.sql`: `quarantine_reason` с `CHECK`, `quarantined_at`, согласованность пары
- [x] 1.2 Проверка группы: `make student-test` (`test_migrations.py`: повтор без изменений)
## 2. Зона `attachments`: домен и приложение
- [x] 2.1 Домен: `Quarantine`, поле `quarantine` агрегата
- [x] 2.2 Порты: `StoredObject`, `ObjectStorage.listing/stat`, `AttachmentRepository.page_after/by_key/claim/mark`, `SingleRun`; команда `ReconcileStorage`
- [x] 2.3 `StorageReconciler`: слияние потоков, классы, повторные проверки, действия, `--deep` под ограничением, отчёт `Reconciliation`
- [x] 2.4 `OpenAttachment`: карантин → `404` без S3
- [x] 2.5 Проверка группы: `make lint`
## 3. Зона `attachments`: адаптеры и точка входа
- [x] 3.1 Адаптер S3: листинг страницами, `HEAD`; адаптер PostgreSQL: колонка карантина, keyset, по ключу, `SKIP LOCKED`, `UPDATE` карантина, `PostgresSingleRun`
- [x] 3.2 Платформа: поток журнала настраивается
- [x] 3.3 CLI `messenger.attachments.entrypoints.reconcile`: флаги, сборка адаптеров, JSON в stdout, коды выхода
- [x] 3.4 Проверка группы: API-тесты сверки против одноразового PostgreSQL (каждый класс в dry-run без изменений, apply и повтор = 0, свежее и используемое сохранены, строка появилась после листинга, карантин и `404`, `healed`, `--deep`, занятая блокировка); тест адаптера против RustFS (порядок листинга, страницы, `HEAD`)
- [x] 3.5 Отказ зависимости посреди прохода завершает его исключением `Unavailable`, а не группой исключений `TaskGroup`: журнал `reconcile.failed`, код `1`; API-тест сбоя листинга на второй странице
## 4. Стенд
- [x] 4.1 `compose.yaml`: сервис `reconciler` (профиль `reconcile`), `cpuset` из переменных у `s3`, `postgres`, `reconciler`; `.env.example`
- [x] 4.2 Цели `make reconcile ARGS=…`, `make reconcile-demo`, `make reconcile-cost`
- [x] 4.3 Проверка группы: `docker compose config --quiet`, `make up`, `make reconcile`
## 5. Обвязка трека
- [x] 5.1 `scripts/reconcile-inject.sh` и `scripts/reconcile_check.py` из заготовки
- [x] 5.2 `student-tests/tools/seed_storage.py`: наполнение N объектов и строк в образе API
- [x] 5.3 `scripts/reconcile_track.py`: `demo` (внедрение, dry-run, apply ×2, безопасность, `healed`, нагрузка) и `cost` (снимок хоста, закрепление CPU, матрица N × режим × 3)
- [x] 5.4 Проверка группы: `make check` (Python 3.9, JSON), `make lint`
- [x] 5.5 Процессорное время прохода в отчёте; `cost`: снимок `docker stats` хоста до и после серии, чужой CPU за окно каждого прогона (во всей VM и на закреплённых ядрах), отбраковка и повтор после тишины, отбракованные — в `cost/disturbed/`
- [x] 5.6 `demo`: проход при остановленном S3 — код `1` за ограниченное время, PostgreSQL и bucket не меняются
## 6. Измерения
- [x] 6.1 `make reconcile-demo` на чистом стенде → `evidence/reconcile/`
- [x] 6.2 `make reconcile-cost` на чистом стенде → `evidence/reconcile/cost/`
- [x] 6.3 Проверка группы: критерии H1 и H2 из `design.md`
## 7. Отчёт
- [x] 7.1 `REPORT.md`: раздел трека 2 (гипотеза, методика, результаты, ограничения, выводы), строки трека в таблице доказательств и отказов; `AGENTS.md`
- [x] 7.2 Проверка группы: `make check`, `make lint`, `make student-test`, `make test`, `make test-persistence ACTION_SCRIPT=scripts/restart.sh`, `make test-failover ACTION_SCRIPT=scripts/stop-one.sh`