$ python scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
exit=0

$ python scripts/validate_openapi.py
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
exit=0

$ python tests/smoke.py --base-url http://127.0.0.1:8080
PASS: lab6 public API scenario; infrastructure and grading evidence remain separate.
exit=0

$ python -m unittest discover -s student-tests -p test_api.py -v
test_bearer_rules (test_api.AuthTest.test_bearer_rules) ... ok
test_concurrent_registration_of_same_username (test_api.AuthTest.test_concurrent_registration_of_same_username) ... ok
test_logout_revokes_in_database_and_cache (test_api.AuthTest.test_logout_revokes_in_database_and_cache) ... ok
test_password_is_not_exposed_or_stored_plain (test_api.AuthTest.test_password_is_not_exposed_or_stored_plain) ... ok
test_register_validation (test_api.AuthTest.test_register_validation) ... ok
test_session_shape_entropy_and_logout (test_api.AuthTest.test_session_shape_entropy_and_logout) ... ok
test_token_only_stored_as_hash (test_api.AuthTest.test_token_only_stored_as_hash) ... ok
test_wrong_password_and_unknown_user_are_indistinguishable (test_api.AuthTest.test_wrong_password_and_unknown_user_are_indistinguishable) ... ok
test_chat_creation_is_atomic (test_api.DataTest.test_chat_creation_is_atomic) ... ok
test_foreign_chat_empty_message_bad_json (test_api.DataTest.test_foreign_chat_empty_message_bad_json) ... ok
test_multi_page_history_and_cursor_binding (test_api.DataTest.test_multi_page_history_and_cursor_binding) ... ok
test_parallel_writes_from_many_clients (test_api.DataTest.test_parallel_writes_from_many_clients) ... ok

----------------------------------------------------------------------
Ran 12 tests in 2.581s

OK
exit=0

$ python -m unittest discover -s student-tests -p test_idempotency.py -v
test_concurrent_same_key_creates_exactly_one_message_across_replicas (test_idempotency.IdempotencyTest.test_concurrent_same_key_creates_exactly_one_message_across_replicas) ... ok
test_different_body_same_key_is_409 (test_idempotency.IdempotencyTest.test_different_body_same_key_is_409) ... ok
test_expired_key_is_reusable_after_ttl (test_idempotency.IdempotencyTest.test_expired_key_is_reusable_after_ttl) ... ok
test_key_validation (test_idempotency.IdempotencyTest.test_key_validation) ... ok
test_replay_rechecks_session_and_membership (test_idempotency.IdempotencyTest.test_replay_rechecks_session_and_membership) ... ok
test_replay_returns_same_message_and_creates_no_duplicate (test_idempotency.IdempotencyTest.test_replay_returns_same_message_and_creates_no_duplicate) ... ok
test_scope_is_user_and_chat (test_idempotency.IdempotencyTest.test_scope_is_user_and_chat) ... ok
test_semantically_equal_body_is_replayed (test_idempotency.IdempotencyTest.test_semantically_equal_body_is_replayed) ... ok
test_session_is_shared_between_replicas_without_relogin (test_idempotency.IdempotencyTest.test_session_is_shared_between_replicas_without_relogin) ... ok

----------------------------------------------------------------------
Ran 9 tests in 2.087s

OK
exit=0

$ python -m unittest discover -s student-tests -p test_attachments.py -v
test_aborted_upload_leaves_nothing (test_attachments.AttachmentTest.test_aborted_upload_leaves_nothing) ... ok
test_bucket_is_private_outside_the_api (test_attachments.AttachmentTest.test_bucket_is_private_outside_the_api) ... ok
test_corrupted_and_spoofed_files_are_415_not_500 (test_attachments.AttachmentTest.test_corrupted_and_spoofed_files_are_415_not_500) ... ok
test_dangerous_filenames_are_400 (test_attachments.AttachmentTest.test_dangerous_filenames_are_400) ... ok
test_decompression_bomb_header_is_413 (test_attachments.AttachmentTest.test_decompression_bomb_header_is_413) ... ok
test_empty_body_is_400 (test_attachments.AttachmentTest.test_empty_body_is_400) ... ok
test_foreign_user_cannot_upload_read_or_download (test_attachments.AttachmentTest.test_foreign_user_cannot_upload_read_or_download) ... ok
test_idempotent_replay_with_attachments (test_attachments.AttachmentTest.test_idempotent_replay_with_attachments) ... ok
test_message_with_attachments_and_chat_binding (test_attachments.AttachmentTest.test_message_with_attachments_and_chat_binding) ... ok
test_png_and_jpeg_roundtrip_with_checksum (test_attachments.AttachmentTest.test_png_and_jpeg_roundtrip_with_checksum) ... ok
test_too_large_is_413_and_nothing_is_stored (test_attachments.AttachmentTest.test_too_large_is_413_and_nothing_is_stored) ... ok

