Files
mtusi2026lab5/evidence/attachments/defense-faults.md
T

7.0 KiB
Raw Blame History

Шаг 4 сценария защиты: окна отказа

  • Команда: python3 .claude/skills/run-mtusi-messenger/driver.py --port 8080 defense-faults
  • Дата: 2026-10-31, 16:01:59–16:04:03 UTC; код выхода 0, итог PASS
  • Commit: 399da05 (ветка feat/pipeline-reliability), рабочее дерево без правок кода (добавлены только файлы evidence/)
  • Стенд: проект compose mtusi-lab5, собран make run_docker из HEAD: HAProxy, две реплики API, relay, worker, cleaner, PostgreSQL, Valkey, S3, RabbitMQ
  • Спек: student-tests, «Шаг 4 на рабочем стенде»; решения 1, 3, 5, 14, 17 design change pipeline-reliability. Тем же порядком на стенде отказов — test_defense_faults (evidence/tests/failure-checks.md)
  • Точек сбоя в коде нет: окна держат триггеры driver_df_* только на уникальный filename прогона, docker kill снаружи. Токенов и секретов в выводе нет, пользователи и чат синтетические
  • Вывод сокращён: внутри окна строки скачивания вариантов свёрнуты в одну (каждый вариант проверен: 200, тип, размеры по байтам, SHA-256 = метаданным), итоговая таблица «проверка → ожидаемо → получено» без расхождений заменена её итогом
window: after writing objects, before COMMIT
  upload: 202
  attachment id 2cccff8d-6ce9-448f-9d58-7506b6e39aa1
  COMMIT of ready waits in the trigger: yes
  action: docker kill worker
  job state after kill: processing
  attempt after kill: 1
  job id 181f8092-211d-482d-981b-c15e6e74e70a
  thumbnail sha256 before the crash b8e59b0cad429b1c49c27c4a1c79e52bfc23e2fab7c7238d18d5addd4df4b546
  crop sha256 before the crash fae35500205a78065cf7d589f121cc909b017e2a4cde882177e24f5608fb4c1f
  optimized sha256 before the crash 1090d84ed8411226010ae498b08e1b9e6d81c8eee02ee77143a0dc327b894beb
  action: start worker, lease expires in 69 s
  attachment status: ready
  ready 70 s after the kill
  next attempt not before the lease expired: yes
  variants in metadata: crop,optimized,thumbnail
  downloads: thumbnail image/jpeg (256, 160); crop image/jpeg (128, 128); optimized image/webp (320, 200)
  thumbnail same sha256 in S3 and metadata: b8e59b0cad429b1c49c27c4a1c79e52bfc23e2fab7c7238d18d5addd4df4b546
  crop same sha256 in S3 and metadata: fae35500205a78065cf7d589f121cc909b017e2a4cde882177e24f5608fb4c1f
  optimized same sha256 in S3 and metadata: 1090d84ed8411226010ae498b08e1b9e6d81c8eee02ee77143a0dc327b894beb
  attempt: 2
  job state: succeeded
  queue empty: 0

window: after COMMIT, before ack
  upload: 202
  attachment id 63163c48-95f9-4e41-ae36-4746f241bad5
  COMMIT waits in the deferred trigger: yes
  action: docker kill -s STOP worker
  job state while frozen: succeeded
  job id c14b31e6-2e3c-4453-8a55-76c8d4881b7c
  action: docker kill worker
  message returned to the queue (no ack): 1
  action: start worker
  redelivered: 'Skipped job message', finished: yes
  new attempts: 0
  queue empty: 0
  same updated_at: 2026-10-31T16:03:16.515863+00:00
  attempt: 1
  metadata unchanged: yes
  downloads: thumbnail image/jpeg (256, 160); crop image/jpeg (128, 128); optimized image/webp (320, 200)

