
== API, auth, concurrency, idempotency tests (DB/expiry tests skip without their env)
test_chat_list_pagination (test_api.ApiBehaviorTests.test_chat_list_pagination) ... ok
test_cursor_from_other_chat_returns_400 (test_api.ApiBehaviorTests.test_cursor_from_other_chat_returns_400) ... ok
test_duplicate_username_returns_409 (test_api.ApiBehaviorTests.test_duplicate_username_returns_409) ... ok
test_empty_message_returns_400 (test_api.ApiBehaviorTests.test_empty_message_returns_400) ... ok
test_malformed_json_returns_400 (test_api.ApiBehaviorTests.test_malformed_json_returns_400) ... ok
test_naive_timestamp_cursor_returns_400 (test_api.ApiBehaviorTests.test_naive_timestamp_cursor_returns_400) ... ok
test_outsider_cannot_access_chat (test_api.ApiBehaviorTests.test_outsider_cannot_access_chat) ... ok
test_pagination_returns_all_messages_without_duplicates (test_api.ApiBehaviorTests.test_pagination_returns_all_messages_without_duplicates) ... ok
test_password_never_returned (test_api.ApiBehaviorTests.test_password_never_returned) ... ok
test_registration_without_password_returns_400 (test_api.ApiBehaviorTests.test_registration_without_password_returns_400) ... ok
test_sender_id_in_body_rejected (test_api.ApiBehaviorTests.test_sender_id_in_body_rejected) ... ok
test_short_password_returns_400 (test_api.ApiBehaviorTests.test_short_password_returns_400) ... ok
test_crash_between_put_and_commit_dry_run_then_apply_then_noop (test_attachment_consistency.AttachmentConsistencyTests.test_crash_between_put_and_commit_dry_run_then_apply_then_noop) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_fresh_pending_is_kept (test_attachment_consistency.AttachmentConsistencyTests.test_fresh_pending_is_kept) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_missing_object_is_reported_not_deleted (test_attachment_consistency.AttachmentConsistencyTests.test_missing_object_is_reported_not_deleted) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_orphan_object_deleted_only_after_grace (test_attachment_consistency.AttachmentConsistencyTests.test_orphan_object_deleted_only_after_grace) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_pending_cannot_be_attached (test_attachment_consistency.AttachmentConsistencyTests.test_pending_cannot_be_attached) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_ready_and_referenced_are_never_collected (test_attachment_consistency.AttachmentConsistencyTests.test_ready_and_referenced_are_never_collected) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_aborted_upload_leaves_no_row_and_no_object (test_attachment_consistency.UploadFailureTests.test_aborted_upload_leaves_no_row_and_no_object) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_db_failure_after_put_returns_503_and_deletes_object (test_attachment_consistency.UploadFailureTests.test_db_failure_after_put_returns_503_and_deletes_object) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_process_crash_after_put_is_collected_by_gc (test_attachment_consistency.UploadFailureTests.test_process_crash_after_put_is_collected_by_gc) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_s3_put_failure_returns_503_and_compensates (test_attachment_consistency.UploadFailureTests.test_s3_put_failure_returns_503_and_compensates) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_attachment_from_other_chat_is_404_and_nothing_saved (test_attachments.AttachmentTests.test_attachment_from_other_chat_is_404_and_nothing_saved) ... ok
test_content_type_with_parameters_is_accepted (test_attachments.AttachmentTests.test_content_type_with_parameters_is_accepted) ... ok
test_corrupted_images_are_415 (test_attachments.AttachmentTests.test_corrupted_images_are_415) ... ok
test_dangerous_filenames_are_400 (test_attachments.AttachmentTests.test_dangerous_filenames_are_400) ... ok
test_exactly_max_size_is_accepted (test_attachments.AttachmentTests.test_exactly_max_size_is_accepted) ... ok
test_idempotency_includes_attachment_ids (test_attachments.AttachmentTests.test_idempotency_includes_attachment_ids) ... ok
test_invalid_and_unknown_attachment_ids (test_attachments.AttachmentTests.test_invalid_and_unknown_attachment_ids) ... ok
test_jpeg_baseline_and_progressive (test_attachments.AttachmentTests.test_jpeg_baseline_and_progressive) ... ok
test_message_attachment_validation (test_attachments.AttachmentTests.test_message_attachment_validation) ... ok
test_message_with_attachments_visible_to_members (test_attachments.AttachmentTests.test_message_with_attachments_visible_to_members) ... ok
test_mime_spoofing_is_415 (test_attachments.AttachmentTests.test_mime_spoofing_is_415) ... ok
test_original_variant_and_unknown_variants (test_attachments.AttachmentTests.test_original_variant_and_unknown_variants) ... ok
test_outsider_and_unknown_chat_upload_404 (test_attachments.AttachmentTests.test_outsider_and_unknown_chat_upload_404) ... ok
test_png_roundtrip_member_reads_outsider_404 (test_attachments.AttachmentTests.test_png_roundtrip_member_reads_outsider_404) ... ok
test_too_large_chunked_without_content_length (test_attachments.AttachmentTests.test_too_large_chunked_without_content_length) ... ok
test_too_large_with_content_length (test_attachments.AttachmentTests.test_too_large_with_content_length) ... ok
test_too_many_pixels (test_attachments.AttachmentTests.test_too_many_pixels) ... ok
test_basic_on_business_endpoint_rejected (test_auth.AuthTests.test_basic_on_business_endpoint_rejected) ... ok
test_login_with_body_rejected (test_auth.AuthTests.test_login_with_body_rejected)
Контракт: вход — только заголовок Basic, без тела. Лишний ввод -> 400, сессии нет. ... ok
test_logout_revokes_only_current_session (test_auth.AuthTests.test_logout_revokes_only_current_session) ... ok
test_malformed_basic_headers (test_auth.AuthTests.test_malformed_basic_headers) ... ok
test_password_with_colon_and_unicode (test_auth.AuthTests.test_password_with_colon_and_unicode) ... ok
test_session_shape_and_token_entropy (test_auth.AuthTests.test_session_shape_and_token_entropy) ... ok
test_unknown_and_garbage_tokens (test_auth.AuthTests.test_unknown_and_garbage_tokens) ... ok
test_wrong_password_and_unknown_user_look_the_same (test_auth.AuthTests.test_wrong_password_and_unknown_user_look_the_same) ... ok
test_x_user_id_gives_no_access (test_auth.AuthTests.test_x_user_id_gives_no_access) ... ok
test_duplicate_and_missing_caller_rejected (test_concurrency.ChatRollbackTests.test_duplicate_and_missing_caller_rejected) ... ok
test_unknown_member_rolls_back_whole_chat (test_concurrency.ChatRollbackTests.test_unknown_member_rolls_back_whole_chat)
Чат вставляется первым, затем участники по порядку (сначала сам владелец). ... ok
test_same_username_parallel_registration (test_concurrency.RegistrationRaceTests.test_same_username_parallel_registration) ... ok
test_session_expires_even_when_cached (test_expiry.ExpiryTests.test_session_expires_even_when_cached) ... skipped 'set EXPIRY_BASE_URL to the short-TTL API instance'
test_auth_checked_before_key (test_idempotency.IdempotencyTests.test_auth_checked_before_key) ... ok
test_concurrent_same_key_across_replicas_creates_one_message (test_idempotency.IdempotencyTests.test_concurrent_same_key_across_replicas_creates_one_message) ... 
    24 parallel POSTs, one key -> 1 message; replicas: ['api1', 'api2']
