Files
mtusi2026labs/openspec/changes/add-lab4-storage-reconciler/tasks.md
T
ArtyomandClaude Opus 5.5 5c3c238d17 Screen the cost runs for foreign load and check a pass without S3
The cost matrix shares the Docker VM with the stands and builds of other
labs. Each run now reads the VM-wide /proc/stat and the cpu.stat of the
s3 and postgres cgroups before and after the pass, and the reconciler
reports its own CPU time. Foreign CPU over the window is the busy time
minus ours minus the cost of starting a container (1.5 core-s in the VM
and 0.5 on the pinned cores, measured on the idle stand). A run with
more than 2 foreign cores in the VM or 0.25 on the pinned cores goes to
cost/disturbed and is repeated after 15 s of quiet, up to three times;
docker stats of the whole host are saved before and after the series.

The demo also runs a pass with s3 stopped: it must exit with code 1 in
bounded time, log reconcile.failed and leave PostgreSQL and the bucket
as they were.

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

4.5 KiB
Raw Blame History

1. Схема и миграции

  • 1.1 0004_attachment_quarantine.sql: quarantine_reason с CHECK, quarantined_at, согласованность пары
  • 1.2 Проверка группы: make student-test (test_migrations.py: повтор без изменений)

2. Зона attachments: домен и приложение

  • 2.1 Домен: Quarantine, поле quarantine агрегата
  • 2.2 Порты: StoredObject, ObjectStorage.listing/stat, AttachmentRepository.page_after/by_key/claim/mark, SingleRun; команда ReconcileStorage
  • 2.3 StorageReconciler: слияние потоков, классы, повторные проверки, действия, --deep под ограничением, отчёт Reconciliation
  • 2.4 OpenAttachment: карантин → 404 без S3
  • 2.5 Проверка группы: make lint

3. Зона attachments: адаптеры и точка входа

  • 3.1 Адаптер S3: листинг страницами, HEAD; адаптер PostgreSQL: колонка карантина, keyset, по ключу, SKIP LOCKED, UPDATE карантина, PostgresSingleRun
  • 3.2 Платформа: поток журнала настраивается
  • 3.3 CLI messenger.attachments.entrypoints.reconcile: флаги, сборка адаптеров, JSON в stdout, коды выхода
  • 3.4 Проверка группы: API-тесты сверки против одноразового PostgreSQL (каждый класс в dry-run без изменений, apply и повтор = 0, свежее и используемое сохранены, строка появилась после листинга, карантин и 404, healed, --deep, занятая блокировка); тест адаптера против RustFS (порядок листинга, страницы, HEAD)
  • 3.5 Отказ зависимости посреди прохода завершает его исключением Unavailable, а не группой исключений TaskGroup: журнал reconcile.failed, код 1; API-тест сбоя листинга на второй странице

4. Стенд

  • 4.1 compose.yaml: сервис reconciler (профиль reconcile), cpuset из переменных у s3, postgres, reconciler; .env.example
  • 4.2 Цели make reconcile ARGS=…, make reconcile-demo, make reconcile-cost
  • 4.3 Проверка группы: docker compose config --quiet, make up, make reconcile

5. Обвязка трека

  • 5.1 scripts/reconcile-inject.sh и scripts/reconcile_check.py из заготовки
  • 5.2 student-tests/tools/seed_storage.py: наполнение N объектов и строк в образе API
  • 5.3 scripts/reconcile_track.py: demo (внедрение, dry-run, apply ×2, безопасность, healed, нагрузка) и cost (снимок хоста, закрепление CPU, матрица N × режим × 3)
  • 5.4 Проверка группы: make check (Python 3.9, JSON), make lint
  • 5.5 Процессорное время прохода в отчёте; cost: снимок docker stats хоста до и после серии, чужой CPU за окно каждого прогона (во всей VM и на закреплённых ядрах), отбраковка и повтор после тишины, отбракованные — в cost/disturbed/
  • 5.6 demo: проход при остановленном S3 — код 1 за ограниченное время, PostgreSQL и bucket не меняются

6. Измерения

  • 6.1 make reconcile-demo на чистом стенде → evidence/reconcile/
  • 6.2 make reconcile-cost на чистом стенде → evidence/reconcile/cost/
  • 6.3 Проверка группы: критерии H1 и H2 из design.md

7. Отчёт

  • 7.1 REPORT.md: раздел трека 2 (гипотеза, методика, результаты, ограничения, выводы), строки трека в таблице доказательств и отказов; AGENTS.md
  • 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