----------------------------------------------------------------------
Ran 11 tests in 5.449s

OK
exit=0

$ python -m unittest discover -s student-tests -p test_topology.py -v
test_api_runs_as_non_root (test_topology.TopologyTest.test_api_runs_as_non_root) ... ok
test_at_least_two_api_replicas_without_published_ports (test_topology.TopologyTest.test_at_least_two_api_replicas_without_published_ports) ... ok
test_no_fixed_container_names (test_topology.TopologyTest.test_no_fixed_container_names) ... ok
test_only_lb_is_published_and_only_on_localhost (test_topology.TopologyTest.test_only_lb_is_published_and_only_on_localhost) ... ok
test_resource_limits_are_set (test_topology.TopologyTest.test_resource_limits_are_set) ... ok
test_stop_grace_period_covers_drain (test_topology.TopologyTest.test_stop_grace_period_covers_drain) ... ok

----------------------------------------------------------------------
Ran 6 tests in 2.739s

OK
exit=0

$ python -m unittest discover -s student-tests -p test_pipeline.py -v
test_alpha_is_composited_on_white (test_pipeline.PipelineTest.test_alpha_is_composited_on_white) ... C:\Users\kolya5544\source\repos\vmdMTUCI\mtusi2026lab6\student-tests\test_pipeline.py:25: ResourceWarning: unclosed file <_io.BufferedReader name='C:\\Users\\kolya5544\\source\\repos\\vmdMTUCI\\mtusi2026lab6\\student-tests\\fixtures\\alpha.png'>
  return open(os.path.join(FIX, name), "rb").read()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
ok
test_content_is_409_while_not_ready_and_original_is_untouched (test_pipeline.PipelineTest.test_content_is_409_while_not_ready_and_original_is_untouched) ... ok
test_exif_orientation_is_applied (test_pipeline.PipelineTest.test_exif_orientation_is_applied) ... C:\Users\kolya5544\source\repos\vmdMTUCI\mtusi2026lab6\student-tests\test_pipeline.py:25: ResourceWarning: unclosed file <_io.BufferedReader name='C:\\Users\\kolya5544\\source\\repos\\vmdMTUCI\\mtusi2026lab6\\student-tests\\fixtures\\exif_rot6.jpg'>
  return open(os.path.join(FIX, name), "rb").read()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
ok
test_message_can_reference_attachment_before_ready_and_failed_cannot (test_pipeline.PipelineTest.test_message_can_reference_attachment_before_ready_and_failed_cannot) ... C:\Users\kolya5544\source\repos\vmdMTUCI\mtusi2026lab6\student-tests\test_pipeline.py:25: ResourceWarning: unclosed file <_io.BufferedReader name='C:\\Users\\kolya5544\\source\\repos\\vmdMTUCI\\mtusi2026lab6\\student-tests\\fixtures\\poison.png'>
  return open(os.path.join(FIX, name), "rb").read()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
ok
test_other_variants_visible_only_to_chat_members (test_pipeline.PipelineTest.test_other_variants_visible_only_to_chat_members) ... ok
test_ready_job_redelivery_does_not_duplicate_variants (test_pipeline.PipelineTest.test_ready_job_redelivery_does_not_duplicate_variants) ... ok
test_sample_png_produces_all_variants_per_contract (test_pipeline.PipelineTest.test_sample_png_produces_all_variants_per_contract) ... ok
test_small_image_is_not_upscaled_but_crop_is_128 (test_pipeline.PipelineTest.test_small_image_is_not_upscaled_but_crop_is_128) ... C:\Users\kolya5544\source\repos\vmdMTUCI\mtusi2026lab6\student-tests\test_pipeline.py:25: ResourceWarning: unclosed file <_io.BufferedReader name='C:\\Users\\kolya5544\\source\\repos\\vmdMTUCI\\mtusi2026lab6\\student-tests\\fixtures\\small.png'>
  return open(os.path.join(FIX, name), "rb").read()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
