diff --git a/REPORT.md b/REPORT.md index 6ae02c72..9597934b 100644 --- a/REPORT.md +++ b/REPORT.md @@ -148,6 +148,8 @@ Live проверяет HTTP-процесс. Ready проверяет PostgreSQL | Трек 2: ≥100 000, неравномерные чаты, ≥2 индекса/запроса | make research | 3 индекса × 4 чата × 2 запроса × 30 чтений; 10 write-batch на индекс | [research.json](evidence/research.json), [CSV](evidence/query-measurements.csv) | | Backup → новое хранилище → сверка | make research | Новый контейнер и volume; 100 000 сообщений, все counts, 7 samples и полный SHA-256 совпали | [research.json](evidence/research.json) | +**Чистый clone проверен:** commit `cddd65fe4eabe3ffe175a23f5454f6c9546f763a`; сборка без кэша, 11 HTTP-тестов, проверки инфраструктуры и публичный persistence — PASS. UID API — 10001. Реальные параметры PostgreSQL: fsync=on, synchronous_commit=on, full_page_writes=on ([runtime.json](evidence/runtime.json)). + `make clean-clone-test` проверяет текущий commit, а не незакоммиченные изменения. Он удаляет только свои одноразовые тестовые volumes. CI workflow приложения добавлен отдельно; удалённый запуск GitHub Actions на Gitea не заявляется. ## Исследование и фактические результаты diff --git a/evidence/clean-clone-run.txt b/evidence/clean-clone-run.txt new file mode 100644 index 00000000..874d3008 --- /dev/null +++ b/evidence/clean-clone-run.txt @@ -0,0 +1,254 @@ +python3 student-tests/clean_clone.py +Cloning into '/var/folders/tz/0tqdjrtd1mx3m7v45zb83xyh0000gn/T/mtusi-lab2-clean-vav2boi5/repo'... +PASS: local secret files ready; existing credentials preserved; values not printed + Image mtusi-messenger:lab2 Building +#1 [internal] load local bake definitions +#1 reading from stdin 665B done +#1 DONE 0.0s + +#2 [internal] load build definition from Dockerfile +#2 transferring dockerfile: 611B 0.0s done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/library/python:3.13.12-slim-bookworm@sha256:a58daefb915e1e03ad48f3ca4df8832065412c5c35cacb9d39f4229184de12b6 +#3 DONE 0.1s + +#4 [internal] load .dockerignore +#4 transferring context: 259B done +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 29.87kB done +#5 DONE 0.0s + +#6 [1/6] FROM docker.io/library/python:3.13.12-slim-bookworm@sha256:a58daefb915e1e03ad48f3ca4df8832065412c5c35cacb9d39f4229184de12b6 +#6 resolve docker.io/library/python:3.13.12-slim-bookworm@sha256:a58daefb915e1e03ad48f3ca4df8832065412c5c35cacb9d39f4229184de12b6 0.0s done +#6 DONE 0.0s + +#7 [2/6] WORKDIR /app +#7 CACHED + +#8 [3/6] COPY requirements.txt /app/ +#8 DONE 0.0s + +#9 [4/6] RUN pip install --no-cache-dir -r requirements.txt +#9 1.531 Collecting psycopg==3.3.6 (from -r requirements.txt (line 1)) +#9 1.822 Downloading psycopg-3.3.6-py3-none-any.whl.metadata (4.4 kB) +#9 2.125 Collecting psycopg-binary==3.3.6 (from -r requirements.txt (line 2)) +#9 2.206 Downloading psycopg_binary-3.3.6-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.metadata (2.7 kB) +#9 2.301 Collecting psycopg-pool==3.3.1 (from -r requirements.txt (line 3)) +#9 2.380 Downloading psycopg_pool-3.3.1-py3-none-any.whl.metadata (2.8 kB) +#9 2.490 Collecting redis==6.4.0 (from -r requirements.txt (line 4)) +#9 2.782 Downloading redis-6.4.0-py3-none-any.whl.metadata (10 kB) +#9 2.999 Collecting typing_extensions==4.16.0 (from -r requirements.txt (line 5)) +#9 3.068 Downloading typing_extensions-4.16.0-py3-none-any.whl.metadata (3.3 kB) +#9 3.149 Downloading psycopg-3.3.6-py3-none-any.whl (215 kB) +#9 3.269 Downloading psycopg_binary-3.3.6-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (6.8 MB) +#9 4.770 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.8/6.8 MB 4.6 MB/s 0:00:01 +#9 4.841 Downloading psycopg_pool-3.3.1-py3-none-any.whl (40 kB) +#9 4.910 Downloading redis-6.4.0-py3-none-any.whl (279 kB) +#9 5.144 Downloading typing_extensions-4.16.0-py3-none-any.whl (45 kB) +#9 5.176 Installing collected packages: typing_extensions, redis, psycopg-binary, psycopg, psycopg-pool +#9 5.686 +#9 5.688 Successfully installed psycopg-3.3.6 psycopg-binary-3.3.6 psycopg-pool-3.3.1 redis-6.4.0 typing_extensions-4.16.0 +#9 5.688 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning. +#9 5.927 +#9 5.927 [notice] A new release of pip is available: 25.3 -> 26.2.2 +#9 5.927 [notice] To update, run: pip install --upgrade pip +#9 DONE 6.0s + +#10 [5/6] COPY --chown=10001:10001 src/ /app/src/ +#10 DONE 0.0s + +#11 [6/6] COPY --chown=10001:10001 migrations/ /app/migrations/ +#11 DONE 0.0s + +#12 exporting to image +#12 exporting layers +#12 exporting layers 0.9s done +#12 exporting manifest sha256:ec38c0d7f504d178f20b19caaa9ca90637469a9d89924405f8258f0ad343745a done +#12 exporting config sha256:1c9d67207c543c701b54e9c27c2c87e4f57659bc96c19f6e594958053772f817 done +#12 exporting attestation manifest sha256:c7e2df0ed5f296c3c557448dbcb30f4700cfde164345a6605f579041ba683bf1 done +#12 exporting manifest list sha256:ad12cd28bb21f4b9e979de23b4159a772b3e1733b533db3732760997f8b5c6ca done +#12 naming to docker.io/library/mtusi-messenger:lab2 done +#12 unpacking to docker.io/library/mtusi-messenger:lab2 +#12 unpacking to docker.io/library/mtusi-messenger:lab2 0.2s done +#12 DONE 1.1s + +#13 resolving provenance for metadata file +#13 DONE 0.0s + Image mtusi-messenger:lab2 Built + Network mtusi-lab2-clean-fa4a4e67_default Creating + Network mtusi-lab2-clean-fa4a4e67_default Created + Volume mtusi-lab2-clean-fa4a4e67_postgres_data Creating + Volume mtusi-lab2-clean-fa4a4e67_postgres_data Created + Container mtusi-lab2-clean-fa4a4e67-valkey-1 Creating + Container mtusi-lab2-clean-fa4a4e67-postgres-1 Creating + Container mtusi-lab2-clean-fa4a4e67-valkey-1 Created + Container mtusi-lab2-clean-fa4a4e67-postgres-1 Created + Container mtusi-lab2-clean-fa4a4e67-api-1 Creating + Container mtusi-lab2-clean-fa4a4e67-api-1 Created + Container mtusi-lab2-clean-fa4a4e67-postgres-1 Starting + Container mtusi-lab2-clean-fa4a4e67-valkey-1 Starting + Container mtusi-lab2-clean-fa4a4e67-postgres-1 Started + Container mtusi-lab2-clean-fa4a4e67-valkey-1 Started + Container mtusi-lab2-clean-fa4a4e67-postgres-1 Waiting + Container mtusi-lab2-clean-fa4a4e67-postgres-1 Healthy + Container mtusi-lab2-clean-fa4a4e67-api-1 Starting + Container mtusi-lab2-clean-fa4a4e67-api-1 Started + Container mtusi-lab2-clean-fa4a4e67-valkey-1 Waiting + Container mtusi-lab2-clean-fa4a4e67-api-1 Waiting + Container mtusi-lab2-clean-fa4a4e67-postgres-1 Waiting + Container mtusi-lab2-clean-fa4a4e67-valkey-1 Healthy + Container mtusi-lab2-clean-fa4a4e67-postgres-1 Healthy + Container mtusi-lab2-clean-fa4a4e67-api-1 Healthy +/Library/Frameworks/Python.framework/Versions/3.11/bin/python3 scripts/check_contract.py +PASS: offline skeleton structure, local refs and Python syntax; application NOT tested. +/Library/Frameworks/Python.framework/Versions/3.11/bin/python3 tests/smoke.py --base-url "http://127.0.0.1:54996" +PASS: lab2 public API scenario; infrastructure and grading evidence remain separate. +BASE_URL="http://127.0.0.1:54996" /Library/Frameworks/Python.framework/Versions/3.11/bin/python3 -m unittest discover -s student-tests -p 'test_*.py' -v +test_100_messages_10_clients (test_api.APItests.test_100_messages_10_clients) ... ok +test_authentication_before_access_and_foreign_chat (test_api.APItests.test_authentication_before_access_and_foreign_chat) ... ok +test_bad_password_unknown_username_and_basic_only_for_login (test_api.APItests.test_bad_password_unknown_username_and_basic_only_for_login) ... ok +test_chat_rollback_and_membership_validation (test_api.APItests.test_chat_rollback_and_membership_validation) ... ok +test_empty_message_unicode_and_sender (test_api.APItests.test_empty_message_unicode_and_sender) ... ok +test_logout_revokes_only_current_session (test_api.APItests.test_logout_revokes_only_current_session) ... ok +test_malformed_json_and_types (test_api.APItests.test_malformed_json_and_types) ... ok +test_multiple_pages_bad_limits_and_cross_resource_cursor (test_api.APItests.test_multiple_pages_bad_limits_and_cross_resource_cursor) ... ok +test_racing_registration (test_api.APItests.test_racing_registration) ... ok +test_read_after_write_during_pagination (test_api.APItests.test_read_after_write_during_pagination) ... ok +test_unicode_password_128_codepoints_and_colon (test_api.APItests.test_unicode_password_128_codepoints_and_colon) ... ok + +---------------------------------------------------------------------- +Ran 11 tests in 6.694s + +OK +{ + "date_utc": "2026-10-30T11:10:01.394552+00:00", + "checks": { + "failed_chat_transaction_leaves_no_chat_or_members": true, + "valkey_really_caches_profiles": { + "cached_profiles": 48, + "all_profiles_public_fields_only": true, + "positive_ttl": true + }, + "password_kdf_and_hashed_tokens": { + "all_passwords_scrypt": true, + "all_token_digests_32_bytes": true + }, + "cache_outage": { + "fallback_profile_and_history": true, + "anonymous_rejected": true, + "logout_effective": true, + "scenario_seconds": 0.046 + }, + "cache_restart_no_revoked_session_resurrection": true, + "cache_flush_repopulates_from_postgres": true, + "postgres_outage": { + "authenticated_request_503_seconds": 2.013, + "live_200": true, + "ready_503": true, + "no_anonymous_trust": true + }, + "postgres_recovery_same_session": true, + "expiry_ttl_2_seconds": true, + "repeat_migration_does_not_duplicate_data": { + "migrations": 1, + "users": 50 + }, + "full_stack_persistence": { + "api_and_all_stores_restarted": true, + "before": { + "api": "2026-10-30T11:09:47.802537633Z", + "postgres": "2026-10-30T11:10:12.094949338Z", + "valkey": "2026-10-30T11:10:04.426432126Z" + }, + "after": { + "api": "2026-10-30T11:10:21.846859885Z", + "postgres": "2026-10-30T11:10:21.684876843Z", + "valkey": "2026-10-30T11:10:21.711542843Z" + }, + "elapsed_seconds": 7.545 + } + }, + "status": "PASS" +} + Container mtusi-lab2-clean-fa4a4e67-api-1 Stopping + Container mtusi-lab2-clean-fa4a4e67-api-1 Stopped + Container mtusi-lab2-clean-fa4a4e67-api-1 Removing + Container mtusi-lab2-clean-fa4a4e67-api-1 Removed + Container mtusi-lab2-clean-fa4a4e67-valkey-1 Stopping + Container mtusi-lab2-clean-fa4a4e67-postgres-1 Stopping + Container mtusi-lab2-clean-fa4a4e67-postgres-1 Stopped + Container mtusi-lab2-clean-fa4a4e67-postgres-1 Removing + Container mtusi-lab2-clean-fa4a4e67-postgres-1 Removed + Container mtusi-lab2-clean-fa4a4e67-valkey-1 Stopped + Container mtusi-lab2-clean-fa4a4e67-valkey-1 Removing + Container mtusi-lab2-clean-fa4a4e67-valkey-1 Removed + Network mtusi-lab2-clean-fa4a4e67_default Removing + Volume mtusi-lab2-clean-fa4a4e67_postgres_data Removing + Volume mtusi-lab2-clean-fa4a4e67_postgres_data Removed + Network mtusi-lab2-clean-fa4a4e67_default Removed +{ + "date_utc": "2026-10-30T11:09:36.487058+00:00", + "source_commit": "cddd65fe4eabe3ffe175a23f5454f6c9546f763a", + "fresh_project_and_volumes": true, + "checks": { + "build_from_source": true, + "public_smoke": true, + "own_http_tests": true, + "infrastructure_and_public_persistence": true, + "api_uid_10001": true + }, + "infrastructure": { + "date_utc": "2026-10-30T11:10:01.394552+00:00", + "checks": { + "failed_chat_transaction_leaves_no_chat_or_members": true, + "valkey_really_caches_profiles": { + "cached_profiles": 48, + "all_profiles_public_fields_only": true, + "positive_ttl": true + }, + "password_kdf_and_hashed_tokens": { + "all_passwords_scrypt": true, + "all_token_digests_32_bytes": true + }, + "cache_outage": { + "fallback_profile_and_history": true, + "anonymous_rejected": true, + "logout_effective": true, + "scenario_seconds": 0.046 + }, + "cache_restart_no_revoked_session_resurrection": true, + "cache_flush_repopulates_from_postgres": true, + "postgres_outage": { + "authenticated_request_503_seconds": 2.013, + "live_200": true, + "ready_503": true, + "no_anonymous_trust": true + }, + "postgres_recovery_same_session": true, + "expiry_ttl_2_seconds": true, + "repeat_migration_does_not_duplicate_data": { + "migrations": 1, + "users": 50 + }, + "full_stack_persistence": { + "api_and_all_stores_restarted": true, + "before": { + "api": "2026-10-30T11:09:47.802537633Z", + "postgres": "2026-10-30T11:10:12.094949338Z", + "valkey": "2026-10-30T11:10:04.426432126Z" + }, + "after": { + "api": "2026-10-30T11:10:21.846859885Z", + "postgres": "2026-10-30T11:10:21.684876843Z", + "valkey": "2026-10-30T11:10:21.711542843Z" + }, + "elapsed_seconds": 7.545 + } + }, + "status": "PASS" + }, + "status": "PASS" +} diff --git a/evidence/clean-clone.json b/evidence/clean-clone.json new file mode 100644 index 00000000..4080c2de --- /dev/null +++ b/evidence/clean-clone.json @@ -0,0 +1,63 @@ +{ + "date_utc": "2026-10-30T11:09:36.487058+00:00", + "source_commit": "cddd65fe4eabe3ffe175a23f5454f6c9546f763a", + "fresh_project_and_volumes": true, + "checks": { + "build_from_source": true, + "public_smoke": true, + "own_http_tests": true, + "infrastructure_and_public_persistence": true, + "api_uid_10001": true + }, + "infrastructure": { + "date_utc": "2026-10-30T11:10:01.394552+00:00", + "checks": { + "failed_chat_transaction_leaves_no_chat_or_members": true, + "valkey_really_caches_profiles": { + "cached_profiles": 48, + "all_profiles_public_fields_only": true, + "positive_ttl": true + }, + "password_kdf_and_hashed_tokens": { + "all_passwords_scrypt": true, + "all_token_digests_32_bytes": true + }, + "cache_outage": { + "fallback_profile_and_history": true, + "anonymous_rejected": true, + "logout_effective": true, + "scenario_seconds": 0.046 + }, + "cache_restart_no_revoked_session_resurrection": true, + "cache_flush_repopulates_from_postgres": true, + "postgres_outage": { + "authenticated_request_503_seconds": 2.013, + "live_200": true, + "ready_503": true, + "no_anonymous_trust": true + }, + "postgres_recovery_same_session": true, + "expiry_ttl_2_seconds": true, + "repeat_migration_does_not_duplicate_data": { + "migrations": 1, + "users": 50 + }, + "full_stack_persistence": { + "api_and_all_stores_restarted": true, + "before": { + "api": "2026-10-30T11:09:47.802537633Z", + "postgres": "2026-10-30T11:10:12.094949338Z", + "valkey": "2026-10-30T11:10:04.426432126Z" + }, + "after": { + "api": "2026-10-30T11:10:21.846859885Z", + "postgres": "2026-10-30T11:10:21.684876843Z", + "valkey": "2026-10-30T11:10:21.711542843Z" + }, + "elapsed_seconds": 7.545 + } + }, + "status": "PASS" + }, + "status": "PASS" +} diff --git a/evidence/final-checks.txt b/evidence/final-checks.txt new file mode 100644 index 00000000..92635506 --- /dev/null +++ b/evidence/final-checks.txt @@ -0,0 +1,8 @@ +.venv/bin/python 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/python tests/smoke.py --base-url "http://localhost:8082" +PASS: lab2 public API scenario; infrastructure and grading evidence remain separate. +PASS: protected README/course/contracts/public tests unchanged; experimental SHA256 match. +PASS: local credentials, .env, volumes and dump excluded from Git. diff --git a/evidence/runtime.json b/evidence/runtime.json new file mode 100644 index 00000000..7e59d896 --- /dev/null +++ b/evidence/runtime.json @@ -0,0 +1,35 @@ +{ + "date_utc": "2026-10-30T11:12:38.044339+00:00", + "services": { + "api": { + "image": "mtusi-messenger:lab2", + "image_id": "sha256:ad12cd28bb21f4b9e979de23b4159a772b3e1733b533db3732760997f8b5c6ca", + "health": "healthy", + "memory_limit_bytes": 536870912, + "nano_cpus": 1000000000, + "pids_limit": 256 + }, + "postgres": { + "image": "postgres:17.9-bookworm@sha256:47f917f7409eacd22fc5dfb1dee634e1b55cf0c01d1a7eb701be2227a03e0641", + "image_id": "sha256:47f917f7409eacd22fc5dfb1dee634e1b55cf0c01d1a7eb701be2227a03e0641", + "health": "healthy", + "memory_limit_bytes": 536870912, + "nano_cpus": 1000000000, + "pids_limit": 128 + }, + "valkey": { + "image": "valkey/valkey:8.1.3-alpine@sha256:d827e7f7552cdee40cc7482dbae9da020f42bc47669af6f71182a4ef76a22773", + "image_id": "sha256:d827e7f7552cdee40cc7482dbae9da020f42bc47669af6f71182a4ef76a22773", + "health": "healthy", + "memory_limit_bytes": 134217728, + "nano_cpus": 500000000, + "pids_limit": 64 + } + }, + "postgres_durability": { + "version": "17.9 (Debian 17.9-1.pgdg12+1)", + "fsync": "on", + "synchronous_commit": "on", + "full_page_writes": "on" + } +}