From 0ce7d6ecf0e971a968c066314f25e2ff9c43212d Mon Sep 17 00:00:00 2001 From: Artyom Date: Thu, 29 Oct 2026 23:12:55 +0300 Subject: [PATCH] Make storage and limits evidence reproducible from any clone storage-evidence listed volumes by the name mtusi2026lab3, so a clone in another directory recorded the volumes of the main stand; it now takes the project name from docker compose config and filters by its label. make limits wrote only the date, while every evidence file promises the date and the commit in its first line; the commit is added. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27 --- openspec/changes/close-lab3-review-gaps/tasks.md | 4 ++-- scripts/evidence-storage.sh | 5 +++-- scripts/limits.py | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/openspec/changes/close-lab3-review-gaps/tasks.md b/openspec/changes/close-lab3-review-gaps/tasks.md index 6c26f819..d05f3aea 100644 --- a/openspec/changes/close-lab3-review-gaps/tasks.md +++ b/openspec/changes/close-lab3-review-gaps/tasks.md @@ -3,12 +3,12 @@ - [x] 1.1 Тест порядка проверок `POST …/messages` для постороннего (`test_request_shape_is_checked_before_access`) - [x] 1.2 Убрать `# type: ignore` из `shared/entrypoints/errors.py` - [x] 1.3 `openspec/config.yaml`: `gunicorn_conf.py` в карте модулей -- [ ] 1.4 Проверка группы: `make lint`, `make student-test`, `make check` +- [x] 1.4 Проверка группы: `make lint`, `make student-test`, `make check` ## 2. Обвязка - [ ] 2.1 `Makefile`: `BASE_URL` по порту `lb`, `API_IMAGE` по каталогу, `detection` трижды, `track1-control` -- [ ] 2.2 `scripts/evidence-storage.sh` — volumes своего проекта; `scripts/limits.py` — коммит в заголовке +- [x] 2.2 `scripts/evidence-storage.sh` — volumes своего проекта; `scripts/limits.py` — коммит в заголовке - [ ] 2.3 `scripts/scaling.py` — полный stderr сбоя `compose up` в `compose-up-failed.log` - [ ] 2.4 `scripts/failover-each.sh` — `docker ps -a` реплик после хука; `scripts/failover-evidence.sh` — `SHIFT` - [ ] 2.5 Проверка группы: `make lint`, `make check`, `bash -n`/`sh -n` скриптов diff --git a/scripts/evidence-storage.sh b/scripts/evidence-storage.sh index 21269afc..8e632c19 100755 --- a/scripts/evidence-storage.sh +++ b/scripts/evidence-storage.sh @@ -38,7 +38,8 @@ tokens="SELECT octet_length(token_hash) AS stored_bytes, count(*) AS sessions FR echo "(пусто: секретов, .env, дампов и volumes в Git нет)" echo "\$ git check-ignore -v secrets/database_url secrets/postgres_password .env backups/" git check-ignore -v secrets/database_url secrets/postgres_password .env backups/ - echo "\$ docker volume ls --filter name=mtusi2026lab3" - docker volume ls --filter name=mtusi2026lab3 + project=$(docker compose config --format json | python3 -c 'import json,sys; print(json.load(sys.stdin)["name"])') + echo "\$ docker volume ls --filter label=com.docker.compose.project=$project" + docker volume ls --filter "label=com.docker.compose.project=$project" } > evidence/secrets.txt echo "evidence/{schema,migrations,kdf,secrets}.txt обновлены" diff --git a/scripts/limits.py b/scripts/limits.py index 2547ea0c..8ed99f72 100644 --- a/scripts/limits.py +++ b/scripts/limits.py @@ -109,7 +109,8 @@ def main(): if not any(row[0] == "api" for row in containers): problems.append("no running api replicas to inspect") lines = [ - f"date: {time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())}", + f"date: {time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())} " + f"commit: {run('git', 'rev-parse', '--short', 'HEAD')[1]}", "$ docker compose --profile bench config --format json (declared)", *table(["service", "cpus/mem", "ports", "secrets", "volumes", "networks", "ro"], services), "",