ok
test_staging_is_cleaned_after_ready_and_kept_for_failed (test_pipeline.PipelineTest.test_staging_is_cleaned_after_ready_and_kept_for_failed) ... ok

----------------------------------------------------------------------
Ran 9 tests in 10.668s

OK
exit=0

$ python -m unittest discover -s student-tests -p test_observability.py -v
test_logs_are_structured_and_linked_by_trace_id (test_observability.ObservabilityTest.test_logs_are_structured_and_linked_by_trace_id) ... ok
test_metrics_for_http_jobs_queue_pool_worker (test_observability.ObservabilityTest.test_metrics_for_http_jobs_queue_pool_worker) ... ok
test_no_high_cardinality_or_secret_labels (test_observability.ObservabilityTest.test_no_high_cardinality_or_secret_labels) ... ok
test_one_trace_spans_api_outbox_broker_and_worker (test_observability.ObservabilityTest.test_one_trace_spans_api_outbox_broker_and_worker) ... ok
test_secrets_and_message_bodies_are_not_exported (test_observability.ObservabilityTest.test_secrets_and_message_bodies_are_not_exported) ... ok

----------------------------------------------------------------------
Ran 5 tests in 9.932s

OK
exit=0

$ python -m unittest discover -s student-tests -p test_observability_retry.py -v
test_all_attempts_in_one_trace_and_logs (test_observability_retry.RetryTraceTest.test_all_attempts_in_one_trace_and_logs) ... ok

----------------------------------------------------------------------
Ran 1 test in 19.482s

OK
exit=0

$ python -m unittest discover -s student-tests -p test_reconcile5.py -v
test_ready_variants_and_uncommitted_side_effect_are_preserved (test_reconcile5.ReconcilePipelineTest.test_ready_variants_and_uncommitted_side_effect_are_preserved) ... ok
test_staging_is_protected_and_unowned_orphan_obeys_grace (test_reconcile5.ReconcilePipelineTest.test_staging_is_protected_and_unowned_orphan_obeys_grace) ... ok

----------------------------------------------------------------------
Ran 2 tests in 34.423s

OK
exit=0

$ python -m unittest discover -s student-tests -p test_resilience5.py -v
test_1_worker_down_upload_api_restart_worker_up (test_resilience5.ResilienceTest.test_1_worker_down_upload_api_restart_worker_up) ... ok
test_2_broker_restart_keeps_accepted_jobs (test_resilience5.ResilienceTest.test_2_broker_restart_keeps_accepted_jobs) ... ok
test_3_broker_down_during_acceptance_outbox_delivers_later (test_resilience5.ResilienceTest.test_3_broker_down_during_acceptance_outbox_delivers_later) ... ok
test_4_api_crash_between_commit_and_publish (test_resilience5.ResilienceTest.test_4_api_crash_between_commit_and_publish) ... ok
test_5_worker_crash_after_s3_before_commit_lease_recovery (test_resilience5.ResilienceTest.test_5_worker_crash_after_s3_before_commit_lease_recovery) ... ok
test_6_worker_crash_after_commit_before_ack_redelivery_is_noop (test_resilience5.ResilienceTest.test_6_worker_crash_after_commit_before_ack_redelivery_is_noop) ... ok
test_7_retry_exhaustion_registry_and_operator_replay (test_resilience5.ResilienceTest.test_7_retry_exhaustion_registry_and_operator_replay) ... ok

----------------------------------------------------------------------
Ran 7 tests in 146.730s

OK
exit=0

$ python -m unittest discover -s student-tests -p test_expiry.py -v
test_expiry_is_not_extended_by_use (test_expiry.ExpiryTest.test_expiry_is_not_extended_by_use) ... ok
test_session_expires_after_ttl (test_expiry.ExpiryTest.test_session_expires_after_ttl) ... ok

----------------------------------------------------------------------
Ran 2 tests in 21.421s

OK
exit=0

$ python -m unittest discover -s student-tests -p test_dependencies.py -v
test_postgres_down_gives_bounded_503_never_anonymous_access (test_dependencies.DependencyTest.test_postgres_down_gives_bounded_503_never_anonymous_access) ... ok
test_valkey_down_is_bypassed (test_dependencies.DependencyTest.test_valkey_down_is_bypassed) ... ok

----------------------------------------------------------------------
Ran 2 tests in 21.620s

OK
exit=0

$ python tests/resilience.py --mode persistence --action-script scripts/restart.cmd --base-url http://127.0.0.1:8080
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
FAIL: restart hook failed (inspect your script locally)
exit=1