ok
test_concurrent_same_key_different_bodies_one_winner (test_idempotency.IdempotencyTests.test_concurrent_same_key_different_bodies_one_winner) ... ok
test_failed_access_does_not_burn_key (test_idempotency.IdempotencyTests.test_failed_access_does_not_burn_key) ... ok
test_json_formatting_and_key_order_do_not_matter (test_idempotency.IdempotencyTests.test_json_formatting_and_key_order_do_not_matter) ... ok
test_key_survives_new_session_of_same_user (test_idempotency.IdempotencyTests.test_key_survives_new_session_of_same_user) ... ok
test_missing_or_invalid_key_is_400 (test_idempotency.IdempotencyTests.test_missing_or_invalid_key_is_400) ... ok
test_replay_rechecks_session (test_idempotency.IdempotencyTests.test_replay_rechecks_session) ... ok
test_scope_is_user_and_chat (test_idempotency.IdempotencyTests.test_scope_is_user_and_chat) ... ok
test_sequential_replay_and_conflict (test_idempotency.IdempotencyTests.test_sequential_replay_and_conflict) ... ok
test_exif_orientation_applied_and_stripped (test_pipeline.PipelineTests.test_exif_orientation_applied_and_stripped) ... ok
test_fixture_320x200 (test_pipeline.PipelineTests.test_fixture_320x200) ... ok
test_progressive_jpeg (test_pipeline.PipelineTests.test_progressive_jpeg) ... ok
test_result_is_stable_and_private (test_pipeline.PipelineTests.test_result_is_stable_and_private) ... ok
test_small_source_not_upscaled_except_crop (test_pipeline.PipelineTests.test_small_source_not_upscaled_except_crop) ... ok
test_transparency_on_white (test_pipeline.PipelineTests.test_transparency_on_white) ... ok
test_unknown_variant_is_400 (test_pipeline.PipelineTests.test_unknown_variant_is_400) ... ok
test_a_crash_between_commit_and_publish (test_pipeline_faults.PipelineFaultTests.test_a_crash_between_commit_and_publish) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_b_crash_after_publish_duplicate_is_noop (test_pipeline_faults.PipelineFaultTests.test_b_crash_after_publish_duplicate_is_noop) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_c_worker_crash_after_side_effects_before_commit (test_pipeline_faults.PipelineFaultTests.test_c_worker_crash_after_side_effects_before_commit) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_d_worker_crash_after_commit_before_ack (test_pipeline_faults.PipelineFaultTests.test_d_worker_crash_after_commit_before_ack) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_e_transient_errors_retry_with_backoff (test_pipeline_faults.PipelineFaultTests.test_e_transient_errors_retry_with_backoff) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_f_permanent_error_fails_without_retry (test_pipeline_faults.PipelineFaultTests.test_f_permanent_error_fails_without_retry) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_g_retry_exhausted_dlq_then_explicit_replay (test_pipeline_faults.PipelineFaultTests.test_g_retry_exhausted_dlq_then_explicit_replay) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_h_hung_worker_lease_expires_and_is_fenced (test_pipeline_faults.PipelineFaultTests.test_h_hung_worker_lease_expires_and_is_fenced) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_i_staging_removed_after_safe_commit (test_pipeline_faults.PipelineFaultTests.test_i_staging_removed_after_safe_commit) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_j_garbage_broker_message_is_acked (test_pipeline_faults.PipelineFaultTests.test_j_garbage_broker_message_is_acked) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_debt_survives_api_restart (test_session_cache.SessionRevocationCacheTests.test_debt_survives_api_restart)
Процесс, выполнивший logout, умер до восстановления связи — новый процесс не доверяет кэшу. ... skipped 'DATABASE_URL is not configured'
test_normal_logout_leaves_no_debt (test_session_cache.SessionRevocationCacheTests.test_normal_logout_leaves_no_debt) ... skipped 'DATABASE_URL is not configured'
test_revoked_token_rejected_after_partition_heals (test_session_cache.SessionRevocationCacheTests.test_revoked_token_rejected_after_partition_heals) ... skipped 'DATABASE_URL is not configured'
test_cleanup_runs_on_one_replica_at_a_time (test_storage_idempotency.StorageIdempotencyTests.test_cleanup_runs_on_one_replica_at_a_time) ... skipped 'DATABASE_URL is not configured'
test_conflict_on_different_body (test_storage_idempotency.StorageIdempotencyTests.test_conflict_on_different_body) ... skipped 'DATABASE_URL is not configured'
test_expired_key_can_be_reused_and_is_cleaned (test_storage_idempotency.StorageIdempotencyTests.test_expired_key_can_be_reused_and_is_cleaned) ... skipped 'DATABASE_URL is not configured'
test_failure_inside_transaction_stores_nothing (test_storage_idempotency.StorageIdempotencyTests.test_failure_inside_transaction_stores_nothing) ... skipped 'DATABASE_URL is not configured'
test_threads_same_key_single_insert (test_storage_idempotency.StorageIdempotencyTests.test_threads_same_key_single_insert) ... skipped 'DATABASE_URL is not configured'
test_failure_after_inserts_leaves_nothing (test_storage_rollback.StorageRollbackTests.test_failure_after_inserts_leaves_nothing) ... skipped 'DATABASE_URL is not configured'
test_migrations_are_idempotent (test_storage_rollback.StorageRollbackTests.test_migrations_are_idempotent) ... skipped 'DATABASE_URL is not configured'
test_no_orphan_chats_in_database (test_storage_rollback.StorageRollbackTests.test_no_orphan_chats_in_database) ... skipped 'DATABASE_URL is not configured'
test_passwords_stored_as_argon2id (test_storage_rollback.StorageRollbackTests.test_passwords_stored_as_argon2id) ... skipped 'DATABASE_URL is not configured'

----------------------------------------------------------------------
Ran 91 tests in 11.178s

OK (skipped=33)

== Concurrent write test
PASS: concurrent write test; 10 clients x 10 messages = 100 messages; no lost or duplicate messages

ALL STUDENT TESTS PASSED
EXIT=0
PASS: lab5 public API scenario; infrastructure and grading evidence remain separate.
EXIT=0
