Propose hardening the storage reconciler as an openspec change

The review of track 2 found that a pass without --deep released the
quarantine of a missing or resized attachment as soon as an object of
the same size reappeared, without checking its SHA-256; that the keyset
read an empty last page, one SQL request more than the spec promised;
that the discarded intents of a pass never reached the audit journal;
that the entry point duplicated the S3 client wiring and printed a
traceback for any failure other than Unavailable; and that the cost
matrix stopped at 30k while the preregistered H2 was about 100k.

The change hashes the object of a quarantined row before releasing it,
reads page + 1 rows, assembles the reconciler with dishka and publishes
its events, turns any pass failure into reconcile.failed, links the
injected orphans to the found ones by key and measures up to 100k.

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 08:56:15 +03:00
co-authored by Claude Opus 5.5
parent adca7c6edc
commit b6c04f2296
5 changed files with 159 additions and 0 deletions
@@ -0,0 +1,29 @@
## 1. Зона `attachments`: приложение
- [ ] 1.1 `Pass`: хеширование объекта строки в карантине с совпавшим размером и без `--deep`; `_healthy` только после совпавшего хеша
- [ ] 1.2 `Pass._rows`: выборка `страница + 1`, без пустой страницы
- [ ] 1.3 `StorageReconciler` с портом `EventPublisher`: публикация событий после удаления намерения
- [ ] 1.4 Проверка группы: `make lint`
## 2. Зона `attachments`: точка входа
- [ ] 2.1 `AttachmentStorageProvider` в `entrypoints/ioc.py`; `ReconcileProvider` и сборка `make_async_container` в `entrypoints/reconcile.py`; журнал удалений через `EventBus`
- [ ] 2.2 `main`: любая ошибка прохода → `reconcile.failed`, код `1`
- [ ] 2.3 Проверка группы: API-тесты: другие байты той же длины оставляют карантин; восстановленные снимают его без `--deep` одним `GET`; SQL-страниц `⌈N/страница⌉`; событие `reason=reconcile`; ошибка не `Unavailable` → `reconcile.failed`, код `1`
## 3. Обвязка трека
- [ ] 3.1 `scripts/reconcile-inject.sh`: один uuid у объекта без строки
- [ ] 3.2 `scripts/reconcile_track.py demo`: множества найденного и внедрённого, чужие байты той же длины, `rechecked` под нагрузкой, `docker stop` идущего прохода
- [ ] 3.3 `scripts/reconcile_track.py cost`: очистка прошлой серии, N до 100k; `Makefile` (`help`, `upload-memory ARGS`), `AGENTS.md`
- [ ] 3.4 Проверка группы: `make check`, `make lint`
## 4. Измерения
- [ ] 4.1 `make reconcile-demo` на чистом стенде → `evidence/reconcile/`
- [ ] 4.2 `make reconcile-cost` на чистом стенде (1k, 10k, 30k, 100k) → `evidence/reconcile/cost/`; прошлая серия → `cost-b191623/`
- [ ] 4.3 Проверка группы: H1 и H2 (формулировка `148868b`) по сырым отчётам
## 5. Проверка
- [ ] 5.1 `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`