Document clean-clone verification and lab2 evidence
Skeleton contracts / contracts (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s
This commit is contained in:
@@ -39,8 +39,11 @@ APP_PORT — порт внутри API, HTTP_PORT — локальный пор
|
||||
|
||||
## Проверки
|
||||
|
||||
Все перечисленные проверки прошли. Проверенный коммит реализации: 8757a93f0a9200d7a03710c0bdaddb792d6c4db9.
|
||||
|
||||
| Проверка | Результат / доказательство |
|
||||
| --- | --- |
|
||||
| Чистый клон, новая БД и новые секреты | [clean-clone-summary.json](evidence/clean-clone-summary.json), [лог](evidence/clean-clone-verification.txt) |
|
||||
| Структура и OpenAPI, публичный smoke, 17 собственных тестов | [verification.txt](evidence/verification.txt) |
|
||||
| Рестарт API и PostgreSQL, прежние сессия и курсор, сохранение logout | [persistence.json](evidence/persistence.json), [restart.json](evidence/restart.json) |
|
||||
| Повторные миграции без изменения данных | [persistence.json](evidence/persistence.json) |
|
||||
@@ -54,3 +57,7 @@ APP_PORT — порт внутри API, HTTP_PORT — локальный пор
|
||||
Одна API-реплика и одна БД, без Redis и HA. HTTP предназначен для локального стенда с синтетическими данными. Пагинация не фиксирует общий snapshot между запросами; время назначается PostgreSQL, порядок при одинаковом времени определяется UUID.
|
||||
|
||||
Использованы документации [Psycopg](https://www.psycopg.org/psycopg3/docs/), [PostgreSQL](https://www.postgresql.org/docs/17/) и [argon2-cffi](https://argon2-cffi.readthedocs.io/).
|
||||
|
||||
Проверено в Windows, Docker 29.9.3, Compose 5.7.0; Docker видит 12 CPU и 15.5 GiB RAM. Отдельные CPU/RAM-лимиты контейнеров не заданы.
|
||||
|
||||
Для независимого клона использована команда: `python -X utf8 scripts/lab.py verify --project mtusi-lab2-clean --port 18082 --test-port 18083`. При начале проверки Git был чистым; тестовый стенд затем остановлен.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ttl_seconds": 2,
|
||||
"expiry_unchanged_on_restart": true,
|
||||
"before_restart": 200,
|
||||
"after_expiry_and_restart": 401,
|
||||
"new_login": 201
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"public_persistence": "PASS",
|
||||
"cursor_after_restart": "PASS",
|
||||
"logout_after_restart": "PASS",
|
||||
"migration_replay": "PASS",
|
||||
"database": {
|
||||
"users": 55,
|
||||
"chats": 19,
|
||||
"members": 38,
|
||||
"messages": 118,
|
||||
"sessions": 51,
|
||||
"migrations": 1,
|
||||
"expiry_fingerprint": "ef6f330828f7fbc3b9ee9424aa600ce8",
|
||||
"passwords_are_argon2id": true,
|
||||
"session_hashes_only": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"project": "mtusi-lab2-clean",
|
||||
"before": {
|
||||
"api": {
|
||||
"id": "4bc8a3ad7d060a4a6a0c117aa22c50346513e3442658b9050249e87e370fc28f",
|
||||
"image": "sha256:b6427e01f60f1932f3445a0e8866c55e23be31ef057712938a078b5664758bf1",
|
||||
"started_at": "2026-11-09T17:22:54.308909187Z",
|
||||
"running": true,
|
||||
"user": "messenger",
|
||||
"volumes": []
|
||||
},
|
||||
"db": {
|
||||
"id": "4119017ada970b97fa8de367cada81ce3574ccf174ebf40bac331951857393a3",
|
||||
"image": "sha256:665dc7b37ac52a17e298511414c21d23ffa4e6a6ef6225b3e5d59c7afb35e994",
|
||||
"started_at": "2026-11-09T17:22:50.975638795Z",
|
||||
"running": true,
|
||||
"user": "",
|
||||
"volumes": [
|
||||
"mtusi-lab2-clean_pgdata"
|
||||
]
|
||||
}
|
||||
},
|
||||
"after": {
|
||||
"api": {
|
||||
"id": "4bc8a3ad7d060a4a6a0c117aa22c50346513e3442658b9050249e87e370fc28f",
|
||||
"image": "sha256:b6427e01f60f1932f3445a0e8866c55e23be31ef057712938a078b5664758bf1",
|
||||
"started_at": "2026-11-09T17:23:03.90844242Z",
|
||||
"running": true,
|
||||
"user": "messenger",
|
||||
"volumes": []
|
||||
},
|
||||
"db": {
|
||||
"id": "4119017ada970b97fa8de367cada81ce3574ccf174ebf40bac331951857393a3",
|
||||
"image": "sha256:665dc7b37ac52a17e298511414c21d23ffa4e6a6ef6225b3e5d59c7afb35e994",
|
||||
"started_at": "2026-11-09T17:23:03.534522617Z",
|
||||
"running": true,
|
||||
"user": "",
|
||||
"volumes": [
|
||||
"mtusi-lab2-clean_pgdata"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"date_utc": "2026-11-09T17:22:31.878991+00:00",
|
||||
"platform": "Windows-11-10.0.26200-SP0",
|
||||
"source_commit": "8757a93f0a9200d7a03710c0bdaddb792d6c4db9",
|
||||
"worktree_dirty_at_start": false,
|
||||
"project": "mtusi-lab2-clean",
|
||||
"status": "PASS",
|
||||
"persistence": {
|
||||
"public_persistence": "PASS",
|
||||
"cursor_after_restart": "PASS",
|
||||
"logout_after_restart": "PASS",
|
||||
"migration_replay": "PASS",
|
||||
"database": {
|
||||
"users": 55,
|
||||
"chats": 19,
|
||||
"members": 38,
|
||||
"messages": 118,
|
||||
"sessions": 51,
|
||||
"migrations": 1,
|
||||
"expiry_fingerprint": "ef6f330828f7fbc3b9ee9424aa600ce8",
|
||||
"passwords_are_argon2id": true,
|
||||
"session_hashes_only": true
|
||||
}
|
||||
},
|
||||
"expiry": {
|
||||
"ttl_seconds": 2,
|
||||
"expiry_unchanged_on_restart": true,
|
||||
"before_restart": 200,
|
||||
"after_expiry_and_restart": 401,
|
||||
"new_login": 201
|
||||
},
|
||||
"dependency": {
|
||||
"live_without_db": 200,
|
||||
"ready_without_db": 503,
|
||||
"business_without_db": 503,
|
||||
"recovered": 200
|
||||
},
|
||||
"containers": {
|
||||
"api": {
|
||||
"id": "4bc8a3ad7d060a4a6a0c117aa22c50346513e3442658b9050249e87e370fc28f",
|
||||
"image": "sha256:b6427e01f60f1932f3445a0e8866c55e23be31ef057712938a078b5664758bf1",
|
||||
"started_at": "2026-11-09T17:23:03.90844242Z",
|
||||
"running": true,
|
||||
"user": "messenger",
|
||||
"volumes": []
|
||||
},
|
||||
"db": {
|
||||
"id": "4119017ada970b97fa8de367cada81ce3574ccf174ebf40bac331951857393a3",
|
||||
"image": "sha256:665dc7b37ac52a17e298511414c21d23ffa4e6a6ef6225b3e5d59c7afb35e994",
|
||||
"started_at": "2026-11-09T17:23:25.219178741Z",
|
||||
"running": true,
|
||||
"user": "",
|
||||
"volumes": [
|
||||
"mtusi-lab2-clean_pgdata"
|
||||
]
|
||||
}
|
||||
},
|
||||
"docker": "29.9.3",
|
||||
"resources": {
|
||||
"cpus": 12,
|
||||
"memory_bytes": 16591400960
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
$ .\.venv\Scripts\python.exe -X utf8 -m pip install --disable-pip-version-check --no-input --progress-bar off --quiet -r .\requirements.lock -r .\requirements-validation.lock
|
||||
Environment ready; existing settings and secrets preserved
|
||||
$ .\.venv\Scripts\python.exe -X utf8 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
$ .\.venv\Scripts\python.exe -X utf8 scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
$ docker compose --project-name mtusi-lab2-clean --env-file .env config --quiet
|
||||
$ docker compose --project-name mtusi-lab2-clean --env-file .env config --quiet
|
||||
$ docker compose --project-name mtusi-lab2-clean --env-file .env build api
|
||||
Image mtusi-messenger:lab2 Building
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 1.14kB 0.0s done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 728B done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [internal] load metadata for docker.io/library/python:3.13.14-slim-bookworm@sha256:67a1e1f215ccda113cfc024e8639049257e88f273898f595b61476d128d387e8
|
||||
#3 DONE 0.0s
|
||||
|
||||
#4 [internal] load .dockerignore
|
||||
#4 transferring context: 196B done
|
||||
#4 DONE 0.0s
|
||||
|
||||
#5 [1/6] FROM docker.io/library/python:3.13.14-slim-bookworm@sha256:67a1e1f215ccda113cfc024e8639049257e88f273898f595b61476d128d387e8
|
||||
#5 resolve docker.io/library/python:3.13.14-slim-bookworm@sha256:67a1e1f215ccda113cfc024e8639049257e88f273898f595b61476d128d387e8 0.0s done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [internal] load build context
|
||||
#6 transferring context: 26.21kB 0.0s done
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 [3/6] COPY requirements.lock .
|
||||
#7 CACHED
|
||||
|
||||
#8 [2/6] WORKDIR /app
|
||||
#8 CACHED
|
||||
|
||||
#9 [4/6] RUN python -m pip install --no-cache-dir -r requirements.lock && useradd --uid 10001 --create-home messenger
|
||||
#9 CACHED
|
||||
|
||||
#10 [5/6] COPY src ./src
|
||||
#10 DONE 0.0s
|
||||
|
||||
#11 [6/6] COPY migrations ./migrations
|
||||
#11 DONE 0.0s
|
||||
|
||||
#12 exporting to image
|
||||
#12 exporting layers 0.1s done
|
||||
#12 exporting manifest sha256:20d31298f29c9be05143bcced337bae79ca3b61cd1632cc4cbf26562b6699d2e 0.0s done
|
||||
#12 exporting config sha256:4f53b2b8057a4756fc3f8d80480253cd217c7d31b6c26a36b97b98a373a9ef1b 0.0s done
|
||||
#12 exporting attestation manifest sha256:3a5c3cf869c852c1d278c9a02fa1e4f7abb74ec7d297b1bae6921ae8e40acfdf 0.0s done
|
||||
#12 exporting manifest list sha256:b6427e01f60f1932f3445a0e8866c55e23be31ef057712938a078b5664758bf1 0.0s done
|
||||
#12 naming to docker.io/library/mtusi-messenger:lab2 done
|
||||
#12 unpacking to docker.io/library/mtusi-messenger:lab2 0.0s done
|
||||
#12 DONE 0.2s
|
||||
|
||||
#13 resolving provenance for metadata file
|
||||
#13 DONE 0.0s
|
||||
Image mtusi-messenger:lab2 Built
|
||||
$ docker compose --project-name mtusi-lab2-clean --env-file .env up -d --no-build db migrate api
|
||||
Network mtusi-lab2-clean_default Creating
|
||||
Network mtusi-lab2-clean_default Creating
|
||||
Volume mtusi-lab2-clean_pgdata Creating
|
||||
Volume mtusi-lab2-clean_pgdata Creating
|
||||
Volume mtusi-lab2-clean_pgdata Created
|
||||
Volume mtusi-lab2-clean_pgdata Created
|
||||
Network mtusi-lab2-clean_default Created
|
||||
Network mtusi-lab2-clean_default Created
|
||||
Container mtusi-lab2-clean-db-1 Creating
|
||||
Container mtusi-lab2-clean-db-1 Created
|
||||
Container mtusi-lab2-clean-migrate-1 Creating
|
||||
Container mtusi-lab2-clean-migrate-1 Created
|
||||
Container mtusi-lab2-clean-api-1 Creating
|
||||
Container mtusi-lab2-clean-api-1 Created
|
||||
Container mtusi-lab2-clean-db-1 Starting
|
||||
Container mtusi-lab2-clean-db-1 Started
|
||||
Container mtusi-lab2-clean-db-1 Waiting
|
||||
Container mtusi-lab2-clean-db-1 Healthy
|
||||
Container mtusi-lab2-clean-migrate-1 Starting
|
||||
Container mtusi-lab2-clean-migrate-1 Started
|
||||
Container mtusi-lab2-clean-migrate-1 Waiting
|
||||
Container mtusi-lab2-clean-migrate-1 Exited
|
||||
Container mtusi-lab2-clean-api-1 Starting
|
||||
Container mtusi-lab2-clean-api-1 Started
|
||||
API ready: http://127.0.0.1:18082
|
||||
$ .\.venv\Scripts\python.exe -X utf8 tests/smoke.py --base-url http://127.0.0.1:18082
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
$ .\.venv\Scripts\python.exe -X utf8 -m unittest discover -s student-tests -v
|
||||
test_auth_and_access (test_api.ApiTests.test_auth_and_access) ... ok
|
||||
test_bad_cursors_and_limits (test_api.ApiTests.test_bad_cursors_and_limits) ... ok
|
||||
test_chat_pagination (test_api.ApiTests.test_chat_pagination) ... ok
|
||||
test_chat_validation_is_atomic (test_api.ApiTests.test_chat_validation_is_atomic) ... ok
|
||||
test_invalid_json_and_content_type (test_api.ApiTests.test_invalid_json_and_content_type) ... ok
|
||||
test_message_fields_and_unicode (test_api.ApiTests.test_message_fields_and_unicode) ... ok
|
||||
test_message_pagination (test_api.ApiTests.test_message_pagination) ... ok
|
||||
test_parallel_messages (test_api.ApiTests.test_parallel_messages) ... ok
|
||||
test_parallel_username (test_api.ApiTests.test_parallel_username) ... ok
|
||||
test_read_after_write (test_api.ApiTests.test_read_after_write) ... ok
|
||||
test_user_fields (test_api.ApiTests.test_user_fields) ... ok
|
||||
test_logout_only_revokes_current_session (test_sessions.SessionTests.test_logout_only_revokes_current_session) ... ok
|
||||
test_malformed_basic_and_body (test_sessions.SessionTests.test_malformed_basic_and_body) ... ok
|
||||
test_only_bearer_identifies_user (test_sessions.SessionTests.test_only_bearer_identifies_user) ... ok
|
||||
test_password_boundaries_unicode_colon_spaces (test_sessions.SessionTests.test_password_boundaries_unicode_colon_spaces) ... ok
|
||||
test_password_required_and_limits (test_sessions.SessionTests.test_password_required_and_limits) ... ok
|
||||
test_wrong_and_unknown_credentials (test_sessions.SessionTests.test_wrong_and_unknown_credentials) ... ok
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Ran 17 tests in 5.462s
|
||||
|
||||
OK
|
||||
$ .\.venv\Scripts\python.exe -X utf8 tests/resilience.py --mode persistence --action-script .\scripts\restart.cmd --base-url http://127.0.0.1:18082
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
$ docker compose --project-name mtusi-lab2-clean --env-file .env run --rm --no-deps migrate
|
||||
Container mtusi-lab2-clean-migrate-run-9671d7deee9b Creating
|
||||
Container mtusi-lab2-clean-migrate-run-9671d7deee9b Created
|
||||
Already applied: 001_initial.sql
|
||||
$ docker compose --project-name mtusi-lab2-clean --env-file .env run --rm --no-deps migrate
|
||||
Container mtusi-lab2-clean-migrate-run-8ac35ab74f98 Creating
|
||||
Container mtusi-lab2-clean-migrate-run-8ac35ab74f98 Created
|
||||
Already applied: 001_initial.sql
|
||||
PASS: old session/cursor, durable logout and repeatable migrations
|
||||
$ docker compose --project-name mtusi-lab2-clean-ttl --env-file .env up -d --no-build db migrate api
|
||||
Network mtusi-lab2-clean-ttl_default Creating
|
||||
Network mtusi-lab2-clean-ttl_default Creating
|
||||
Volume mtusi-lab2-clean-ttl_pgdata Creating
|
||||
Volume mtusi-lab2-clean-ttl_pgdata Creating
|
||||
Volume mtusi-lab2-clean-ttl_pgdata Created
|
||||
Volume mtusi-lab2-clean-ttl_pgdata Created
|
||||
Network mtusi-lab2-clean-ttl_default Created
|
||||
Network mtusi-lab2-clean-ttl_default Created
|
||||
Container mtusi-lab2-clean-ttl-db-1 Creating
|
||||
Container mtusi-lab2-clean-ttl-db-1 Created
|
||||
Container mtusi-lab2-clean-ttl-migrate-1 Creating
|
||||
Container mtusi-lab2-clean-ttl-migrate-1 Created
|
||||
Container mtusi-lab2-clean-ttl-api-1 Creating
|
||||
Container mtusi-lab2-clean-ttl-api-1 Created
|
||||
Container mtusi-lab2-clean-ttl-db-1 Starting
|
||||
Container mtusi-lab2-clean-ttl-db-1 Started
|
||||
Container mtusi-lab2-clean-ttl-db-1 Waiting
|
||||
Container mtusi-lab2-clean-ttl-db-1 Healthy
|
||||
Container mtusi-lab2-clean-ttl-migrate-1 Starting
|
||||
Container mtusi-lab2-clean-ttl-migrate-1 Started
|
||||
Container mtusi-lab2-clean-ttl-migrate-1 Waiting
|
||||
Container mtusi-lab2-clean-ttl-migrate-1 Exited
|
||||
Container mtusi-lab2-clean-ttl-api-1 Starting
|
||||
Container mtusi-lab2-clean-ttl-api-1 Started
|
||||
API ready: http://127.0.0.1:18083
|
||||
$ docker compose --project-name mtusi-lab2-clean-ttl --env-file .env restart --timeout 5 api
|
||||
Container mtusi-lab2-clean-ttl-api-1 Restarting
|
||||
Container mtusi-lab2-clean-ttl-api-1 Started
|
||||
PASS: TTL=2, expired token rejected after API restart; fresh login works
|
||||
$ docker compose --project-name mtusi-lab2-clean-ttl --env-file .env stop --timeout 10 api db
|
||||
Container mtusi-lab2-clean-ttl-api-1 Stopping
|
||||
Container mtusi-lab2-clean-ttl-api-1 Stopped
|
||||
Container mtusi-lab2-clean-ttl-db-1 Stopping
|
||||
Container mtusi-lab2-clean-ttl-db-1 Stopped
|
||||
$ docker compose --project-name mtusi-lab2-clean --env-file .env stop --timeout 10 db
|
||||
Container mtusi-lab2-clean-db-1 Stopping
|
||||
Container mtusi-lab2-clean-db-1 Stopped
|
||||
$ docker compose --project-name mtusi-lab2-clean --env-file .env start db
|
||||
Container mtusi-lab2-clean-db-1 Starting
|
||||
Container mtusi-lab2-clean-db-1 Started
|
||||
PASS: DB outage -> live=200, ready/business=503; session works after recovery
|
||||
$ .\.venv\Scripts\python.exe -X utf8 tests/smoke.py --base-url http://127.0.0.1:18082
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
PASS: full lab2 verification
|
||||
Reference in New Issue
Block a user