diff --git a/evidence/sqlalchemy-2026-11-06/grade3/NOTES.md b/evidence/sqlalchemy-2026-11-06/grade3/NOTES.md new file mode 100644 index 00000000..66edab18 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/NOTES.md @@ -0,0 +1,28 @@ +# Уровень 3: данные для отдельного REPORT + +2026-11-06 UTC. Код и suite: 24a51744f521aa585e50a931d0a0219d2e960197. +Основа перенесена из immutable snapshot ЛР4 d7478726a85791c21e065d58f610735a9e687433. +Все команды, UTC, SHA и exit code — в соседних txt; JSON содержит наблюдения приложения. +Один project mtusi2026lab5, API 18085, stats 25085, broker UI 25086; NO_PROXY=localhost,127.0.0.1,::1. + +| Критерий README | Команда (после export переменных из txt) | Наблюдение | Файл | +| --- | --- | --- | --- | +| Минимум lab4, форматы, приватность | make test; pytest -m stack -k user_errors student-tests/stack/test_attachment_faults.py; sh scripts/s3-check.sh | Smoke PASS, PNG/JPEG и негативные коды, чужой доступ 404, прямой S3 403, private bucket | smoke.txt, upload-negative.txt, s3-security.txt | +| Сохранность и другая реплика | make test-persistence ACTION_SCRIPT=scripts/restart.sh; make test-failover ACTION_SCRIPT=scripts/stop-one.sh; python3 scripts/lab4_scenarios.py failover-upload --restore | Подтверждённые данные и сессия сохранены; 133 записи без ошибок; загрузившая реплика exited, другая отдаёт тот же sha256 | persistence.txt, persistence-scope.txt, failover.txt, hook-events.txt, upload-failover.json | +| Durable transport и отдельный worker | python3 scripts/pipeline_evidence.py; rabbitmqctl list_queues/list_consumers/list_permissions | Durable quorum, delivery_mode=2, ровно 7 полей payload, ручное подтверждение, prefetch=2; роли без configure | pipeline-ack.txt, queues.txt, consumers.txt, permissions.txt | +| queued/processing/ready/failed, оригинал и thumbnail | python3 scripts/pipeline_suite.py --level 3 --output …/level3.json | 6 сценариев PASS, 5 принятых заданий терминальны; 4 ready с проверенными байтами/размерами, 1 failed после 5 попыток | level3.json, level3.txt | +| Остановленный worker, рестарт API/broker | тот же suite, worker_down_broker_restart | docker ps -a фиксирует worker exited; 202 queued, content 409, сообщение 201, очередь пережила рестарт, затем ready | level3.json | +| Retry и повтор доставки | тот же suite, s3_outage_recovers/retry_exhausted/duplicate_after_ready | Временный отказ восстановлен на attempt=2; лимит 5; duplicate_noop, снимок результата не меняется | level3.json | +| Недоступность S3 | python3 scripts/lab4_scenarios.py s3-outage --restore | upload/download 503 ограничены по времени, текст 201, после восстановления hash совпадает | s3-outage.json | +| Локальные проверки | make check validate lint; make student-test PYTEST_ARGS=--tb=short | PASS; 495 passed, 1 skipped, 19 deselected | check.txt, student-test.txt | + +FastStream AckPolicy.MANUAL вызывает ack только после bus.execute(ProcessJob), а обработчик фиксирует результат, retry либо fenced/noop транзакцией до возврата. Publisher использует mandatory/persist и проверяет Basic.Ack. Код: attachments/entrypoints/worker.py, application/pipeline.py, infrastructure/rabbitmq.py. Окно COMMIT→ack отдельно проверяется уровнем 4. Документация проверена через Context7: https://github.com/ag2ai/faststream/blob/0.7.2/docs/docs/en/getting-started/acknowledgement.md. + +## Ограничения и findings + +- limits.txt имеет exit_code=1: ошибочное сравнение порядка одинакового набора имён secrets в scripts/limits.py. Это minor; PASS этой команде не присваивается. Таблица фактических CPU/RAM/портов корректна. См. findings.json. +- Старый scripts/reconcile_track.py предназначен для синхронной ЛР4, для ЛР5 не запускался и не является evidence (minor). +- Один RLIMIT_AS тест пропущен на macOS; реальный Linux memory/time сценарий относится к следующему циклу. +- no_orphans в этом запуске проверяет PostgreSQL/outbox/очередь/staging metadata, полная инвентаризация S3 отмечена SKIP. Это не доказательство отсутствия любых объектов во всём сохранённом bucket. +- Две старые записи DLQ сохранены; suite проверяет приращение относительно исходного значения. Volumes не очищались. +- Данные синтетические; производительность здесь не исследуется. Итоговый REPORT и нагрузочная публикационная фаза не входят в этот цикл. diff --git a/evidence/sqlalchemy-2026-11-06/grade3/check.txt b/evidence/sqlalchemy-2026-11-06/grade3/check.txt new file mode 100644 index 00000000..93f244bf --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/check.txt @@ -0,0 +1,14 @@ +date: 2026-11-06T06:19:54Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ make check validate lint +python3 scripts/check_contract.py +PASS: offline skeleton structure, local refs and Python syntax; application NOT tested. +.venv/bin/python scripts/validate_openapi.py +PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested. +.venv/bin/ruff check src student-tests scripts/capture_evidence.py alembic scripts/scaling.py tools scripts/probe.py scripts/limits.py scripts/lab4_scenarios.py scripts/lab4_seed.py scripts/upload_memory.py scripts/reconcile_check.py scripts/reconcile_track.py scripts/make_images.py scripts/pipeline_suite.py scripts/pipeline_evidence.py +All checks passed! +.venv/bin/ruff format --check src student-tests scripts/capture_evidence.py alembic scripts/scaling.py tools scripts/probe.py scripts/limits.py scripts/lab4_scenarios.py scripts/lab4_seed.py scripts/upload_memory.py scripts/reconcile_check.py scripts/reconcile_track.py scripts/make_images.py scripts/pipeline_suite.py scripts/pipeline_evidence.py +181 files already formatted +.venv/bin/ty check src student-tests alembic +All checks passed! +exit_code: 0 elapsed_seconds: 0.731 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/consumers.txt b/evidence/sqlalchemy-2026-11-06/grade3/consumers.txt new file mode 100644 index 00000000..7e35e3e3 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/consumers.txt @@ -0,0 +1,6 @@ +date: 2026-11-06T06:26:11Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ docker compose exec -T broker rabbitmqctl -q list_consumers -p messenger queue_name ack_required prefetch_count +queue_name ack_required prefetch_count +attachments.process true 2 +exit_code: 0 elapsed_seconds: 0.568 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/failover.txt b/evidence/sqlalchemy-2026-11-06/grade3/failover.txt new file mode 100644 index 00000000..2a5d7db9 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/failover.txt @@ -0,0 +1,8 @@ +date: 2026-11-06T06:22:57Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh +python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:18085" +Executing explicit failover hook; hook output suppressed to avoid leaking secrets. +{"observed_instances_before": 2, "successful_writes": 133, "failed_attempts": 0, "first_recovery_seconds": 2.834} +PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. +exit_code: 0 elapsed_seconds: 17.099 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/findings.json b/evidence/sqlalchemy-2026-11-06/grade3/findings.json new file mode 100644 index 00000000..d3145e03 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/findings.json @@ -0,0 +1,12 @@ +[ + { + "severity": "minor", + "file": "scripts/limits.py:14", + "problem": "S3_CLIENT_SECRETS не отсортирован, declared() сравнивает с sorted(secrets). Два ложных несовпадения для s3-cli/s3-init при равных множествах имён; limits.txt exit_code=1. Реальные CPU/RAM и порты показаны в том же файле." + }, + { + "severity": "minor", + "file": "scripts/reconcile_track.py", + "problem": "Перенесённый демонстратор ЛР4 ожидает upload 201 и legacy prefix; не пригоден для измерений ЛР5 (унаследовано из forward-lab4-sqlalchemy-foundation/findings.json). В квалификации pipeline не используется." + } +] diff --git a/evidence/sqlalchemy-2026-11-06/grade3/hook-events.txt b/evidence/sqlalchemy-2026-11-06/grade3/hook-events.txt new file mode 100644 index 00000000..62cdcecb --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/hook-events.txt @@ -0,0 +1,6 @@ +date: 2026-11-06T06:23:25Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ docker events --since 2026-11-06T06:22:41Z --until 2026-11-06T06:23:17Z --filter type=container --filter label=com.docker.compose.project=mtusi2026lab5 --filter event=die --filter event=start --format '{{.Time}} {{.Actor.Attributes.name}} {{.ID}} {{.Action}}' +1793946181 mtusi2026lab5-api-2 3bf90c2201363f676fc63ecdb7216dd4db089a7b2c4c4c2f7982e5873a7f77ae die +1793946194 mtusi2026lab5-api-2 3bf90c2201363f676fc63ecdb7216dd4db089a7b2c4c4c2f7982e5873a7f77ae start +exit_code: 0 elapsed_seconds: 0.026 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/level3.json b/evidence/sqlalchemy-2026-11-06/grade3/level3.json new file mode 100644 index 00000000..88bc543d --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/level3.json @@ -0,0 +1,262 @@ +{ + "suite": "lab5-pipeline-idempotency", + "started_at": "2026-11-06T06:23:25.494818Z", + "source_sha": "24a51744f521aa585e50a931d0a0219d2e960197", + "config": { + "base_url": "http://127.0.0.1:18085", + "level": 3, + "only": "", + "expect_variants": "thumbnail", + "max_attempts": 5, + "stall_seconds": 15.0, + "compose": "docker compose", + "compose_faults": "docker compose -f compose.yaml -f infra/compose.faults.yaml" + }, + "invariants": [ + { + "id": "terminal", + "statement": "every 202 reaches its expected terminal state", + "result": "PASS", + "details": { + "accepted": 5 + } + }, + { + "id": "single_effect", + "statement": "one variant set per (attachment_id, pipeline_version, variant)", + "result": "PASS", + "details": { + "rows": 0 + } + }, + { + "id": "no_ready_rollback", + "statement": "ready never returns to queued or processing", + "result": "PASS", + "details": { + "traced": 5 + } + }, + { + "id": "monotonic_publication", + "statement": "published_version only moves forward", + "result": "PASS", + "details": { + "sampled": 2 + } + }, + { + "id": "bytes_match_metadata", + "statement": "sha256, size and real dimensions match served bytes", + "result": "PASS", + "details": { + "verified": 4 + } + }, + { + "id": "bounded_attempts", + "statement": "attempt <= JOB_MAX_ATTEMPTS", + "result": "PASS", + "details": { + "rows": 0 + } + }, + { + "id": "no_orphans", + "statement": "no pending outbox, messages, dead letters, staging, objects", + "result": "PASS", + "details": { + "queues": { + "attachments.process": [ + 0, + 0 + ], + "attachments.process.dlq": [ + 2, + 0 + ] + }, + "s3": "SKIP: --s3-list is not set" + } + }, + { + "id": "no_lost_202", + "statement": "every 202 is present in PostgreSQL and the API", + "result": "PASS", + "details": { + "accepted": 5 + } + } + ], + "scenarios": [ + { + "name": "smoke_pipeline", + "level": 3, + "window": "upload, ready, variants match metadata", + "seconds": 1.1, + "result": "PASS", + "observed": { + "attachment_id": "01a1af86-d946-7430-b880-50e83365cc3b", + "variants": [ + "crop", + "optimized", + "thumbnail" + ] + } + }, + { + "name": "worker_down_broker_restart", + "level": 3, + "window": "worker down, API and broker restart", + "seconds": 18.1, + "result": "PASS", + "observed": { + "attachment_id": "01a1af86-df76-7373-bfc9-a61cab48c057", + "timeline": [ + { + "at": "2026-11-06T06:23:34.259578Z", + "step": "worker stopped", + "containers": [ + "mtusi2026lab5-worker-1 7abe06a90131 exited Exited (0) Less than a second ago" + ] + }, + { + "at": "2026-11-06T06:23:34.272201Z", + "step": "upload 202 queued", + "attachment_id": "01a1af86-df76-7373-bfc9-a61cab48c057" + }, + { + "at": "2026-11-06T06:23:34.275625Z", + "step": "content 409 while queued" + }, + { + "at": "2026-11-06T06:23:34.298319Z", + "step": "message with attachment 201, other messages work", + "message_id": "01a1af86-df86-7291-81ae-a2466e7bb0e0" + }, + { + "at": "2026-11-06T06:23:37.853670Z", + "step": "job is in the broker queue", + "queues": { + "attachments.process": [ + 1, + 0 + ], + "attachments.process.dlq": [ + 2, + 0 + ] + } + }, + { + "at": "2026-11-06T06:23:43.392966Z", + "step": "API replicas and relay restarted" + }, + { + "at": "2026-11-06T06:23:48.742701Z", + "step": "broker restarted with its volume, job survived", + "queues": { + "attachments.process": [ + 1, + 0 + ], + "attachments.process.dlq": [ + 2, + 0 + ] + } + }, + { + "at": "2026-11-06T06:23:51.511587Z", + "step": "worker started" + }, + { + "at": "2026-11-06T06:23:51.742234Z", + "step": "ready", + "variants": [ + "crop", + "optimized", + "thumbnail" + ] + } + ] + } + }, + { + "name": "duplicate_after_ready", + "level": 3, + "window": "redelivery of a finished job", + "seconds": 4.5, + "result": "PASS", + "observed": { + "attachment_id": "01a1af87-23c5-7039-a066-c398a93ffd44", + "events": [ + { + "kind": "enqueued", + "attempt": 1 + }, + { + "kind": "claimed", + "attempt": 1 + }, + { + "kind": "done", + "attempt": 1 + }, + { + "kind": "duplicate_noop", + "attempt": 1 + } + ] + } + }, + { + "name": "poison_image", + "level": 3, + "window": "permanent error without retries", + "seconds": 0.0, + "result": "PASS", + "observed": { + "rejected_by_api": 415 + } + }, + { + "name": "s3_outage_recovers", + "level": 3, + "window": "transient error with retry", + "seconds": 10.8, + "result": "PASS", + "observed": { + "attachment_id": "01a1af87-36c1-7796-895d-14b5a173aa3c", + "jobs": [ + { + "job_id": "01a1af87-36ca-75b7-9fdd-5aecff44e910", + "pipeline_version": 1, + "status": "done", + "attempt": 2 + } + ] + } + }, + { + "name": "retry_exhausted", + "level": 3, + "window": "transient error until JOB_MAX_ATTEMPTS", + "seconds": 17.5, + "result": "PASS", + "observed": { + "attachment_id": "01a1af87-6e4f-7545-b41c-d24276837287", + "jobs": [ + { + "job_id": "01a1af87-6e5b-72ee-bb7a-a4a6d632c34b", + "pipeline_version": 1, + "status": "failed", + "attempt": 5 + } + ] + } + } + ], + "result": "PASS", + "finished_at": "2026-11-06T06:24:30.137680Z" +} diff --git a/evidence/sqlalchemy-2026-11-06/grade3/level3.txt b/evidence/sqlalchemy-2026-11-06/grade3/level3.txt new file mode 100644 index 00000000..888e741c --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/level3.txt @@ -0,0 +1,17 @@ +date: 2026-11-06T06:23:25Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ python3 scripts/pipeline_suite.py --level 3 --output evidence/sqlalchemy-2026-11-06/grade3/level3.json +RUN smoke_pipeline +PASS smoke_pipeline +RUN worker_down_broker_restart +PASS worker_down_broker_restart +RUN duplicate_after_ready +PASS duplicate_after_ready +RUN poison_image +PASS poison_image +RUN s3_outage_recovers +PASS s3_outage_recovers +RUN retry_exhausted +PASS retry_exhausted +PASS: lab5 pipeline suite, report evidence/sqlalchemy-2026-11-06/grade3/level3.json +exit_code: 0 elapsed_seconds: 64.695 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/limits.txt b/evidence/sqlalchemy-2026-11-06/grade3/limits.txt new file mode 100644 index 00000000..7f9148bd --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/limits.txt @@ -0,0 +1,38 @@ +date: 2026-11-06T06:25:47Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ python3 scripts/limits.py +date: 2026-11-06T06:25:48Z commit: 24a5174 +$ docker compose --profile bench --profile tools --profile reconcile config --format json (declared) +service cpus/mem ports secrets volumes networks ro user +---------- ---------- ------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- ---------------------- ----- ----------- +api 1/512MiB - cache_url,cursor_secret,database_url,s3_access_key_id,s3_secret_access_key - backend(internal) true image +broker 1/512MiB 127.0.0.1:25086 rabbitmq_ops_password,rabbitmq_users broker-data backend(internal),edge true 100:101 +k6 2/512MiB - - - edge false image +lb 1/128MiB 127.0.0.1:18085,127.0.0.1:25085 - - backend(internal),edge true image +migrate 0.5/256MiB - database_url - backend(internal) false image +postgres 2/1024MiB - postgres_password pgdata backend(internal) false 70:70 +reconciler 1/256MiB - database_url,s3_reconciler_access_key_id,s3_reconciler_secret_access_key - backend(internal) true image +relay 0.5/192MiB - broker_url_api,database_url,s3_access_key_id,s3_secret_access_key - backend(internal) true image +s3 1/512MiB - s3_root_password,s3_root_user s3data backend(internal) true image +s3-cli 0.5/64MiB - s3_access_key_id,s3_reconciler_access_key_id,s3_reconciler_secret_access_key,s3_root_password,s3_root_user,s3_secret_access_key,s3_worker_access_key_id,s3_worker_secret_access_key - backend(internal) true 65534:65534 +s3-init 0.5/64MiB - s3_access_key_id,s3_reconciler_access_key_id,s3_reconciler_secret_access_key,s3_root_password,s3_root_user,s3_secret_access_key,s3_worker_access_key_id,s3_worker_secret_access_key - backend(internal) true 65534:65534 +valkey 0.5/128MiB - valkey.conf valkeydata backend(internal) false 999:1000 +worker 2/1024MiB - broker_url_worker,database_url,s3_worker_access_key_id,s3_worker_secret_access_key - backend(internal) true image + +$ docker inspect (running containers: hostname = X-Instance-Id, applied limits) +service hostname cpus memory published +-------- ------------ ---- ------- --------------------------------------------------- +api 3bf90c220136 1 512MiB +api 6bd46345a6dc 1 512MiB +broker broker 1 512MiB 127.0.0.1:25086->15672/tcp +lb 28b60f6e6d7d 1 128MiB 127.0.0.1:18085->8080/tcp,127.0.0.1:25085->8404/tcp +postgres ad6ae244de88 2 1024MiB +relay 7e6a2b3d2f0b 0.5 192MiB +s3 330d57a8fe28 1 512MiB +valkey 06e9fd804c33 0.5 128MiB +worker bc3835aefea9 2 1024MiB + +FAIL: s3-cli: secrets ['s3_access_key_id', 's3_reconciler_access_key_id', 's3_reconciler_secret_access_key', 's3_root_password', 's3_root_user', 's3_secret_access_key', 's3_worker_access_key_id', 's3_worker_secret_access_key'], policy ['s3_access_key_id', 's3_reconciler_access_key_id', 's3_reconciler_secret_access_key', 's3_worker_access_key_id', 's3_worker_secret_access_key', 's3_root_password', 's3_root_user', 's3_secret_access_key'] +FAIL: s3-init: secrets ['s3_access_key_id', 's3_reconciler_access_key_id', 's3_reconciler_secret_access_key', 's3_root_password', 's3_root_user', 's3_secret_access_key', 's3_worker_access_key_id', 's3_worker_secret_access_key'], policy ['s3_access_key_id', 's3_reconciler_access_key_id', 's3_reconciler_secret_access_key', 's3_worker_access_key_id', 's3_worker_secret_access_key', 's3_root_password', 's3_root_user', 's3_secret_access_key'] +FAIL: 2 violation(s) +exit_code: 1 elapsed_seconds: 0.296 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/permissions.txt b/evidence/sqlalchemy-2026-11-06/grade3/permissions.txt new file mode 100644 index 00000000..2d646b56 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/permissions.txt @@ -0,0 +1,8 @@ +date: 2026-11-06T06:26:12Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ docker compose exec -T broker rabbitmqctl -q list_permissions -p messenger +user configure write read +messenger-worker ^$ ^$ ^attachments\.process$ +messenger-ops .* .* .* +messenger-api ^$ ^attachments$ ^$ +exit_code: 0 elapsed_seconds: 0.569 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/persistence-scope.txt b/evidence/sqlalchemy-2026-11-06/grade3/persistence-scope.txt new file mode 100644 index 00000000..798731c6 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/persistence-scope.txt @@ -0,0 +1,32 @@ +date: 2026-11-06T06:25:17Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ sh scripts/persistence-evidence.sh http://127.0.0.1:18085 +date: 2026-11-06T06:25:17Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +== before: service hostname StartedAt status +api 3bf90c220136 2026-11-06T06:24:36.218028629Z running +api 6bd46345a6dc 2026-11-06T06:23:40.589066048Z running +broker broker 2026-11-06T06:23:44.755337633Z running +lb 28b60f6e6d7d 2026-11-06T06:22:49.035527052Z running +migrate 88979f2e1672 2026-11-06T06:22:49.539457844Z exited +postgres ad6ae244de88 2026-11-06T06:22:47.69670476Z running +relay 7e6a2b3d2f0b 2026-11-06T06:24:27.543031083Z running +s3 330d57a8fe28 2026-11-06T06:24:51.214246011Z running +s3-init 39f3f73bc54c 2026-11-06T06:22:53.061105554Z exited +valkey 06e9fd804c33 2026-11-06T06:22:47.732602676Z running +worker bc3835aefea9 2026-11-06T06:24:27.543511333Z running +python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:18085" +Executing explicit persistence hook; hook output suppressed to avoid leaking secrets. +PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence. +== after: service hostname StartedAt status +api 3bf90c220136 2026-11-06T06:25:27.830629667Z running +api 6bd46345a6dc 2026-11-06T06:25:27.905217708Z running +broker broker 2026-11-06T06:25:22.93043147Z running +lb 28b60f6e6d7d 2026-11-06T06:25:23.204841387Z running +migrate 88979f2e1672 2026-11-06T06:25:23.707386929Z exited +postgres ad6ae244de88 2026-11-06T06:25:21.789249345Z running +relay 7e6a2b3d2f0b 2026-11-06T06:25:27.831770458Z running +s3 330d57a8fe28 2026-11-06T06:25:21.744429928Z running +s3-init 39f3f73bc54c 2026-11-06T06:25:27.230380791Z exited +valkey 06e9fd804c33 2026-11-06T06:25:21.838428678Z running +worker bc3835aefea9 2026-11-06T06:25:27.827061625Z running +exit_code: 0 elapsed_seconds: 14.090 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/persistence.txt b/evidence/sqlalchemy-2026-11-06/grade3/persistence.txt new file mode 100644 index 00000000..33ac3989 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/persistence.txt @@ -0,0 +1,7 @@ +date: 2026-11-06T06:22:42Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ make test-persistence ACTION_SCRIPT=scripts/restart.sh +python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:18085" +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_code: 0 elapsed_seconds: 14.222 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/pipeline-ack.txt b/evidence/sqlalchemy-2026-11-06/grade3/pipeline-ack.txt new file mode 100644 index 00000000..7953a716 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/pipeline-ack.txt @@ -0,0 +1,39 @@ +date: 2026-11-06T06:25:31Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ python3 scripts/pipeline_evidence.py +date: 2026-11-06T06:25:31Z +$ docker compose stop -t 10 worker -> 0.4 s, exit code 0 +mtusi2026lab5-worker-1 bc3835aefea9 exited Exited (0) Less than a second ago +upload -> 202 status=queued id=01a1af88-ac91-717f-ad15-3a272f85e5b6 +GET content?variant=original while worker is stopped -> 409 +GET content?variant=thumbnail while worker is stopped -> 409 +$ rabbitmqctl list_queues -p messenger name messages_ready messages_unacknowledged +name messages_ready messages_unacknowledged +attachments.process 1 0 +attachments.process.dlq 2 0 +$ rabbitmqadmin get messages -q attachments.process -a ack_requeue_true ++---------------+-------------+-------------+-----------------------+---------------+--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------+ +| payload_bytes | redelivered | exchange | routing_key | message_count | properties | payload | payload_encoding | ++---------------+-------------+-------------+-----------------------+---------------+--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------+ +| 243 | false | attachments | attachment.process.v1 | 0 | app_id: "faststream-0.7.8" | {"type": "attachment.process.v1", "job_id": "01a1af88-ac9e-71df-935d-5bd2cd73f5e5", "attempt": 1, "created_at": "2026-11-06T06:25:32.318777Z", "attachment_id": "01a1af88-ac91-717f-ad15-3a272f85e5b6", "schema_version": 1, "pipeline_version": 1} | string | +| | | | | | content_type: "application/json" | | | +| | | | | | correlation_id: "2e218fde-d3f6-4e1c-b99a-eed45cc481b9" | | | +| | | | | | delivery_mode: 2 | | | +| | | | | | headers: {} | | | +| | | | | | message_id: "01a1af88-ac9e-71df-935d-5bd2cd73f5e5" | | | +| | | | | | priority: 0 | | | +| | | | | | timestamp: 1793946333 | | | +| | | | | | type: "attachment.process.v1" | | | +| | | | | | | | | ++---------------+-------------+-------------+-----------------------+---------------+--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------+ +payload keys: ['attachment_id', 'attempt', 'created_at', 'job_id', 'pipeline_version', 'schema_version', 'type'] +$ docker compose stop -t 10 relay -> 0.3 s, exit code 0 +mtusi2026lab5-relay-1 7e6a2b3d2f0b exited Exited (0) Less than a second ago +$ docker compose up -d --no-deps --wait relay -> healthy +$ docker compose up -d --no-deps --wait worker -> healthy +after worker start -> status=ready variants=[('crop', 128, 128), ('optimized', 320, 200), ('thumbnail', 256, 160)] +name messages_ready messages_unacknowledged +attachments.process 0 0 +attachments.process.dlq 2 0 +PASS: pipeline stand evidence +exit_code: 0 elapsed_seconds: 16.348 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/queues.txt b/evidence/sqlalchemy-2026-11-06/grade3/queues.txt new file mode 100644 index 00000000..a5c472bd --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/queues.txt @@ -0,0 +1,7 @@ +date: 2026-11-06T06:26:10Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ docker compose exec -T broker rabbitmqctl -q list_queues -p messenger name type durable policy messages +name type durable policy messages +attachments.process quorum true attachments-process 0 +attachments.process.dlq quorum true attachments-dlq 2 +exit_code: 0 elapsed_seconds: 0.638 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/restore.txt b/evidence/sqlalchemy-2026-11-06/grade3/restore.txt new file mode 100644 index 00000000..27d9fc01 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/restore.txt @@ -0,0 +1,12 @@ +date: 2026-11-06T06:23:14Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ make restore +scripts/restore.sh + Container mtusi2026lab5-api-1 Running + Container mtusi2026lab5-api-2 Starting + Container mtusi2026lab5-api-2 Started + Container mtusi2026lab5-api-2 Waiting + Container mtusi2026lab5-api-1 Waiting + Container mtusi2026lab5-api-2 Healthy + Container mtusi2026lab5-api-1 Healthy +exit_code: 0 elapsed_seconds: 2.001 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/s3-outage.json b/evidence/sqlalchemy-2026-11-06/grade3/s3-outage.json new file mode 100644 index 00000000..af81bb64 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/s3-outage.json @@ -0,0 +1,50 @@ +{ + "ok": true, + "date": "2026-11-06T06:24:39Z", + "commit": "24a51744f521aa585e50a931d0a0219d2e960197", + "scenario": "s3-outage", + "s3_container_during_outage": [ + { + "hostname": "330d57a8fe28", + "status": "exited", + "exit_code": "0", + "started_at": "2026-11-06T06:24:01.272986627Z", + "finished_at": "2026-11-06T06:24:41.496485507Z" + } + ], + "during_outage": { + "upload": { + "status": 503, + "seconds": 4.934, + "instance": "3bf90c220136" + }, + "metadata": { + "status": 200, + "seconds": 0.016, + "instance": "6bd46345a6dc" + }, + "download": { + "status": 503, + "seconds": 4.329, + "instance": "3bf90c220136" + }, + "text_message": { + "status": 201, + "seconds": 0.028, + "instance": "6bd46345a6dc" + }, + "health_ready": { + "status": 200, + "seconds": 0.004, + "instance": "3bf90c220136" + } + }, + "expected": { + "upload": 503, + "download": 503, + "text_message": 201 + }, + "as_expected": true, + "s3_back_healthy_seconds": 5.757, + "download_after_recovery": "sha256 equal" +} diff --git a/evidence/sqlalchemy-2026-11-06/grade3/s3-outage.txt b/evidence/sqlalchemy-2026-11-06/grade3/s3-outage.txt new file mode 100644 index 00000000..aa3fba98 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/s3-outage.txt @@ -0,0 +1,54 @@ +date: 2026-11-06T06:24:39Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ python3 scripts/lab4_scenarios.py s3-outage --restore --output evidence/sqlalchemy-2026-11-06/grade3/s3-outage.json +{ + "ok": true, + "date": "2026-11-06T06:24:39Z", + "commit": "24a51744f521aa585e50a931d0a0219d2e960197", + "scenario": "s3-outage", + "s3_container_during_outage": [ + { + "hostname": "330d57a8fe28", + "status": "exited", + "exit_code": "0", + "started_at": "2026-11-06T06:24:01.272986627Z", + "finished_at": "2026-11-06T06:24:41.496485507Z" + } + ], + "during_outage": { + "upload": { + "status": 503, + "seconds": 4.934, + "instance": "3bf90c220136" + }, + "metadata": { + "status": 200, + "seconds": 0.016, + "instance": "6bd46345a6dc" + }, + "download": { + "status": 503, + "seconds": 4.329, + "instance": "3bf90c220136" + }, + "text_message": { + "status": 201, + "seconds": 0.028, + "instance": "6bd46345a6dc" + }, + "health_ready": { + "status": 200, + "seconds": 0.004, + "instance": "3bf90c220136" + } + }, + "expected": { + "upload": 503, + "download": 503, + "text_message": 201 + }, + "as_expected": true, + "s3_back_healthy_seconds": 5.757, + "download_after_recovery": "sha256 equal" +} +exit_code: 0 elapsed_seconds: 17.059 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/s3-security.txt b/evidence/sqlalchemy-2026-11-06/grade3/s3-security.txt new file mode 100644 index 00000000..626b194a --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/s3-security.txt @@ -0,0 +1,133 @@ +date: 2026-11-06T06:26:12Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ sh scripts/s3-check.sh +date: 2026-11-06T06:26:12Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 == S3 privacy and bootstrap checks +PASS s3: опубликованные host-порты: нет +PASS s3: консоль :9001 внутри контейнера: 000 +PASS s3-init: повторный запуск 1: 0 +PASS s3-init: повторный запуск 2: 0 +PASS s3-init: состояние IAM/bucket не изменилось: same +PASS api: PutObject: allow +PASS api: HeadObject: allow +PASS api: GetObject: allow +PASS api: ListBucket: deny +PASS reconciler: ListBucket: allow +PASS reconciler: HeadObject: allow +PASS reconciler: GetObject: allow +PASS reconciler: PutObject: deny +PASS reconciler: DeleteObject: allow +PASS reconciler: CreateBucket: deny +PASS reconciler: PutBucketPolicy (public): deny +PASS reconciler: admin ListUsers: deny +PASS api: CreateBucket: deny +PASS api: DeleteBucket: deny +PASS api: PutBucketPolicy (public): deny +PASS api: PutBucketLifecycle (HeadBucket уже 403): deny +PASS api: admin ListUsers: deny +PASS api: PutObject в чужой bucket: deny +PASS api: ListBucket чужого bucket: deny +PASS anonymous: HeadObject: deny +PASS anonymous: ListBucket: deny +PASS anonymous: PutObject: deny +PASS anonymous: прямой HTTP GET объекта из отдельного контейнера: 403 +PASS bucket: anonymous policy: private +PASS api: DeleteObject: allow +PASS s3: консоль :9001 из отдельного контейнера сети стенда: connection refused +== IAM/bucket snapshot (без секретов) +{ + "items": [ + { + "key": "messenger-attachments", + "last_modified": "2026-10-28T22:20:01Z", + "is_dir": true + } + ], + "truncated": false +} +{ + "path": "root/messenger-attachments", + "permission": "private" +} +{ + "name": "messenger-api", + "policy": { + "policy": { + "Statement": [ + { + "Action": [ + "s3:GetObject", + "s3:PutObject", + "s3:DeleteObject" + ], + "Effect": "Allow", + "Resource": [ + "arn:aws:s3:::messenger-attachments/*" + ], + "Sid": "MessengerApiObjects" + } + ], + "Version": "2012-10-17" + }, + "policy_name": "messenger-api" + } +} +{ + "name": "messenger-reconciler", + "policy": { + "policy": { + "Statement": [ + { + "Action": [ + "s3:GetObject", + "s3:DeleteObject" + ], + "Effect": "Allow", + "Resource": [ + "arn:aws:s3:::messenger-attachments/*" + ], + "Sid": "MessengerReconcilerObjects" + }, + { + "Action": [ + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": [ + "arn:aws:s3:::messenger-attachments" + ], + "Sid": "MessengerReconcilerListing" + } + ], + "Version": "2012-10-17" + }, + "policy_name": "messenger-reconciler" + } +} +{ + "accessKey": "", + "status": "enabled", + "policies": [ + "messenger-api" + ], + "memberOf": [] +} +{ + "accessKey": "", + "status": "enabled", + "policies": [ + "messenger-reconciler" + ], + "memberOf": [] +} +{ + "rules": [ + { + "id": "abort-incomplete-uploads", + "status": "Enabled", + "prefix": "", + "abortIncompleteMultipartUploadDays": 1 + } + ] +} +RESULT: PASS +exit_code: 0 elapsed_seconds: 2.875 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/smoke.txt b/evidence/sqlalchemy-2026-11-06/grade3/smoke.txt new file mode 100644 index 00000000..a7c8d588 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/smoke.txt @@ -0,0 +1,6 @@ +date: 2026-11-06T06:22:41Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ make test +python3 tests/smoke.py --base-url "http://127.0.0.1:18085" +PASS: lab5 public API scenario; infrastructure and grading evidence remain separate. +exit_code: 0 elapsed_seconds: 1.502 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/student-test.txt b/evidence/sqlalchemy-2026-11-06/grade3/student-test.txt new file mode 100644 index 00000000..c4e4aed1 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/student-test.txt @@ -0,0 +1,57 @@ +date: 2026-11-06T06:19:55Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ make student-test PYTEST_ARGS=--tb=short +.venv/bin/pytest --tb=short +============================= test session starts ============================== +platform darwin -- Python 3.14.5, pytest-9.1.1, pluggy-1.6.0 +rootdir: +configfile: pyproject.toml +testpaths: student-tests +plugins: asyncio-1.4.0, anyio-4.15.1 +asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function +collected 515 items / 19 deselected / 496 selected + +student-tests/adapters/test_rabbitmq.py .... [ 0%] +student-tests/adapters/test_s3_storage.py ... [ 1%] +student-tests/api/test_access.py ......... [ 3%] +student-tests/api/test_attachments.py .................................. [ 10%] +.... [ 10%] +student-tests/api/test_bounded_contexts.py .................... [ 14%] +student-tests/api/test_cache.py ...... [ 16%] +student-tests/api/test_concurrency.py .... [ 16%] +student-tests/api/test_consistency.py ........ [ 18%] +student-tests/api/test_drain.py .. [ 18%] +student-tests/api/test_events.py ...... [ 20%] +student-tests/api/test_idempotency.py ............... [ 23%] +student-tests/api/test_instance.py .... [ 23%] +student-tests/api/test_message_attachments.py ............. [ 26%] +student-tests/api/test_migrations.py ................................... [ 33%] +. [ 33%] +student-tests/api/test_negative.py ..................................... [ 41%] + [ 41%] +student-tests/api/test_operability.py .............. [ 44%] +student-tests/api/test_pagination.py .................. [ 47%] +student-tests/api/test_pipeline.py ............. [ 50%] +student-tests/api/test_pool.py ............ [ 52%] +student-tests/api/test_reconciler.py ........... [ 55%] +student-tests/api/test_recovery.py ............ [ 57%] +student-tests/api/test_sessions.py .................. [ 61%] +student-tests/api/test_timeout.py ........ [ 62%] +student-tests/api/test_upload_consistency.py ......... [ 64%] +student-tests/api/test_wire_format.py .. [ 64%] +student-tests/unit/test_attachments_domain.py .......................... [ 70%] +. [ 70%] +student-tests/unit/test_authentication.py ..................... [ 74%] +student-tests/unit/test_cursor.py ........... [ 76%] +student-tests/unit/test_domain.py ...................................... [ 84%] +.. [ 84%] +student-tests/unit/test_pipeline_domain.py ....................... [ 89%] +student-tests/unit/test_probe.py .............. [ 92%] +student-tests/unit/test_reconcile_measurements.py ...... [ 93%] +student-tests/unit/test_render_pool.py .....s [ 94%] +student-tests/unit/test_renderer.py .................... [ 98%] +student-tests/unit/test_scaling.py ..... [ 99%] +student-tests/unit/test_timeouts.py . [100%] + +========== 495 passed, 1 skipped, 19 deselected in 136.92s (0:02:16) =========== +exit_code: 0 elapsed_seconds: 138.614 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/up.txt b/evidence/sqlalchemy-2026-11-06/grade3/up.txt new file mode 100644 index 00000000..9b493299 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/up.txt @@ -0,0 +1,186 @@ +date: 2026-11-06T06:22:20Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ make up +sh scripts/secrets.sh +sh scripts/broker-secrets.sh +broker and S3 worker secrets ready in secrets/ (values not printed) +docker compose build +#1 [internal] load local bake definitions +#1 reading from stdin 434B done +#1 DONE 0.0s + +#2 [internal] load build definition from Dockerfile +#2 transferring dockerfile: 1.65kB done +#2 DONE 0.0s + +#3 [internal] load metadata for ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 +#3 DONE 0.0s + +#4 [internal] load metadata for docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d +#4 DONE 2.0s + +#5 [internal] load .dockerignore +#5 transferring context: 453B done +#5 DONE 0.0s + +#6 FROM ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 +#6 resolve ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 0.0s done +#6 DONE 0.0s + +#7 [builder 1/7] FROM docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d +#7 resolve docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d 0.0s done +#7 DONE 0.0s + +#8 [internal] load build context +#8 transferring context: 26.36kB 0.0s done +#8 DONE 0.0s + +#9 [builder 2/7] COPY --from=ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 /uv /usr/local/bin/uv +#9 CACHED + +#10 [builder 4/7] COPY pyproject.toml uv.lock README.md ./ +#10 CACHED + +#11 [builder 3/7] WORKDIR /build +#11 CACHED + +#12 [builder 5/7] RUN uv sync --locked --no-dev --no-install-project --no-editable +#12 CACHED + +#13 [builder 6/7] COPY src ./src +#13 DONE 0.1s + +#14 [builder 7/7] RUN uv sync --locked --no-dev --no-editable +#14 0.311 Resolved 84 packages in 13ms +#14 0.349 Building mtusi-messenger @ file:///build +#14 2.023 Built mtusi-messenger @ file:///build +#14 2.028 Prepared 1 package in 1.68s +#14 2.031 Installed 1 package in 2ms +#14 2.219 Bytecode compiled 2300 files in 188ms +#14 2.219 + mtusi-messenger==1.5.0 (from file:///build) +#14 DONE 2.3s + +#15 [runtime 2/6] RUN groupadd --system --gid 10001 messenger && useradd --system --uid 10001 --gid messenger --no-create-home --shell /usr/sbin/nologin messenger +#15 CACHED + +#16 [runtime 3/6] COPY --from=builder --chown=root:root /opt/venv /opt/venv +#16 DONE 0.4s + +#17 [runtime 4/6] WORKDIR /app +#17 DONE 0.1s + +#18 [runtime 5/6] COPY --chown=root:root alembic.ini ./ +#18 DONE 0.0s + +#19 [runtime 6/6] COPY --chown=root:root alembic ./alembic +#19 DONE 0.0s + +#20 exporting to image +#20 exporting layers +#20 exporting layers 2.9s done +#20 exporting manifest sha256:9dc85647696c02fddb623af22eed37e254e5aad4d459dc1d6d0bc640ba79e519 +#20 exporting manifest sha256:9dc85647696c02fddb623af22eed37e254e5aad4d459dc1d6d0bc640ba79e519 done +#20 exporting config sha256:cf948040180715b5272afa493eacceee321c5b8e260d9953449da62eca6fe38e done +#20 exporting attestation manifest sha256:34604e3bd2afa118f104089ea30bebc9cc4b109dd6c6fd731163108473521288 done +#20 exporting manifest list sha256:adb8b8a96dc3fa7555964673a981ae2cefd7cc4a56a0bdc14aa82c6150cde3ad done +#20 naming to docker.io/library/mtusi-messenger:lab5-sqlalchemy done +#20 unpacking to docker.io/library/mtusi-messenger:lab5-sqlalchemy +#20 unpacking to docker.io/library/mtusi-messenger:lab5-sqlalchemy 0.6s done +#20 DONE 3.5s + +#21 resolving provenance for metadata file +#21 DONE 0.0s + api Built +docker compose up -d --wait + Network mtusi2026lab5_backend Creating + Network mtusi2026lab5_backend Created + Network mtusi2026lab5_edge Creating + Network mtusi2026lab5_edge Created + Container mtusi2026lab5-lb-1 Creating + Container mtusi2026lab5-s3-1 Creating + Container mtusi2026lab5-postgres-1 Creating + Container mtusi2026lab5-valkey-1 Creating + Container mtusi2026lab5-broker-1 Creating + Container mtusi2026lab5-s3-1 Created + Container mtusi2026lab5-s3-init-1 Creating + Container mtusi2026lab5-valkey-1 Created + Container mtusi2026lab5-postgres-1 Created + Container mtusi2026lab5-migrate-1 Creating + Container mtusi2026lab5-broker-1 Created + Container mtusi2026lab5-lb-1 Created + Container mtusi2026lab5-s3-init-1 Created + Container mtusi2026lab5-migrate-1 Created + Container mtusi2026lab5-api-2 Creating + Container mtusi2026lab5-api-1 Creating + Container mtusi2026lab5-relay-1 Creating + Container mtusi2026lab5-worker-1 Creating + Container mtusi2026lab5-relay-1 Created + Container mtusi2026lab5-api-2 Created + Container mtusi2026lab5-worker-1 Created + Container mtusi2026lab5-api-1 Created + Container mtusi2026lab5-lb-1 Starting + Container mtusi2026lab5-s3-1 Starting + Container mtusi2026lab5-postgres-1 Starting + Container mtusi2026lab5-valkey-1 Starting + Container mtusi2026lab5-broker-1 Starting + Container mtusi2026lab5-lb-1 Started + Container mtusi2026lab5-valkey-1 Started + Container mtusi2026lab5-postgres-1 Started + Container mtusi2026lab5-postgres-1 Waiting + Container mtusi2026lab5-s3-1 Started + Container mtusi2026lab5-s3-1 Waiting + Container mtusi2026lab5-broker-1 Started + Container mtusi2026lab5-postgres-1 Healthy + Container mtusi2026lab5-migrate-1 Starting + Container mtusi2026lab5-migrate-1 Started + Container mtusi2026lab5-s3-1 Healthy + Container mtusi2026lab5-s3-init-1 Starting + Container mtusi2026lab5-s3-init-1 Started + Container mtusi2026lab5-migrate-1 Waiting + Container mtusi2026lab5-s3-init-1 Waiting + Container mtusi2026lab5-migrate-1 Waiting + Container mtusi2026lab5-broker-1 Waiting + Container mtusi2026lab5-s3-init-1 Waiting + Container mtusi2026lab5-migrate-1 Waiting + Container mtusi2026lab5-broker-1 Waiting + Container mtusi2026lab5-s3-init-1 Waiting + Container mtusi2026lab5-migrate-1 Exited + Container mtusi2026lab5-s3-init-1 Exited + Container mtusi2026lab5-migrate-1 Exited + Container mtusi2026lab5-broker-1 Healthy + Container mtusi2026lab5-s3-init-1 Exited + Container mtusi2026lab5-worker-1 Starting + Container mtusi2026lab5-migrate-1 Exited + Container mtusi2026lab5-s3-init-1 Exited + Container mtusi2026lab5-api-2 Starting + Container mtusi2026lab5-broker-1 Healthy + Container mtusi2026lab5-relay-1 Starting + Container mtusi2026lab5-api-2 Started + Container mtusi2026lab5-api-1 Starting + Container mtusi2026lab5-relay-1 Started + Container mtusi2026lab5-worker-1 Started + Container mtusi2026lab5-api-1 Started + Container mtusi2026lab5-worker-1 Waiting + Container mtusi2026lab5-lb-1 Waiting + Container mtusi2026lab5-s3-1 Waiting + Container mtusi2026lab5-s3-init-1 Waiting + Container mtusi2026lab5-postgres-1 Waiting + Container mtusi2026lab5-valkey-1 Waiting + Container mtusi2026lab5-broker-1 Waiting + Container mtusi2026lab5-migrate-1 Waiting + Container mtusi2026lab5-relay-1 Waiting + Container mtusi2026lab5-api-2 Waiting + Container mtusi2026lab5-api-1 Waiting + Container mtusi2026lab5-migrate-1 Exited + Container mtusi2026lab5-s3-1 Healthy + Container mtusi2026lab5-valkey-1 Healthy + Container mtusi2026lab5-postgres-1 Healthy + Container mtusi2026lab5-broker-1 Healthy + Container mtusi2026lab5-s3-init-1 Exited + Container mtusi2026lab5-api-2 Healthy + Container mtusi2026lab5-api-1 Healthy + Container mtusi2026lab5-relay-1 Healthy + Container mtusi2026lab5-worker-1 Healthy + Container mtusi2026lab5-lb-1 Healthy +scripts/lb-wait.sh +exit_code: 0 elapsed_seconds: 20.707 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/upload-failover.json b/evidence/sqlalchemy-2026-11-06/grade3/upload-failover.json new file mode 100644 index 00000000..7045460f --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/upload-failover.json @@ -0,0 +1,44 @@ +{ + "ok": true, + "date": "2026-11-06T06:24:32Z", + "commit": "24a51744f521aa585e50a931d0a0219d2e960197", + "scenario": "failover-upload", + "upload_instance": "3bf90c220136", + "download_instance": "6bd46345a6dc", + "sha256_equal": true, + "hook_seconds": 2.786, + "download_ok_after_seconds": 2.792, + "replicas_at_download": [ + { + "hostname": "6bd46345a6dc", + "status": "running", + "exit_code": "0", + "started_at": "2026-11-06T06:23:40.589066048Z", + "finished_at": "2026-11-06T06:23:40.500729381Z" + }, + { + "hostname": "3bf90c220136", + "status": "exited", + "exit_code": "0", + "started_at": "2026-11-06T06:23:40.499634298Z", + "finished_at": "2026-11-06T06:24:35.851252087Z" + } + ], + "restored": true, + "replicas_after_restore": [ + { + "hostname": "6bd46345a6dc", + "status": "running", + "exit_code": "0", + "started_at": "2026-11-06T06:23:40.589066048Z", + "finished_at": "2026-11-06T06:23:40.500729381Z" + }, + { + "hostname": "3bf90c220136", + "status": "running", + "exit_code": "0", + "started_at": "2026-11-06T06:24:36.218028629Z", + "finished_at": "2026-11-06T06:24:35.851252087Z" + } + ] +} diff --git a/evidence/sqlalchemy-2026-11-06/grade3/upload-failover.txt b/evidence/sqlalchemy-2026-11-06/grade3/upload-failover.txt new file mode 100644 index 00000000..9ed3faf9 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/upload-failover.txt @@ -0,0 +1,48 @@ +date: 2026-11-06T06:24:32Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ python3 scripts/lab4_scenarios.py failover-upload --restore --output evidence/sqlalchemy-2026-11-06/grade3/upload-failover.json +{ + "ok": true, + "date": "2026-11-06T06:24:32Z", + "commit": "24a51744f521aa585e50a931d0a0219d2e960197", + "scenario": "failover-upload", + "upload_instance": "3bf90c220136", + "download_instance": "6bd46345a6dc", + "sha256_equal": true, + "hook_seconds": 2.786, + "download_ok_after_seconds": 2.792, + "replicas_at_download": [ + { + "hostname": "6bd46345a6dc", + "status": "running", + "exit_code": "0", + "started_at": "2026-11-06T06:23:40.589066048Z", + "finished_at": "2026-11-06T06:23:40.500729381Z" + }, + { + "hostname": "3bf90c220136", + "status": "exited", + "exit_code": "0", + "started_at": "2026-11-06T06:23:40.499634298Z", + "finished_at": "2026-11-06T06:24:35.851252087Z" + } + ], + "restored": true, + "replicas_after_restore": [ + { + "hostname": "6bd46345a6dc", + "status": "running", + "exit_code": "0", + "started_at": "2026-11-06T06:23:40.589066048Z", + "finished_at": "2026-11-06T06:23:40.500729381Z" + }, + { + "hostname": "3bf90c220136", + "status": "running", + "exit_code": "0", + "started_at": "2026-11-06T06:24:36.218028629Z", + "finished_at": "2026-11-06T06:24:35.851252087Z" + } + ] +} +exit_code: 0 elapsed_seconds: 5.867 diff --git a/evidence/sqlalchemy-2026-11-06/grade3/upload-negative.txt b/evidence/sqlalchemy-2026-11-06/grade3/upload-negative.txt new file mode 100644 index 00000000..4ab00717 --- /dev/null +++ b/evidence/sqlalchemy-2026-11-06/grade3/upload-negative.txt @@ -0,0 +1,53 @@ +date: 2026-11-06T06:24:30Z commit: 24a51744f521aa585e50a931d0a0219d2e960197 +environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab5", "COMPOSE_FILE": "compose.yaml", "LB_HTTP_PORT": "18085", "LB_STATS_PORT": "25085", "BASE_URL": "http://127.0.0.1:18085", "NO_PROXY": "localhost,127.0.0.1,::1", "API_IMAGE": "mtusi-messenger:lab5-sqlalchemy"} +$ .venv/bin/pytest -m stack -v -s --tb=short student-tests/stack/test_attachment_faults.py -k user_errors +============================= test session starts ============================== +platform darwin -- Python 3.14.5, pytest-9.1.1, pluggy-1.6.0 -- /.venv/bin/python +cachedir: .pytest_cache +rootdir: +configfile: pyproject.toml +plugins: asyncio-1.4.0, anyio-4.15.1 +asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function +collecting ... collected 7 items / 6 deselected / 1 selected + +student-tests/stack/test_attachment_faults.py::test_user_errors_never_become_500 10 MiB + 1 с Content-Length, тело не отправлено: 413 +10 MiB + 1 chunked: 413 +PNG 100000×100000 (бомба): 413 +PNG 8001×5000: 413 +обрезанный PNG: 415 +обрезанный JPEG: 415 +JPEG как image/png: 415 +GIF как image/png: 415 +WebP как image/png: 415 +текст как image/png: 415 +PNG как image/jpeg: 415 +пустое тело: 415 +application/octet-stream: 415 +без Content-Type: 415 +filename='../a.png': 400 +filename='a/b.png': 400 +filename='a\\b.png': 400 +filename='a\x00.png': 400 +filename='a\x01.png': 400 +filename='a\x7f.png': 400 +filename='': 400 +filename=' ': 400 +filename='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: 400 +filename=None: 400 +посторонний: upload в чужой чат: 404 +посторонний: метаданные: 404 +посторонний: /content: 404 +посторонний: ссылка на чужое вложение: 404 +вложение другого чата: 404 +неизвестное вложение: 404 +11 вложений: 400 +повтор вложения: 400 +невалидный UUID: 400 +пустой текст без вложений: 400 +невалидный id вложения: 400 +variant=preview: 400 +строк вложений в чате: 2 (= ответов 202); ответов в журнале реплик: 54, из них 5xx: 0 +PASSED + +======================= 1 passed, 6 deselected in 1.09s ======================== +exit_code: 0 elapsed_seconds: 1.784 diff --git a/openspec/changes/verify-lab5-grade3-sqlalchemy/.openspec.yaml b/openspec/changes/archive/2026-11-06-verify-lab5-grade3-sqlalchemy/.openspec.yaml similarity index 67% rename from openspec/changes/verify-lab5-grade3-sqlalchemy/.openspec.yaml rename to openspec/changes/archive/2026-11-06-verify-lab5-grade3-sqlalchemy/.openspec.yaml index b130cb41..ea344a2d 100644 --- a/openspec/changes/verify-lab5-grade3-sqlalchemy/.openspec.yaml +++ b/openspec/changes/archive/2026-11-06-verify-lab5-grade3-sqlalchemy/.openspec.yaml @@ -1,3 +1,5 @@ schema: spec-driven created: 2026-11-06 skip_specs: true +archived: 2026-11-06 +lab: 5 diff --git a/openspec/changes/verify-lab5-grade3-sqlalchemy/design.md b/openspec/changes/archive/2026-11-06-verify-lab5-grade3-sqlalchemy/design.md similarity index 100% rename from openspec/changes/verify-lab5-grade3-sqlalchemy/design.md rename to openspec/changes/archive/2026-11-06-verify-lab5-grade3-sqlalchemy/design.md diff --git a/openspec/changes/verify-lab5-grade3-sqlalchemy/proposal.md b/openspec/changes/archive/2026-11-06-verify-lab5-grade3-sqlalchemy/proposal.md similarity index 100% rename from openspec/changes/verify-lab5-grade3-sqlalchemy/proposal.md rename to openspec/changes/archive/2026-11-06-verify-lab5-grade3-sqlalchemy/proposal.md diff --git a/openspec/changes/archive/2026-11-06-verify-lab5-grade3-sqlalchemy/tasks.md b/openspec/changes/archive/2026-11-06-verify-lab5-grade3-sqlalchemy/tasks.md new file mode 100644 index 00000000..a3e60cdc --- /dev/null +++ b/openspec/changes/archive/2026-11-06-verify-lab5-grade3-sqlalchemy/tasks.md @@ -0,0 +1,10 @@ +## 1. Квалификация уровня 3 + +- [x] 1.1 Добавить SHA и фактическое состояние контейнеров в результаты suite. +- [x] 1.2 Выполнить make check/validate/lint/student-test и собрать стенд. +- [x] 1.3 Выполнить smoke, persistence, failover и restore с реальными выводами. +- [x] 1.4 Выполнить level3 suite и проверки унаследованного минимума lab4. +- [x] 1.5 Сохранить топологию, лимиты, очереди и протокол ручного ack; оформить таблицу критериев и ограничения для REPORT. +- [x] 1.6 Зафиксировать evidence и архивировать реально завершённый цикл. + +Доказательства: evidence/sqlalchemy-2026-11-06/grade3/NOTES.md. Minor limits.py не блокирует уровень и сохранён с ненулевым результатом. diff --git a/openspec/changes/verify-lab5-grade3-sqlalchemy/tasks.md b/openspec/changes/verify-lab5-grade3-sqlalchemy/tasks.md deleted file mode 100644 index 5a59aec2..00000000 --- a/openspec/changes/verify-lab5-grade3-sqlalchemy/tasks.md +++ /dev/null @@ -1,8 +0,0 @@ -## 1. Квалификация уровня 3 - -- [x] 1.1 Добавить SHA и фактическое состояние контейнеров в результаты suite. -- [ ] 1.2 Выполнить make check/validate/lint/student-test и собрать стенд. -- [ ] 1.3 Выполнить smoke, persistence, failover и restore с реальными выводами. -- [ ] 1.4 Выполнить level3 suite и проверки унаследованного минимума lab4. -- [ ] 1.5 Сохранить топологию, лимиты, очереди и протокол ручного ack; оформить таблицу критериев и ограничения для REPORT. -- [ ] 1.6 Зафиксировать evidence и архивировать реально завершённый цикл.