ЛР 5 — БПИ2303 — Лазарев — на 4

Асинхронная обработка вложений: RabbitMQ 4.1 (quorum-очереди, publisher
confirms, manual ack, DLQ), transactional outbox, отдельный worker.

- upload: оригинал в staging S3, затем одной транзакцией queued + jobs +
  outbox -> 202; API к брокеру не подключается
- relay: публикация outbox с confirm, reaper истёкших аренд, redrive
- worker: claim по строке jobs, аренда с heartbeat и fencing по
  lease_token, transform в подпроцессе с RLIMIT_AS/RLIMIT_CPU/таймаутом,
  thumbnail 256, crop 128, WebP 1280 по детерминированным ключам
- retry с backoff и jitter, постоянные/временные ошибки, реестр failed,
  ops replay (ready не повторяется), DLQ для невалидных сообщений
- janitor: очистка staging и сирот; миграция 004 с backfill вложений lab4
- тесты отказов: окна COMMIT/publish, крахи worker до/после S3 и ack,
  заморозка worker, всплеск загрузок, права брокера; evidence/ и REPORT.md
This commit is contained in:
2026-11-13 16:28:18 +03:00
parent 276dbdad8a
commit 13bec4ab8b
86 changed files with 10257 additions and 25 deletions
+73
View File
@@ -0,0 +1,73 @@
{
"replicas": [
"7aa798b287f4",
"9e76aae00a09"
],
"rounds": [
{
"uploaded_by": "7aa798b287f4",
"stopped": "7aa798b287f4",
"downloads": [
{
"instance": "9e76aae00a09",
"sha256_ok": true,
"ms": 8.5
},
{
"instance": "9e76aae00a09",
"sha256_ok": true,
"ms": 18.4
},
{
"instance": "9e76aae00a09",
"sha256_ok": true,
"ms": 6.5
},
{
"instance": "9e76aae00a09",
"sha256_ok": true,
"ms": 6.8
},
{
"instance": "9e76aae00a09",
"sha256_ok": true,
"ms": 5.7
}
],
"pass": true
},
{
"uploaded_by": "9e76aae00a09",
"stopped": "9e76aae00a09",
"downloads": [
{
"instance": "7aa798b287f4",
"sha256_ok": true,
"ms": 7.6
},
{
"instance": "7aa798b287f4",
"sha256_ok": true,
"ms": 7.4
},
{
"instance": "7aa798b287f4",
"sha256_ok": true,
"ms": 7.4
},
{
"instance": "7aa798b287f4",
"sha256_ok": true,
"ms": 17.8
},
{
"instance": "7aa798b287f4",
"sha256_ok": true,
"ms": 7.5
}
],
"pass": true
}
],
"pass": true
}
+5
View File
@@ -0,0 +1,5 @@
# 2026-11-13T13:25:43Z python3 student-tests/attachment_failover.py --output evidence/attachment-failover.json
{"uploaded_by": "7aa798b287f4", "stopped": "7aa798b287f4", "downloads": [{"instance": "9e76aae00a09", "sha256_ok": true, "ms": 8.5}, {"instance": "9e76aae00a09", "sha256_ok": true, "ms": 18.4}, {"instance": "9e76aae00a09", "sha256_ok": true, "ms": 6.5}, {"instance": "9e76aae00a09", "sha256_ok": true, "ms": 6.8}, {"instance": "9e76aae00a09", "sha256_ok": true, "ms": 5.7}], "pass": true}
{"uploaded_by": "9e76aae00a09", "stopped": "9e76aae00a09", "downloads": [{"instance": "7aa798b287f4", "sha256_ok": true, "ms": 7.6}, {"instance": "7aa798b287f4", "sha256_ok": true, "ms": 7.4}, {"instance": "7aa798b287f4", "sha256_ok": true, "ms": 7.4}, {"instance": "7aa798b287f4", "sha256_ok": true, "ms": 17.8}, {"instance": "7aa798b287f4", "sha256_ok": true, "ms": 7.5}], "pass": true}
{"pass": true, "rounds": 2}
exit=0
+430
View File
@@ -0,0 +1,430 @@
{
"summary": {
"cases": 60,
"failed": 0,
"server_errors_5xx": 0,
"pass": true
},
"results": [
{
"case": "valid PNG fixture",
"expected": 202,
"status": 202,
"error_code": null,
"pass": true
},
{
"case": "valid JPEG",
"expected": 202,
"status": 202,
"error_code": null,
"pass": true
},
{
"case": "unicode filename",
"expected": 202,
"status": 202,
"error_code": null,
"pass": true
},
{
"case": "PNG near 10 MiB limit (10482871 B)",
"expected": 202,
"status": 202,
"error_code": null,
"pass": true
},
{
"case": "too large: 10 MiB + 1 B",
"expected": 413,
"status": 413,
"error_code": "payload_too_large",
"pass": true
},
{
"case": "pixel bomb header 100000x100000",
"expected": 413,
"status": 413,
"error_code": "payload_too_large",
"pass": true
},
{
"case": "PNG 7000x6000 = 42 Mpx (> 40 Mpx)",
"expected": 413,
"status": 413,
"error_code": "payload_too_large",
"pass": true
},
{
"case": "zlib bomb: 100x100 header, 50 MB inflated",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "corrupted PNG (byte flipped, bad CRC)",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "truncated PNG",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "PNG without IEND",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "PNG with appended ZIP (polyglot)",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "truncated JPEG",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "JPEG header only",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "empty body",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "JPEG bytes declared image/png",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "PNG bytes declared image/jpeg",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "text declared image/png",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "GIF declared image/png",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "PNG declared text/html",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "PNG declared image/svg+xml",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "multipart/form-data instead of raw",
"expected": 415,
"status": 415,
"error_code": "unsupported_media_type",
"pass": true
},
{
"case": "filename: ../etc/passwd",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "filename: slash",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "filename: backslash",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "filename: NUL",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "filename: newline",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "filename: bidi override U+202E",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "filename: ..",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "filename: empty",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "filename: whitespace only",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "filename: 256 code points",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "filename: missing filename",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "filename: filename twice",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "filename: invalid UTF-8",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "eve uploads to her own chat",
"expected": 202,
"status": 202,
"error_code": null,
"pass": true
},
{
"case": "non-member uploads to alice chat",
"expected": 404,
"status": 404,
"error_code": "not_found",
"pass": true
},
{
"case": "upload without session",
"expected": 401,
"status": 401,
"error_code": "unauthorized",
"pass": true
},
{
"case": "upload to unknown chat",
"expected": 404,
"status": 404,
"error_code": "not_found",
"pass": true
},
{
"case": "foreign attachment metadata",
"expected": 404,
"status": 404,
"error_code": "not_found",
"pass": true
},
{
"case": "foreign attachment content",
"expected": 404,
"status": 404,
"error_code": "not_found",
"pass": true
},
{
"case": "eve reads alice attachment",
"expected": 404,
"status": 404,
"error_code": "not_found",
"pass": true
},
{
"case": "message with foreign attachment_id",
"expected": 404,
"status": 404,
"error_code": "not_found",
"pass": true
},
{
"case": "message mixing own and foreign ids",
"expected": 404,
"status": 404,
"error_code": "not_found",
"pass": true
},
{
"case": "attachment of OTHER chat of the same user",
"expected": 404,
"status": 404,
"error_code": "not_found",
"pass": true
},
{
"case": "unknown attachment_id",
"expected": 404,
"status": 404,
"error_code": "not_found",
"pass": true
},
{
"case": "malformed attachment_id",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "duplicate attachment_ids",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "11 attachment_ids",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "attachment_ids not a list",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "empty text without attachments",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "empty text with attachment (bob links alice's file)",
"expected": 201,
"status": 201,
"error_code": null,
"pass": true
},
{
"case": "idempotent send with attachments",
"expected": 201,
"status": 201,
"error_code": null,
"pass": true
},
{
"case": "same key, same body (key order changed)",
"expected": 201,
"status": 201,
"error_code": null,
"pass": true
},
{
"case": "same key, different attachment_ids -> 409",
"expected": 409,
"status": 409,
"error_code": "conflict",
"pass": true
},
{
"case": "variant=thumbnail (ready, lab5)",
"expected": 200,
"status": 200,
"error_code": null,
"pass": true
},
{
"case": "variant=bogus",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "variant=original",
"expected": 200,
"status": 200,
"error_code": null,
"pass": true
},
{
"case": "malformed attachment id in path",
"expected": 400,
"status": 400,
"error_code": "invalid_request",
"pass": true
},
{
"case": "unknown attachment id",
"expected": 404,
"status": 404,
"error_code": "not_found",
"pass": true
}
]
}
+63
View File
@@ -0,0 +1,63 @@
# 2026-11-13T13:25:41Z python3 student-tests/attachments_negative.py --output evidence/attachments-negative.json
PASS valid PNG fixture -> 202
PASS valid JPEG -> 202
PASS unicode filename -> 202
PASS PNG near 10 MiB limit (10482871 B) -> 202
PASS too large: 10 MiB + 1 B -> 413 payload_too_large
PASS pixel bomb header 100000x100000 -> 413 payload_too_large
PASS PNG 7000x6000 = 42 Mpx (> 40 Mpx) -> 413 payload_too_large
PASS zlib bomb: 100x100 header, 50 MB inflated -> 415 unsupported_media_type
PASS corrupted PNG (byte flipped, bad CRC) -> 415 unsupported_media_type
PASS truncated PNG -> 415 unsupported_media_type
PASS PNG without IEND -> 415 unsupported_media_type
PASS PNG with appended ZIP (polyglot) -> 415 unsupported_media_type
PASS truncated JPEG -> 415 unsupported_media_type
PASS JPEG header only -> 415 unsupported_media_type
PASS empty body -> 415 unsupported_media_type
PASS JPEG bytes declared image/png -> 415 unsupported_media_type
PASS PNG bytes declared image/jpeg -> 415 unsupported_media_type
PASS text declared image/png -> 415 unsupported_media_type
PASS GIF declared image/png -> 415 unsupported_media_type
PASS PNG declared text/html -> 415 unsupported_media_type
PASS PNG declared image/svg+xml -> 415 unsupported_media_type
PASS multipart/form-data instead of raw -> 415 unsupported_media_type
PASS filename: ../etc/passwd -> 400 invalid_request
PASS filename: slash -> 400 invalid_request
PASS filename: backslash -> 400 invalid_request
PASS filename: NUL -> 400 invalid_request
PASS filename: newline -> 400 invalid_request
PASS filename: bidi override U+202E -> 400 invalid_request
PASS filename: .. -> 400 invalid_request
PASS filename: empty -> 400 invalid_request
PASS filename: whitespace only -> 400 invalid_request
PASS filename: 256 code points -> 400 invalid_request
PASS filename: missing filename -> 400 invalid_request
PASS filename: filename twice -> 400 invalid_request
PASS filename: invalid UTF-8 -> 400 invalid_request
PASS eve uploads to her own chat -> 202
PASS non-member uploads to alice chat -> 404 not_found
PASS upload without session -> 401 unauthorized
PASS upload to unknown chat -> 404 not_found
PASS foreign attachment metadata -> 404 not_found
PASS foreign attachment content -> 404 not_found
PASS eve reads alice attachment -> 404 not_found
PASS message with foreign attachment_id -> 404 not_found
PASS message mixing own and foreign ids -> 404 not_found
PASS attachment of OTHER chat of the same user -> 404 not_found
PASS unknown attachment_id -> 404 not_found
PASS malformed attachment_id -> 400 invalid_request
PASS duplicate attachment_ids -> 400 invalid_request
PASS 11 attachment_ids -> 400 invalid_request
PASS attachment_ids not a list -> 400 invalid_request
PASS empty text without attachments -> 400 invalid_request
PASS empty text with attachment (bob links alice's file) -> 201
PASS idempotent send with attachments -> 201
PASS same key, same body (key order changed) -> 201
PASS same key, different attachment_ids -> 409 -> 409 conflict
PASS variant=thumbnail (ready, lab5) -> 200
PASS variant=bogus -> 400 invalid_request
PASS variant=original -> 200
PASS malformed attachment id in path -> 400 invalid_request
PASS unknown attachment id -> 404 not_found
{"cases": 60, "failed": 0, "server_errors_5xx": 0, "pass": true}
exit=0
+49
View File
@@ -0,0 +1,49 @@
{
"relay": {
"got": {
"publish": true,
"get_work_queue": false,
"get_dlq": false,
"declare_queue": false
},
"expected": {
"publish": true,
"get_work_queue": false,
"get_dlq": false,
"declare_queue": false
},
"pass": true
},
"worker": {
"got": {
"publish": false,
"get_work_queue": true,
"get_dlq": false,
"declare_queue": false
},
"expected": {
"publish": false,
"get_work_queue": true,
"get_dlq": false,
"declare_queue": false
},
"pass": true
},
"ops": {
"got": {
"publish": true,
"get_work_queue": false,
"get_dlq": true,
"declare_queue": false
},
"expected": {
"publish": true,
"get_work_queue": false,
"get_dlq": true,
"declare_queue": false
},
"pass": true
},
"guest_absent": true,
"broker_port_published_to_host": false
}
+7
View File
@@ -0,0 +1,7 @@
# 2026-11-13T13:25:36Z python3 student-tests/broker_permissions.py --output evidence/broker-permissions.json
PASS relay {'publish': True, 'get_work_queue': False, 'get_dlq': False, 'declare_queue': False}
PASS worker {'publish': False, 'get_work_queue': True, 'get_dlq': False, 'declare_queue': False}
PASS ops {'publish': True, 'get_work_queue': False, 'get_dlq': True, 'declare_queue': False}
guest absent: True | port 5672 on host: False
PASS
exit=0
+108
View File
@@ -0,0 +1,108 @@
{
"scenario": "burst of uploads: bounded worker concurrency",
"date_utc": "2026-11-13T13:25:36+00:00",
"steps": [
{
"t": 1.1,
"utc": "13:25:25.872",
"step": "consumers",
"count": 4,
"prefetch": [
1
]
},
{
"t": 1.64,
"utc": "13:25:26.409",
"step": "generated images",
"bytes": [
6753618,
6753618,
6753618,
6753618
]
},
{
"t": 4.75,
"utc": "13:25:29.527",
"step": "all uploads accepted (202)",
"count": 24,
"seconds": 2.31,
"queue_right_after": {
"messages": 0,
"messages_ready": 0,
"messages_unacknowledged": 0,
"consumers": 4
}
},
{
"t": 11.68,
"utc": "13:25:36.456",
"step": "result",
"count": 24,
"image_bytes": 6753618,
"upload_seconds": 2.31,
"total_seconds_to_all_ready": 7.23,
"throughput_jobs_per_s": 3.32,
"consumers": 4,
"prefetch_per_consumer": [
1
],
"max_concurrent_processing": 4,
"queue_lag_s": {
"p50": 2.401,
"p95": 4.069,
"max": 4.353
},
"enqueued_to_ready_s": {
"p50": 2.895,
"p95": 4.889,
"max": 4.895
},
"processing_s": {
"p50": 0.765,
"max": 1.649,
"mean": 0.834
},
"worker_peak_mem_mib": {
"mtusi-lab5-worker-1": 42.2,
"mtusi-lab5-worker-2": 100.4
},
"worker_mem_limit": "1GiB",
"staging_left": 0
}
],
"result": {
"count": 24,
"image_bytes": 6753618,
"upload_seconds": 2.31,
"total_seconds_to_all_ready": 7.23,
"throughput_jobs_per_s": 3.32,
"consumers": 4,
"prefetch_per_consumer": [
1
],
"max_concurrent_processing": 4,
"queue_lag_s": {
"p50": 2.401,
"p95": 4.069,
"max": 4.353
},
"enqueued_to_ready_s": {
"p50": 2.895,
"p95": 4.889,
"max": 4.895
},
"processing_s": {
"p50": 0.765,
"max": 1.649,
"mean": 0.834
},
"worker_peak_mem_mib": {
"mtusi-lab5-worker-1": 42.2,
"mtusi-lab5-worker-2": 100.4
},
"worker_mem_limit": "1GiB",
"staging_left": 0
}
}
+7
View File
@@ -0,0 +1,7 @@
# 2026-11-13T13:25:24Z python3 student-tests/burst.py --count 24 --output evidence/burst.json
[ 1.10s] consumers {"count": 4, "prefetch": [1]}
[ 1.64s] generated images {"bytes": [6753618, 6753618, 6753618, 6753618]}
[ 4.75s] all uploads accepted (202) {"count": 24, "seconds": 2.31, "queue_right_after": {"messages": 0, "messages_ready": 0, "messages_unacknowledged": 0, "consumers": 4}}
[ 11.68s] result {"count": 24, "image_bytes": 6753618, "upload_seconds": 2.31, "total_seconds_to_all_ready": 7.23, "throughput_jobs_per_s": 3.32, "consumers": 4, "prefetch_per_consumer": [1], "max_concurrent_processing": 4, "queue_lag_s": {"p50": 2.401, "p95": 4.069, "max": 4.353}, "enqueued_to_ready_s": {"p50": 2.895, "p95": 4.889, "max": 4.895}, "processing_s": {"p50": 0.765, "max": 1.649, "mean": 0.834}, "worker_peak_mem_mib": {"mtusi-lab5-worker-1": 42.2, "mtusi-lab5-worker-2": 100.4}, "worker_mem_limit": "1GiB", "staging_left": 0}
PASS: 24 jobs, max concurrent 4 <= 4 consumers
exit=0
+4
View File
@@ -0,0 +1,4 @@
# 2026-11-13T13:19:14Z make check
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
exit=0
+21
View File
@@ -0,0 +1,21 @@
# containers after persistence hook
mtusi-lab5-api-1 running
mtusi-lab5-api-2 running
mtusi-lab5-broker-1 running
mtusi-lab5-db-1 running
mtusi-lab5-janitor-1 running
mtusi-lab5-lb-1 running
mtusi-lab5-relay-1 running
mtusi-lab5-s3-1 running
mtusi-lab5-worker-1 running
mtusi-lab5-worker-2 running
/mtusi-lab5-api-1 StartedAt=2026-11-13T13:19:57.047261594Z
/mtusi-lab5-api-2 StartedAt=2026-11-13T13:19:57.066645345Z
/mtusi-lab5-broker-1 StartedAt=2026-11-13T13:19:18.587341132Z
/mtusi-lab5-db-1 StartedAt=2026-11-13T13:19:17.540371965Z
/mtusi-lab5-janitor-1 StartedAt=2026-11-13T13:20:03.852909333Z
/mtusi-lab5-lb-1 StartedAt=2026-11-13T13:19:53.963829093Z
/mtusi-lab5-relay-1 StartedAt=2026-11-13T13:19:54.774267885Z
/mtusi-lab5-s3-1 StartedAt=2026-11-13T13:19:34.799779792Z
/mtusi-lab5-worker-1 StartedAt=2026-11-13T13:19:54.68599976Z
/mtusi-lab5-worker-2 StartedAt=2026-11-13T13:19:54.204608051Z
+21
View File
@@ -0,0 +1,21 @@
# containers before persistence hook
mtusi-lab5-api-1 running
mtusi-lab5-api-2 running
mtusi-lab5-broker-1 running
mtusi-lab5-db-1 running
mtusi-lab5-janitor-1 running
mtusi-lab5-lb-1 running
mtusi-lab5-relay-1 running
mtusi-lab5-s3-1 running
mtusi-lab5-worker-1 running
mtusi-lab5-worker-2 running
/mtusi-lab5-api-1 StartedAt=2026-11-13T13:18:58.823119012Z
/mtusi-lab5-api-2 StartedAt=2026-11-13T13:18:58.721958845Z
/mtusi-lab5-broker-1 StartedAt=2026-11-13T13:16:34.919270459Z
/mtusi-lab5-db-1 StartedAt=2026-11-13T13:16:34.884065126Z
/mtusi-lab5-janitor-1 StartedAt=2026-11-13T13:18:58.727139929Z
/mtusi-lab5-lb-1 StartedAt=2026-11-13T13:18:58.963141679Z
/mtusi-lab5-relay-1 StartedAt=2026-11-13T13:18:58.71470797Z
/mtusi-lab5-s3-1 StartedAt=2026-11-13T13:16:34.886978376Z
/mtusi-lab5-worker-1 StartedAt=2026-11-13T13:18:58.841973137Z
/mtusi-lab5-worker-2 StartedAt=2026-11-13T13:18:58.721509054Z
+40
View File
@@ -0,0 +1,40 @@
# 2026-11-13T13:26:15Z docker compose --profile tools run --rm -T ops failed --limit 10
{
"failed": [
{
"attachment_id": "dddc059c-a98e-4150-b866-dbdbfeb875f2",
"job_id": "7c4b6bfa-565d-4399-8d9e-57f58210b657",
"error_code": "staging_corrupted",
"attempt": 1,
"max_attempts": 5,
"replay_count": 0,
"last_error": "size/sha256 differ from accepted upload",
"updated_at": "2026-11-13T13:22:53.830976Z",
"replayable": true
},
{
"attachment_id": "ed395364-f044-42c0-aa9c-d61649968951",
"job_id": "b82c635b-27b0-4d6f-9413-689c659bbb89",
"error_code": "staging_corrupted",
"attempt": 1,
"max_attempts": 5,
"replay_count": 0,
"last_error": "size/sha256 differ from accepted upload",
"updated_at": "2026-11-13T12:41:52.426094Z",
"replayable": true
},
{
"attachment_id": "4f03beaa-a713-46c4-88e8-3551f98be852",
"job_id": "937971a7-ac66-4c49-94e7-3c0d9188afdf",
"error_code": "staging_corrupted",
"attempt": 1,
"max_attempts": 5,
"replay_count": 0,
"last_error": "size/sha256 differ from accepted upload",
"updated_at": "2026-11-13T12:39:23.836327Z",
"replayable": true
}
],
"count": 3
}
exit=0
+6
View File
@@ -0,0 +1,6 @@
# 2026-11-13T13:20:04Z make test-failover ACTION_SCRIPT=scripts/stop-one.sh
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 131, "failed_attempts": 0, "first_recovery_seconds": 3.725}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
exit=0
+3
View File
@@ -0,0 +1,3 @@
# 2026-11-13T13:26:12Z docker compose exec -T janitor python /app/src/janitor.py --once --dry-run
{"dry_run": true, "grace_seconds": 3600, "staging_retention_seconds": 86400, "abandoned_pending": 0, "staging_ready_cleaned": 0, "staging_failed_expired": 0, "orphan_objects": 0, "missing_objects": 0, "deleted_objects": 0, "deleted_rows": 0, "errors": 0, "rows_by_status": {"ready": 109, "failed": 3}, "jobs_by_status": {"ready": 109, "failed": 3}, "outbox_unpublished": 0, "abandoned_ids": [], "objects_total": 439, "objects_by_prefix": {"staging/": 3, "originals/": 0, "attachments/": 436}, "orphan_keys_sample": [], "missing_ids_sample": [], "duration_ms": 94.9}
exit=0
+208
View File
@@ -0,0 +1,208 @@
{
"scenario": "lease expiry of a frozen worker and fencing of its late result",
"date_utc": "2026-11-13T13:25:17+00:00",
"steps": [
{
"t": 7.61,
"utc": "13:24:41.036",
"step": "workers recreated",
"env": {
"WORKER_FAULT_INJECTION": "1",
"JOB_LEASE_SECONDS": "10",
"FAULT_SLOW_SECONDS": "25"
},
"workers": [
"5b3a6ceb1830",
"526f1f18e42d"
]
},
{
"t": 8.41,
"utc": "13:24:41.840",
"step": "claimed",
"attachment_id": "a7ea720b-3a62-4aba-89bb-7ee47cc4ff77",
"lease_owner": "526f1f18e42d:5a6bf2a7",
"lease_until": "2026-11-13T13:24:51.070995Z"
},
{
"t": 17.22,
"utc": "13:24:50.653",
"step": "long-running job keeps its lease (heartbeat)",
"lease_until": "2026-11-13T13:24:57.769248Z",
"status": "processing"
},
{
"t": 17.37,
"utc": "13:24:50.797",
"step": "owner container paused (frozen, no heartbeat)",
"container": "526f1f18e42d"
},
{
"t": 43.29,
"utc": "13:25:16.719",
"step": "lease expired -> requeued -> other worker finished",
"seconds_after_pause": 25.1,
"new_owner": "5b3a6ceb1830:80c565a7",
"events": [
"enqueued",
"claimed",
"lease_expired",
"requeued_after_lease",
"claimed",
"busy_ignored",
"ready",
"staging_deleted"
]
},
{
"t": 43.32,
"utc": "13:25:16.748",
"step": "owner container unpaused"
},
{
"t": 44.17,
"utc": "13:25:17.600",
"step": "late worker fenced, result unchanged",
"events": [
"enqueued",
"claimed",
"lease_expired",
"requeued_after_lease",
"claimed",
"busy_ignored",
"ready",
"staging_deleted",
"aborted_lease_lost"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 2
}
}
],
"attachment_id": "a7ea720b-3a62-4aba-89bb-7ee47cc4ff77",
"paused_container": "526f1f18e42d",
"events": [
{
"job_id": "2d2c94ac-bf98-435b-b5c0-5c0d95613cbb",
"at": "2026-11-13T13:24:41.056799Z",
"event": "enqueued",
"attempt": 1,
"actor": "api",
"detail": null
},
{
"job_id": "2d2c94ac-bf98-435b-b5c0-5c0d95613cbb",
"at": "2026-11-13T13:24:41.074354Z",
"event": "claimed",
"attempt": 1,
"actor": "526f1f18e42d:5a6bf2a7",
"detail": {
"redelivered_message_attempt": 1
}
},
{
"job_id": "2d2c94ac-bf98-435b-b5c0-5c0d95613cbb",
"at": "2026-11-13T13:25:00.154971Z",
"event": "lease_expired",
"attempt": 1,
"actor": "reaper:6e17e167ffa4:c0758d5b",
"detail": {
"lease_owner": "526f1f18e42d:5a6bf2a7"
}
},
{
"job_id": "2d2c94ac-bf98-435b-b5c0-5c0d95613cbb",
"at": "2026-11-13T13:25:00.160740Z",
"event": "requeued_after_lease",
"attempt": 1,
"actor": "reaper:6e17e167ffa4:c0758d5b",
"detail": {
"error_code": "lease_expired",
"next_attempt": 2,
"delay_seconds": 1.243
}
},
{
"job_id": "2d2c94ac-bf98-435b-b5c0-5c0d95613cbb",
"at": "2026-11-13T13:25:15.712439Z",
"event": "claimed",
"attempt": 2,
"actor": "5b3a6ceb1830:80c565a7",
"detail": {
"redelivered_message_attempt": 2
}
},
{
"job_id": "2d2c94ac-bf98-435b-b5c0-5c0d95613cbb",
"at": "2026-11-13T13:25:15.713469Z",
"event": "busy_ignored",
"attempt": 1,
"actor": "5b3a6ceb1830:80c565a7",
"detail": {
"lease_owner": "5b3a6ceb1830:80c565a7"
}
},
{
"job_id": "2d2c94ac-bf98-435b-b5c0-5c0d95613cbb",
"at": "2026-11-13T13:25:15.860857Z",
"event": "ready",
"attempt": 2,
"actor": "5b3a6ceb1830:80c565a7",
"detail": {
"variants": {
"crop": [
128,
128
],
"optimized": [
320,
200
],
"thumbnail": [
256,
160
]
}
}
},
{
"job_id": "2d2c94ac-bf98-435b-b5c0-5c0d95613cbb",
"at": "2026-11-13T13:25:15.862651Z",
"event": "staging_deleted",
"attempt": 2,
"actor": "5b3a6ceb1830:80c565a7",
"detail": null
},
{
"job_id": "2d2c94ac-bf98-435b-b5c0-5c0d95613cbb",
"at": "2026-11-13T13:25:16.745294Z",
"event": "aborted_lease_lost",
"attempt": 1,
"actor": "526f1f18e42d:5a6bf2a7",
"detail": null
}
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 2
}
}
+10
View File
@@ -0,0 +1,10 @@
# 2026-11-13T13:24:33Z python3 student-tests/lease_takeover.py --output evidence/lease-takeover.json
[ 7.61s] workers recreated {"env": {"WORKER_FAULT_INJECTION": "1", "JOB_LEASE_SECONDS": "10", "FAULT_SLOW_SECONDS": "25"}, "workers": ["5b3a6ceb1830", "526f1f18e42d"]}
[ 8.41s] claimed {"attachment_id": "a7ea720b-3a62-4aba-89bb-7ee47cc4ff77", "lease_owner": "526f1f18e42d:5a6bf2a7", "lease_until": "2026-11-13T13:24:51.070995Z"}
[ 17.22s] long-running job keeps its lease (heartbeat) {"lease_until": "2026-11-13T13:24:57.769248Z", "status": "processing"}
[ 17.37s] owner container paused (frozen, no heartbeat) {"container": "526f1f18e42d"}
[ 43.29s] lease expired -> requeued -> other worker finished {"seconds_after_pause": 25.1, "new_owner": "5b3a6ceb1830:80c565a7", "events": ["enqueued", "claimed", "lease_expired", "requeued_after_lease", "claimed", "busy_ignored", "ready", "staging_deleted"]}
[ 43.32s] owner container unpaused
[ 44.17s] late worker fenced, result unchanged {"events": ["enqueued", "claimed", "lease_expired", "requeued_after_lease", "claimed", "busy_ignored", "ready", "staging_deleted", "aborted_lease_lost"], "invariants": {"variants": ["crop", "optimized", "thumbnail"], "variants_ok": true, "final_objects": 4, "final_objects_ok": true, "staging_left": false, "job_status": "ready", "attempt": 2}}
PASS: frozen worker loses lease, job recovered, late result fenced
exit=0
+8
View File
@@ -0,0 +1,8 @@
# 13.11.2026. Переход lab4 -> lab5: миграция 004 на данных формы lab4 (отдельный postgres:16.4-alpine).
# 001..003 применены, вставлено ready-вложение lab4 (object_key originals/abc), затем 004 в одной транзакции (-1).
$ psql -tA -c "select status, staging_key, object_key from attachments; select status, attempt, max_attempts from jobs; select payload from outbox;"
queued|originals/abc|attachments/33333333-3333-4333-8333-333333333333/v1/original
queued|0|5
{"type": "attachment.process.v1", "job_id": "0b3091d5-c9d7-4008-8df3-43675d45f07e", "attempt": 1, "created_at": "2026-11-13T12:41:36Z", "attachment_id": "33333333-3333-4333-8333-333333333333", "schema_version": 1, "pipeline_version": 1}
# Итог: оригинал lab4 стал staging-объектом, вложение queued (не ready без вариантов), задание и outbox созданы;
# relay опубликует его, worker создаст варианты и перенесёт оригинал в attachments/<id>/v1/original.
+358
View File
@@ -0,0 +1,358 @@
{
"scenario": "outbox: COMMIT/publish gap and API crash windows",
"date_utc": "2026-11-13T13:24:33+00:00",
"steps": [
{
"t": 6.31,
"utc": "13:23:24.684",
"step": "A: relay stopped, upload 202",
"attachment_id": "41a53cd8-7e57-44b8-9c9f-12320b323750",
"outbox": [
{
"id": 105,
"attempt": "1",
"available_at": "2026-11-13T13:23:19.956776Z",
"created_at": "2026-11-13T13:23:19.956776Z",
"published_at": null,
"publish_count": 0
}
],
"queue": {
"messages": 0,
"messages_ready": 0,
"messages_unacknowledged": 0,
"consumers": 4
}
},
{
"t": 12.77,
"utc": "13:23:31.150",
"step": "A: relay started -> ready, same single job",
"attachment_id": "41a53cd8-7e57-44b8-9c9f-12320b323750",
"events": [
"enqueued",
"claimed",
"ready",
"staging_deleted"
],
"outbox": [
{
"id": 105,
"attempt": "1",
"available_at": "2026-11-13T13:23:19.956776Z",
"created_at": "2026-11-13T13:23:19.956776Z",
"published_at": "2026-11-13T13:23:26.328881Z",
"publish_count": 1
}
],
"jobs": 1,
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 1
}
},
{
"t": 23.48,
"utc": "13:23:41.861",
"step": "B: relay crashed between COMMIT and publish -> restarted -> ready",
"attachment_id": "a2401b04-a5db-4026-adc4-01d5040fdd2c",
"relay_restart_count": [
[
0
],
[
1
]
],
"events": [
"enqueued",
"claimed",
"ready",
"staging_deleted"
],
"outbox": [
{
"id": 106,
"attempt": "1",
"available_at": "2026-11-13T13:23:38.382769Z",
"created_at": "2026-11-13T13:23:38.382769Z",
"published_at": "2026-11-13T13:23:40.445416Z",
"publish_count": 1
}
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 1
}
},
{
"t": 32.98,
"utc": "13:23:51.354",
"step": "C: published twice (crash before marking) -> duplicate is a no-op",
"attachment_id": "85b3ce6d-b06a-49ab-bc80-07be18cfd5d9",
"relay_restart_count": [
1
],
"events": [
"enqueued",
"claimed",
"ready",
"staging_deleted",
"duplicate_ignored"
],
"outbox": [
{
"id": 107,
"attempt": "1",
"available_at": "2026-11-13T13:23:48.361567Z",
"created_at": "2026-11-13T13:23:48.361567Z",
"published_at": "2026-11-13T13:23:49.734047Z",
"publish_count": 1
}
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 1
}
},
{
"t": 49.85,
"utc": "13:24:08.230",
"step": "D: API died after COMMIT before 202 -> work still completed",
"attachment_id": "5778567a-0d6c-4322-b0e0-31a17a40994f",
"client_saw": "missing X-Instance-Id",
"events": [
"enqueued",
"claimed",
"ready",
"staging_deleted"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 1
}
},
{
"t": 50.15,
"utc": "13:24:08.530",
"step": "E: API died after staging before COMMIT",
"attachment_id": "5b7070f4-ece0-49d9-bef4-1d704222955f",
"client_saw": "missing X-Instance-Id",
"status": "pending",
"jobs": 0,
"api_get": 404
},
{
"t": 58.86,
"utc": "13:24:17.232",
"step": "E: janitor removed pending row and staging object",
"attachment_id": "5b7070f4-ece0-49d9-bef4-1d704222955f",
"janitor_dry_run": {
"abandoned_pending": 1,
"orphan_objects": 0,
"deleted_objects": 0,
"deleted_rows": 0
},
"janitor": {
"abandoned_pending": 1,
"orphan_objects": 0,
"deleted_objects": 1,
"deleted_rows": 1,
"missing_objects": 0
},
"row_gone": true
},
{
"t": 74.96,
"utc": "13:24:33.332",
"step": "relay and api restored to .env configuration"
}
],
"results": {
"A": {
"attachment_id": "41a53cd8-7e57-44b8-9c9f-12320b323750",
"events": [
"enqueued",
"claimed",
"ready",
"staging_deleted"
],
"outbox": [
{
"id": 105,
"attempt": "1",
"available_at": "2026-11-13T13:23:19.956776Z",
"created_at": "2026-11-13T13:23:19.956776Z",
"published_at": "2026-11-13T13:23:26.328881Z",
"publish_count": 1
}
],
"jobs": 1,
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 1
}
},
"B": {
"attachment_id": "a2401b04-a5db-4026-adc4-01d5040fdd2c",
"relay_restart_count": [
[
0
],
[
1
]
],
"events": [
"enqueued",
"claimed",
"ready",
"staging_deleted"
],
"outbox": [
{
"id": 106,
"attempt": "1",
"available_at": "2026-11-13T13:23:38.382769Z",
"created_at": "2026-11-13T13:23:38.382769Z",
"published_at": "2026-11-13T13:23:40.445416Z",
"publish_count": 1
}
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 1
}
},
"C": {
"attachment_id": "85b3ce6d-b06a-49ab-bc80-07be18cfd5d9",
"relay_restart_count": [
1
],
"events": [
"enqueued",
"claimed",
"ready",
"staging_deleted",
"duplicate_ignored"
],
"outbox": [
{
"id": 107,
"attempt": "1",
"available_at": "2026-11-13T13:23:48.361567Z",
"created_at": "2026-11-13T13:23:48.361567Z",
"published_at": "2026-11-13T13:23:49.734047Z",
"publish_count": 1
}
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 1
}
},
"D": {
"attachment_id": "5778567a-0d6c-4322-b0e0-31a17a40994f",
"client_saw": "missing X-Instance-Id",
"events": [
"enqueued",
"claimed",
"ready",
"staging_deleted"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 1
}
},
"E": {
"attachment_id": "5b7070f4-ece0-49d9-bef4-1d704222955f",
"janitor_dry_run": {
"abandoned_pending": 1,
"orphan_objects": 0,
"deleted_objects": 0,
"deleted_rows": 0
},
"janitor": {
"abandoned_pending": 1,
"orphan_objects": 0,
"deleted_objects": 1,
"deleted_rows": 1,
"missing_objects": 0
},
"row_gone": true
}
}
}
+11
View File
@@ -0,0 +1,11 @@
# 2026-11-13T13:23:18Z python3 student-tests/outbox_gap.py --output evidence/outbox-gap.json
[ 6.31s] A: relay stopped, upload 202 {"attachment_id": "41a53cd8-7e57-44b8-9c9f-12320b323750", "outbox": [{"id": 105, "attempt": "1", "available_at": "2026-11-13T13:23:19.956776Z", "created_at": "2026-11-13T13:23:19.956776Z", "published_at": null, "publish_count": 0}], "queue": {"messages": 0, "messages_ready": 0, "messages_unacknowledged": 0, "consumers": 4}}
[ 12.77s] A: relay started -> ready, same single job {"attachment_id": "41a53cd8-7e57-44b8-9c9f-12320b323750", "events": ["enqueued", "claimed", "ready", "staging_deleted"], "outbox": [{"id": 105, "attempt": "1", "available_at": "2026-11-13T13:23:19.956776Z", "created_at": "2026-11-13T13:23:19.956776Z", "published_at": "2026-11-13T13:23:26.328881Z", "publish_count": 1}], "jobs": 1, "invariants": {"variants": ["crop", "optimized", "thumbnail"], "variants_ok": true, "final_objects": 4, "final_objects_ok": true, "staging_left": false, "job_status": "ready", "attempt": 1}}
[ 23.48s] B: relay crashed between COMMIT and publish -> restarted -> ready {"attachment_id": "a2401b04-a5db-4026-adc4-01d5040fdd2c", "relay_restart_count": [[0], [1]], "events": ["enqueued", "claimed", "ready", "staging_deleted"], "outbox": [{"id": 106, "attempt": "1", "available_at": "2026-11-13T13:23:38.382769Z", "created_at": "2026-11-13T13:23:38.382769Z", "published_at": "2026-11-13T13:23:40.445416Z", "publish_count": 1}], "invariants": {"variants": ["crop", "optimized", "thumbnail"], "variants_ok": true, "final_objects": 4, "final_objects_ok": true, "staging_left": false, "job_status": "ready", "attempt": 1}}
[ 32.98s] C: published twice (crash before marking) -> duplicate is a no-op {"attachment_id": "85b3ce6d-b06a-49ab-bc80-07be18cfd5d9", "relay_restart_count": [1], "events": ["enqueued", "claimed", "ready", "staging_deleted", "duplicate_ignored"], "outbox": [{"id": 107, "attempt": "1", "available_at": "2026-11-13T13:23:48.361567Z", "created_at": "2026-11-13T13:23:48.361567Z", "published_at": "2026-11-13T13:23:49.734047Z", "publish_count": 1}], "invariants": {"variants": ["crop", "optimized", "thumbnail"], "variants_ok": true, "final_objects": 4, "final_objects_ok": true, "staging_left": false, "job_status": "ready", "attempt": 1}}
[ 49.85s] D: API died after COMMIT before 202 -> work still completed {"attachment_id": "5778567a-0d6c-4322-b0e0-31a17a40994f", "client_saw": "missing X-Instance-Id", "events": ["enqueued", "claimed", "ready", "staging_deleted"], "invariants": {"variants": ["crop", "optimized", "thumbnail"], "variants_ok": true, "final_objects": 4, "final_objects_ok": true, "staging_left": false, "job_status": "ready", "attempt": 1}}
[ 50.15s] E: API died after staging before COMMIT {"attachment_id": "5b7070f4-ece0-49d9-bef4-1d704222955f", "client_saw": "missing X-Instance-Id", "status": "pending", "jobs": 0, "api_get": 404}
[ 58.86s] E: janitor removed pending row and staging object {"attachment_id": "5b7070f4-ece0-49d9-bef4-1d704222955f", "janitor_dry_run": {"abandoned_pending": 1, "orphan_objects": 0, "deleted_objects": 0, "deleted_rows": 0}, "janitor": {"abandoned_pending": 1, "orphan_objects": 0, "deleted_objects": 1, "deleted_rows": 1, "missing_objects": 0}, "row_gone": true}
[ 74.96s] relay and api restored to .env configuration
PASS: outbox closes COMMIT/publish gap; API crash windows handled
exit=0
+5
View File
@@ -0,0 +1,5 @@
# 2026-11-13T13:19:16Z make test-persistence ACTION_SCRIPT=scripts/restart.sh
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080"
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
+5
View File
@@ -0,0 +1,5 @@
# 2026-11-13T13:26:14Z docker compose exec -T broker rabbitmqctl -q -p messenger list_queues name type durable messages consumers
name type durable messages consumers
attachments.dlq quorum true 0 0
attachments.process.v1 quorum true 0 4
exit=0
+29
View File
@@ -0,0 +1,29 @@
# 2026-11-13T13:25:40Z docker compose --profile tools run --rm -T checks /app/student-tests/s3_private_check.py
PASS api: PutObject в свой bucket expected=allowed got=allowed
PASS anonymous GET object expected=403 got=403
PASS anonymous ListBucket expected=403 got=403
PASS anonymous ListAllMyBuckets expected=403 got=403
PASS anonymous PUT object expected=403 got=403
PASS api: GetObject expected=allowed got=allowed
PASS api: ListBucket expected=denied got=AccessDenied
PASS api: CreateBucket expected=denied got=AccessDenied
PASS api: DeleteBucket expected=denied got=AccessDenied
PASS api: PutBucketPolicy (сделать публичным) expected=denied got=AccessDenied
PASS janitor: GetObject (чтение содержимого) expected=denied got=AccessDenied
PASS janitor: ListBucket expected=allowed got=allowed
PASS janitor: CreateBucket expected=denied got=AccessDenied
PASS worker: GetObject (чтение staging) expected=allowed got=allowed
PASS worker: PutObject (результат) expected=allowed got=allowed
PASS worker: DeleteObject (очистка staging) expected=allowed got=allowed
PASS worker: ListBucket expected=denied got=AccessDenied
PASS worker: CreateBucket expected=denied got=AccessDenied
PASS api: DeleteObject (компенсация) expected=allowed got=allowed
PASS port 9333 (master UI/API) из backend-сети expected=closed got=closed
PASS port 8080 (volume) из backend-сети expected=closed got=closed
PASS port 8888 (filer UI/API) из backend-сети expected=closed got=closed
PASS port 8111 (IAM API) из backend-сети expected=closed got=closed
PASS port 8181 (Iceberg) из backend-сети expected=closed got=closed
PASS port 9101 (Lance) из backend-сети expected=closed got=closed
PASS port 8333 (S3 API) из backend-сети expected=open got=open
{"checks": 26, "failed": 0}
exit=0
+4
View File
@@ -0,0 +1,4 @@
# 2026-11-13T13:19:14Z make test
python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab5 public API scenario; infrastructure and grading evidence remain separate.
exit=0
+98
View File
@@ -0,0 +1,98 @@
{
"cases": [
{
"exit": 0,
"class": "ok",
"seconds": 0.13,
"case": "valid 640x480",
"expected": "ok",
"input_bytes": 1949,
"env": {},
"pass": true
},
{
"exit": 4,
"class": "image_too_large",
"seconds": 0.1,
"case": "49 Mpx PNG (> MAX_IMAGE_PIXELS)",
"expected": "image_too_large",
"input_bytes": 159675,
"env": {},
"pass": true
},
{
"exit": 0,
"class": "ok",
"seconds": 0.67,
"case": "36 Mpx PNG, normal limits",
"expected": "ok",
"input_bytes": 119592,
"env": {},
"pass": true
},
{
"exit": 5,
"class": "resource_limit",
"seconds": 0.11,
"case": "36 Mpx PNG, memory limit 160 MiB",
"expected": "resource_limit",
"input_bytes": 119592,
"env": {
"TRANSFORM_MEMORY_LIMIT_MB": "160"
},
"pass": true
},
{
"exit": -24,
"class": "killed_by_signal_24",
"seconds": 1.0,
"case": "40 Mpx RGBA noise PNG, CPU limit 1 s",
"expected": "killed_by_signal_24",
"input_bytes": 151852446,
"env": {
"TRANSFORM_CPU_SECONDS": "1"
},
"pass": true
},
{
"exit": "timeout",
"class": "processing_timeout",
"seconds": 0.51,
"case": "40 Mpx RGBA noise PNG, wall timeout 0.5 s",
"expected": "processing_timeout",
"input_bytes": 151852446,
"env": {},
"pass": true
},
{
"exit": 3,
"class": "invalid_image",
"seconds": 0.1,
"case": "truncated PNG",
"expected": "invalid_image",
"input_bytes": 974,
"env": {},
"pass": true
},
{
"exit": 3,
"class": "invalid_image",
"seconds": 0.1,
"case": "garbage declared as JPEG",
"expected": "invalid_image",
"input_bytes": 5003,
"env": {},
"pass": true
},
{
"exit": 3,
"class": "invalid_image",
"seconds": 0.11,
"case": "PNG declared as JPEG",
"expected": "invalid_image",
"input_bytes": 1949,
"env": {},
"pass": true
}
]
}
+12
View File
@@ -0,0 +1,12 @@
# 2026-11-13T13:20:56Z docker compose --profile tools run --rm -T checks /app/student-tests/transform_limits.py --output /app/evidence/transform-limits.json
PASS valid 640x480 -> ok (0.13s)
PASS 49 Mpx PNG (> MAX_IMAGE_PIXELS) -> image_too_large (0.10s)
PASS 36 Mpx PNG, normal limits -> ok (0.67s)
PASS 36 Mpx PNG, memory limit 160 MiB -> resource_limit (0.11s)
PASS 40 Mpx RGBA noise PNG, CPU limit 1 s -> killed_by_signal_24 (1.00s)
PASS 40 Mpx RGBA noise PNG, wall timeout 0.5 s -> processing_timeout (0.51s)
PASS truncated PNG -> invalid_image (0.10s)
PASS garbage declared as JPEG -> invalid_image (0.10s)
PASS PNG declared as JPEG -> invalid_image (0.11s)
PASS 9/9
exit=0
+287
View File
@@ -0,0 +1,287 @@
{
"cases": [
{
"case": "fixture 320x200 PNG",
"source_oriented": [
320,
200
],
"variants": {
"thumbnail": {
"size": [
256,
160
],
"format": "JPEG",
"bytes": 4679,
"no_exif_icc": true
},
"crop": {
"size": [
128,
128
],
"format": "JPEG",
"bytes": 1820,
"no_exif_icc": true
},
"optimized": {
"size": [
320,
200
],
"format": "WEBP",
"bytes": 2462,
"no_exif_icc": true
}
}
},
{
"case": "RGBA 300x300 half transparent",
"source_oriented": [
300,
300
],
"variants": {
"thumbnail": {
"size": [
256,
256
],
"format": "JPEG",
"bytes": 957,
"no_exif_icc": true,
"transparent_pixel_rgb": [
255,
255,
255
]
},
"crop": {
"size": [
128,
128
],
"format": "JPEG",
"bytes": 619,
"no_exif_icc": true,
"transparent_pixel_rgb": [
255,
255,
255
]
},
"optimized": {
"size": [
300,
300
],
"format": "WEBP",
"bytes": 350,
"no_exif_icc": true
}
}
},
{
"case": "JPEG 400x200 EXIF orientation=6",
"source_oriented": [
200,
400
],
"variants": {
"thumbnail": {
"size": [
128,
256
],
"format": "JPEG",
"bytes": 861,
"no_exif_icc": true,
"left_rgb": [
0,
0,
254
],
"right_rgb": [
254,
0,
0
]
},
"crop": {
"size": [
128,
128
],
"format": "JPEG",
"bytes": 578,
"no_exif_icc": true
},
"optimized": {
"size": [
200,
400
],
"format": "WEBP",
"bytes": 374,
"no_exif_icc": true
}
}
},
{
"case": "tiny PNG 10x5 (no upscale)",
"source_oriented": [
10,
5
],
"variants": {
"thumbnail": {
"size": [
10,
5
],
"format": "JPEG",
"bytes": 288,
"no_exif_icc": true
},
"crop": {
"size": [
128,
128
],
"format": "JPEG",
"bytes": 383,
"no_exif_icc": true
},
"optimized": {
"size": [
10,
5
],
"format": "WEBP",
"bytes": 68,
"no_exif_icc": true
}
}
},
{
"case": "JPEG 3000x2000",
"source_oriented": [
3000,
2000
],
"variants": {
"thumbnail": {
"size": [
256,
170
],
"format": "JPEG",
"bytes": 2556,
"no_exif_icc": true
},
"crop": {
"size": [
128,
128
],
"format": "JPEG",
"bytes": 1230,
"no_exif_icc": true
},
"optimized": {
"size": [
1280,
853
],
"format": "WEBP",
"bytes": 5144,
"no_exif_icc": true
}
}
},
{
"case": "tall PNG 100x1000",
"source_oriented": [
100,
1000
],
"variants": {
"thumbnail": {
"size": [
25,
256
],
"format": "JPEG",
"bytes": 334,
"no_exif_icc": true
},
"crop": {
"size": [
128,
128
],
"format": "JPEG",
"bytes": 382,
"no_exif_icc": true
},
"optimized": {
"size": [
100,
1000
],
"format": "WEBP",
"bytes": 272,
"no_exif_icc": true
}
}
},
{
"case": "palette PNG with transparency",
"source_oriented": [
64,
64
],
"variants": {
"thumbnail": {
"size": [
64,
64
],
"format": "JPEG",
"bytes": 308,
"no_exif_icc": true,
"transparent_pixel_rgb": [
255,
255,
255
]
},
"crop": {
"size": [
128,
128
],
"format": "JPEG",
"bytes": 380,
"no_exif_icc": true,
"transparent_pixel_rgb": [
255,
255,
255
]
},
"optimized": {
"size": [
64,
64
],
"format": "WEBP",
"bytes": 130,
"no_exif_icc": true
}
}
}
],
"unknown_variant_status": 400
}
+10
View File
@@ -0,0 +1,10 @@
# 2026-11-13T13:20:54Z docker compose --profile tools run --rm -T checks /app/student-tests/variants_check.py --base-url http://lb:8080 --output /app/evidence/variants-check.json
PASS fixture 320x200 PNG {'thumbnail': (256, 160), 'crop': (128, 128), 'optimized': (320, 200)}
PASS RGBA 300x300 half transparent {'thumbnail': (256, 256), 'crop': (128, 128), 'optimized': (300, 300)}
PASS JPEG 400x200 EXIF orientation=6 {'thumbnail': (128, 256), 'crop': (128, 128), 'optimized': (200, 400)}
PASS tiny PNG 10x5 (no upscale) {'thumbnail': (10, 5), 'crop': (128, 128), 'optimized': (10, 5)}
PASS JPEG 3000x2000 {'thumbnail': (256, 170), 'crop': (128, 128), 'optimized': (1280, 853)}
PASS tall PNG 100x1000 {'thumbnail': (25, 256), 'crop': (128, 128), 'optimized': (100, 1000)}
PASS palette PNG with transparency {'thumbnail': (64, 64), 'crop': (128, 128), 'optimized': (64, 64)}
PASS: 7 inputs, all variants match contract
exit=0
+416
View File
@@ -0,0 +1,416 @@
{
"scenario": "worker faults, retries, failed registry, replay, DLQ",
"date_utc": "2026-11-13T13:23:18+00:00",
"steps": [
{
"t": 7.26,
"utc": "13:21:13.790",
"step": "workers recreated with fault injection",
"env": {
"WORKER_FAULT_INJECTION": "1",
"JOB_RETRY_BASE_SECONDS": "1",
"JOB_RETRY_MAX_SECONDS": "8"
}
},
{
"t": 40.75,
"utc": "13:21:47.283",
"step": "crash-after-claim",
"events": [
"enqueued",
"claimed",
"fault_injected",
"busy_ignored",
"lease_expired",
"requeued_after_lease",
"claimed",
"ready",
"staging_deleted"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 2
}
},
{
"t": 76.1,
"utc": "13:22:22.637",
"step": "crash-after-s3-put",
"events": [
"enqueued",
"claimed",
"fault_injected",
"busy_ignored",
"lease_expired",
"requeued_after_lease",
"claimed",
"ready",
"staging_deleted"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 2
}
},
{
"t": 80.78,
"utc": "13:22:27.315",
"step": "crash-after-commit",
"events": [
"enqueued",
"claimed",
"ready",
"fault_injected",
"duplicate_ignored",
"staging_deleted"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 1
}
},
{
"t": 80.92,
"utc": "13:22:27.454",
"step": "worker containers after crashes (restart: unless-stopped)",
"containers": [
"/mtusi-lab5-worker-1 1 running",
"/mtusi-lab5-worker-2 2 running"
]
},
{
"t": 85.17,
"utc": "13:22:31.709",
"step": "transient-2: retried with backoff",
"delays": [
0.952,
1.513
],
"bounds": [
[
0.5,
1
],
[
1.0,
2
]
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 3
}
},
{
"t": 101.04,
"utc": "13:22:47.577",
"step": "transient-always: failed after max attempts",
"error_code": "retry_exhausted",
"attempts": 5,
"content": 409,
"attach": 409,
"registry_entry": {
"attachment_id": "8a6dc0d1-e4eb-4187-9618-09148e913ebc",
"job_id": "1a212af1-07fd-4afe-a5bd-4342839a3e8e",
"error_code": "retry_exhausted",
"attempt": 5,
"max_attempts": 5,
"replay_count": 0,
"last_error": "last error: storage_unavailable injected transient error",
"updated_at": "2026-11-13T13:22:45.859850Z",
"replayable": true
}
},
{
"t": 104.53,
"utc": "13:22:51.067",
"step": "replay -> ready; replay of ready refused",
"attachment_id": "8a6dc0d1-e4eb-4187-9618-09148e913ebc",
"dry_run": "would_replay",
"replay": "replayed",
"second_replay": "refused_status_ready",
"replay_count": 1,
"events": [
"enqueued",
"claimed",
"retry_scheduled",
"claimed",
"retry_scheduled",
"claimed",
"retry_scheduled",
"claimed",
"retry_scheduled",
"claimed",
"failed",
"replayed",
"claimed",
"ready",
"staging_deleted"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 6
}
},
{
"t": 113.33,
"utc": "13:22:59.866",
"step": "tampered staging -> failed without retries",
"attachment_id": "dddc059c-a98e-4150-b866-dbdbfeb875f2",
"error_code": "staging_corrupted",
"attempts": 1,
"events": [
"enqueued",
"claimed",
"failed"
]
},
{
"t": 125.06,
"utc": "13:23:11.590",
"step": "poison message dead-lettered and purged",
"dlq_before": 0,
"dlq_after_publish": 1,
"listed": [
{
"reason": "rejected",
"delivery_count": 1,
"action": "kept",
"invalid": "extra fields"
}
],
"purged": [
"purged_invalid"
],
"dlq_after_purge": 0
},
{
"t": 131.72,
"utc": "13:23:18.259",
"step": "workers restored to .env configuration"
}
],
"results": {
"crash-after-claim": {
"attachment_id": "93dccce9-b04b-4317-a72e-68f43e719634",
"events": [
"enqueued",
"claimed",
"fault_injected",
"busy_ignored",
"lease_expired",
"requeued_after_lease",
"claimed",
"ready",
"staging_deleted"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 2
}
},
"crash-after-s3-put": {
"attachment_id": "da8e1461-70e0-431d-81da-d993cca01288",
"events": [
"enqueued",
"claimed",
"fault_injected",
"busy_ignored",
"lease_expired",
"requeued_after_lease",
"claimed",
"ready",
"staging_deleted"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 2
}
},
"crash-after-commit": {
"attachment_id": "1379cce6-0c65-40cf-a575-61a7f643ea07",
"events": [
"enqueued",
"claimed",
"ready",
"fault_injected",
"duplicate_ignored",
"staging_deleted"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 1
}
},
"transient-2": {
"attachment_id": "58756a3d-8bb3-4aad-bb47-f1b4c4b0696e",
"delays": [
0.952,
1.513
],
"bounds": [
[
0.5,
1
],
[
1.0,
2
]
],
"claims_at": [
"2026-11-13T13:22:27.471179Z",
"2026-11-13T13:22:28.490332Z",
"2026-11-13T13:22:30.531633Z"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 3
}
},
"transient-always+replay": {
"attachment_id": "8a6dc0d1-e4eb-4187-9618-09148e913ebc",
"dry_run": "would_replay",
"replay": "replayed",
"second_replay": "refused_status_ready",
"replay_count": 1,
"events": [
"enqueued",
"claimed",
"retry_scheduled",
"claimed",
"retry_scheduled",
"claimed",
"retry_scheduled",
"claimed",
"retry_scheduled",
"claimed",
"failed",
"replayed",
"claimed",
"ready",
"staging_deleted"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 6
}
},
"staging-tamper": {
"attachment_id": "dddc059c-a98e-4150-b866-dbdbfeb875f2",
"error_code": "staging_corrupted",
"attempts": 1,
"events": [
"enqueued",
"claimed",
"failed"
]
},
"poison": {
"dlq_before": 0,
"dlq_after_publish": 1,
"listed": [
{
"reason": "rejected",
"delivery_count": 1,
"action": "kept",
"invalid": "extra fields"
}
],
"purged": [
"purged_invalid"
],
"dlq_after_purge": 0
}
}
}
+14
View File
@@ -0,0 +1,14 @@
# 2026-11-13T13:21:06Z python3 student-tests/worker_faults.py --output evidence/worker-faults.json
[ 7.26s] workers recreated with fault injection {"env": {"WORKER_FAULT_INJECTION": "1", "JOB_RETRY_BASE_SECONDS": "1", "JOB_RETRY_MAX_SECONDS": "8"}}
[ 40.75s] crash-after-claim {"events": ["enqueued", "claimed", "fault_injected", "busy_ignored", "lease_expired", "requeued_after_lease", "claimed", "ready", "staging_deleted"], "invariants": {"variants": ["crop", "optimized", "thumbnail"], "variants_ok": true, "final_objects": 4, "final_objects_ok": true, "staging_left": false, "job_status": "ready", "attempt": 2}}
[ 76.10s] crash-after-s3-put {"events": ["enqueued", "claimed", "fault_injected", "busy_ignored", "lease_expired", "requeued_after_lease", "claimed", "ready", "staging_deleted"], "invariants": {"variants": ["crop", "optimized", "thumbnail"], "variants_ok": true, "final_objects": 4, "final_objects_ok": true, "staging_left": false, "job_status": "ready", "attempt": 2}}
[ 80.78s] crash-after-commit {"events": ["enqueued", "claimed", "ready", "fault_injected", "duplicate_ignored", "staging_deleted"], "invariants": {"variants": ["crop", "optimized", "thumbnail"], "variants_ok": true, "final_objects": 4, "final_objects_ok": true, "staging_left": false, "job_status": "ready", "attempt": 1}}
[ 80.92s] worker containers after crashes (restart: unless-stopped) {"containers": ["/mtusi-lab5-worker-1 1 running", "/mtusi-lab5-worker-2 2 running"]}
[ 85.17s] transient-2: retried with backoff {"delays": [0.952, 1.513], "bounds": [[0.5, 1], [1.0, 2]], "invariants": {"variants": ["crop", "optimized", "thumbnail"], "variants_ok": true, "final_objects": 4, "final_objects_ok": true, "staging_left": false, "job_status": "ready", "attempt": 3}}
[ 101.04s] transient-always: failed after max attempts {"error_code": "retry_exhausted", "attempts": 5, "content": 409, "attach": 409, "registry_entry": {"attachment_id": "8a6dc0d1-e4eb-4187-9618-09148e913ebc", "job_id": "1a212af1-07fd-4afe-a5bd-4342839a3e8e", "error_code": "retry_exhausted", "attempt": 5, "max_attempts": 5, "replay_count": 0, "last_error": "last error: storage_unavailable injected transient error", "updated_at": "2026-11-13T13:22:45.859850Z", "replayable": true}}
[ 104.53s] replay -> ready; replay of ready refused {"attachment_id": "8a6dc0d1-e4eb-4187-9618-09148e913ebc", "dry_run": "would_replay", "replay": "replayed", "second_replay": "refused_status_ready", "replay_count": 1, "events": ["enqueued", "claimed", "retry_scheduled", "claimed", "retry_scheduled", "claimed", "retry_scheduled", "claimed", "retry_scheduled", "claimed", "failed", "replayed", "claimed", "ready", "staging_deleted"], "invariants": {"variants": ["crop", "optimized", "thumbnail"], "variants_ok": true, "final_objects": 4, "final_objects_ok": true, "staging_left": false, "job_status": "ready", "attempt": 6}}
[ 113.33s] tampered staging -> failed without retries {"attachment_id": "dddc059c-a98e-4150-b866-dbdbfeb875f2", "error_code": "staging_corrupted", "attempts": 1, "events": ["enqueued", "claimed", "failed"]}
[ 125.06s] poison message dead-lettered and purged {"dlq_before": 0, "dlq_after_publish": 1, "listed": [{"reason": "rejected", "delivery_count": 1, "action": "kept", "invalid": "extra fields"}], "purged": ["purged_invalid"], "dlq_after_purge": 0}
[ 131.72s] workers restored to .env configuration
PASS: worker crashes, backoff, retry_exhausted -> replay, staging tamper, DLQ
exit=0
+185
View File
@@ -0,0 +1,185 @@
{
"scenario": "worker outage -> restart api+broker -> worker start -> ready -> redelivery",
"date_utc": "2026-11-13T13:20:54+00:00",
"steps": [
{
"t": 1.69,
"utc": "13:20:27.997",
"step": "worker stopped",
"running": []
},
{
"t": 2.72,
"utc": "13:20:29.021",
"step": "upload while worker is down",
"http": 202,
"attachment_id": "d5d38cb6-d3e7-424b-8dc6-33270c9df865",
"status": "queued"
},
{
"t": 2.72,
"utc": "13:20:29.031",
"step": "metadata and content while queued",
"status": "queued",
"content": 409,
"thumbnail": 409,
"error_code": "conflict"
},
{
"t": 2.73,
"utc": "13:20:29.041",
"step": "messages while worker is down",
"with_queued_attachment": true,
"plain_message_id": "10afa020-6afb-4516-853f-2254f37ed7c7"
},
{
"t": 6.56,
"utc": "13:20:32.862",
"step": "job is durable in broker",
"queue": {
"messages": 1,
"messages_ready": 1,
"messages_unacknowledged": 0,
"consumers": 0
},
"outbox_published": true,
"job_id": "41ad5bea-d05d-42b4-a450-d47690ef998c",
"job_status": "queued"
},
{
"t": 16.02,
"utc": "13:20:42.330",
"step": "api restarted",
"status": "queued"
},
{
"t": 21.07,
"utc": "13:20:47.381",
"step": "broker restarted with volume",
"queue": {
"messages": 1,
"messages_ready": 1,
"messages_unacknowledged": 0,
"consumers": 0
},
"status": "queued"
},
{
"t": 26.86,
"utc": "13:20:53.167",
"step": "worker started"
},
{
"t": 26.89,
"utc": "13:20:53.196",
"step": "ready after worker start",
"variants": [
[
"thumbnail",
256,
160
],
[
"crop",
128,
128
],
[
"optimized",
320,
200
]
],
"original_sha256_ok": true,
"thumbnail_bytes": 4679
},
{
"t": 28.47,
"utc": "13:20:54.779",
"step": "redelivery of the same job is a no-op",
"events": [
"enqueued",
"claimed",
"ready",
"staging_deleted",
"duplicate_ignored"
],
"invariants": {
"variants": [
"crop",
"optimized",
"thumbnail"
],
"variants_ok": true,
"final_objects": 4,
"final_objects_ok": true,
"staging_left": false,
"job_status": "ready",
"attempt": 1
}
}
],
"attachment_id": "d5d38cb6-d3e7-424b-8dc6-33270c9df865",
"job_id": "41ad5bea-d05d-42b4-a450-d47690ef998c",
"events": [
{
"job_id": "41ad5bea-d05d-42b4-a450-d47690ef998c",
"at": "2026-11-13T13:20:29.018662Z",
"event": "enqueued",
"attempt": 1,
"actor": "api",
"detail": null
},
{
"job_id": "41ad5bea-d05d-42b4-a450-d47690ef998c",
"at": "2026-11-13T13:20:47.938036Z",
"event": "claimed",
"attempt": 1,
"actor": "c2f424ff165b:fa6a01e0",
"detail": {
"redelivered_message_attempt": 1
}
},
{
"job_id": "41ad5bea-d05d-42b4-a450-d47690ef998c",
"at": "2026-11-13T13:20:48.074885Z",
"event": "ready",
"attempt": 1,
"actor": "c2f424ff165b:fa6a01e0",
"detail": {
"variants": {
"crop": [
128,
128
],
"optimized": [
320,
200
],
"thumbnail": [
256,
160
]
}
}
},
{
"job_id": "41ad5bea-d05d-42b4-a450-d47690ef998c",
"at": "2026-11-13T13:20:48.076077Z",
"event": "staging_deleted",
"attempt": 1,
"actor": "c2f424ff165b:fa6a01e0",
"detail": null
},
{
"job_id": "41ad5bea-d05d-42b4-a450-d47690ef998c",
"at": "2026-11-13T13:20:53.879984Z",
"event": "duplicate_ignored",
"attempt": 1,
"actor": "c2f424ff165b:fa6a01e0",
"detail": {
"status": "ready"
}
}
]
}
+13
View File
@@ -0,0 +1,13 @@
# 2026-11-13T13:20:26Z python3 student-tests/worker_outage.py --output evidence/worker-outage.json
[ 1.69s] worker stopped {"running": []}
[ 2.72s] upload while worker is down {"http": 202, "attachment_id": "d5d38cb6-d3e7-424b-8dc6-33270c9df865", "status": "queued"}
[ 2.72s] metadata and content while queued {"status": "queued", "content": 409, "thumbnail": 409, "error_code": "conflict"}
[ 2.73s] messages while worker is down {"with_queued_attachment": true, "plain_message_id": "10afa020-6afb-4516-853f-2254f37ed7c7"}
[ 6.56s] job is durable in broker {"queue": {"messages": 1, "messages_ready": 1, "messages_unacknowledged": 0, "consumers": 0}, "outbox_published": true, "job_id": "41ad5bea-d05d-42b4-a450-d47690ef998c", "job_status": "queued"}
[ 16.02s] api restarted {"status": "queued"}
[ 21.07s] broker restarted with volume {"queue": {"messages": 1, "messages_ready": 1, "messages_unacknowledged": 0, "consumers": 0}, "status": "queued"}
[ 26.86s] worker started
[ 26.89s] ready after worker start {"variants": [["thumbnail", 256, 160], ["crop", 128, 128], ["optimized", 320, 200]], "original_sha256_ok": true, "thumbnail_bytes": 4679}
[ 28.47s] redelivery of the same job is a no-op {"events": ["enqueued", "claimed", "ready", "staging_deleted", "duplicate_ignored"], "invariants": {"variants": ["crop", "optimized", "thumbnail"], "variants_ok": true, "final_objects": 4, "final_objects_ok": true, "staging_left": false, "job_status": "ready", "attempt": 1}}
PASS: worker outage, api+broker restart, ready, duplicate delivery no-op
exit=0