window: after COMMIT queued, before publish
  action: docker kill relay
  relay stays down: no
  upload: 202
  attachment id 2776eb1b-9c3e-429e-9acc-bd2d010eee9c
  job id a50fc32c-e511-4789-8973-29073584414d
  job state: queued
  published_at: None
  messages in the queue: 0
  action: start relay
  attachment status: ready
  downloads: thumbnail image/jpeg (256, 160); crop image/jpeg (128, 128); optimized image/webp (320, 200)
  attempt: 1

window: after broker confirm, before the mark
  action: docker compose stop worker
  upload: 202
  attachment id ef8d3438-e3bd-4849-8375-79cccd92f29e
  the mark waits in the trigger: yes
  action: docker kill relay
  message in the queue: 1
  job id 61c712cf-5a6e-4f5c-b9b7-c042bc7e9202
  published_at: None
  action: start relay
  two messages with the worker stopped: 2
  action: start worker
  attachment status: ready
  downloads: thumbnail image/jpeg (256, 160); crop image/jpeg (128, 128); optimized image/webp (320, 200)
  queue empty: 0
  attempt: 1

window: replay of a failed job
  action: docker compose stop worker
  upload: 202
  attachment id 899a3ef4-f0d9-4d0c-8b75-49e0fe7ccf7d
  action: staging object replaced with other bytes of the same size
  action: start worker
  attachment status: failed
  error_code: processing_failed
  job id 0ef49bb7-fda7-4555-a82a-9693e265820a
  reason: source_corrupted
  action: replay --error-code processing_failed (registry, dry-run)
  registry: exit 0
  registry names the job: yes
  registry changes nothing: state failed, attempt 1, attempt_base 0, last_error_code source_corrupted
  action: original bytes returned to staging
  action: replay --attachment-id 899a3ef4-f0d9-4d0c-8b75-49e0fe7ccf7d --apply
  replay exit code: 0
  'Replayed job' record: yes
  attachment status: ready
  downloads: thumbnail image/jpeg (256, 160); crop image/jpeg (128, 128); optimized image/webp (320, 200)
  download original: 200
  original sha256 = uploaded: 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75
  same job: 0ef49bb7-fda7-4555-a82a-9693e265820a
  attempt: 2
  attempt_base: 1
  audit: [{'operator': 'driver-defense-faults', 'error_code': 'processing_failed', 'reason': 'source_corrupted', 'attempt': 1}]

window: replay of a ready job
  upload: 202
  attachment id 5158f6e9-c59a-46f1-bfb9-d16cf502aa7c
  attachment status: ready
  job id f6eeaf22-4374-4880-99d1-c2b54ecb2bd3
  action: replay --attachment-id 5158f6e9-c59a-46f1-bfb9-d16cf502aa7c --apply
  replay exit code: 3
  refusal: already_ready
  metadata unchanged: yes
  job unchanged: 2026-10-31T16:03:55.015651+00:00
  audit records: 0
  driver triggers left: 0

window -> action -> job id -> attempts started -> result
  after writing objects, before COMMIT -> kill worker, wait for the lease -> 181f8092-211d-482d-981b-c15e6e74e70a -> 2 -> ready
  after COMMIT, before ack -> freeze and kill worker after COMMIT -> c14b31e6-2e3c-4453-8a55-76c8d4881b7c -> 1 -> ready, no-op
  after COMMIT queued, before publish -> kill relay, upload, start relay -> a50fc32c-e511-4789-8973-29073584414d -> 1 -> ready
  after broker confirm, before the mark -> kill relay after confirm, duplicate -> 61c712cf-5a6e-4f5c-b9b7-c042bc7e9202 -> 1 -> ready
  replay of a failed job -> failed, registry, replay -> 0ef49bb7-fda7-4555-a82a-9693e265820a -> 2 -> ready
  replay of a ready job -> replay ready -> f6eeaf22-4374-4880-99d1-c2b54ecb2bd3 -> 1 -> refused, exit 3

all rows of the check table: expected = got
PASS: every window finished with the same result, no duplicate effect
worker and relay running at the end: yes