Retake the lab 4 evidence on the final code and finish the report

The level 3 and 4 evidence was taken on 24f9d61 and a774a2f, before the
lab 3 fixes were carried over and before the reconciler. Take all of it
again in one series on 81dd816, whose application and stand code is the
final one: a fresh clone runs the launch block of the report from secrets
to reset-data, then one stand from clean volumes gives the smoke, stack,
limits, lb-check, failover of each replica and of the upload replica,
persistence, S3 outage, S3 privacy, lost-answer retry, upload faults, all
stack checks, storage layout and three runs of the upload memory matrix.

The three memory runs keep the peak with three slots at 297-345 MiB
against 512 MiB at the limit without them, but at 40 uploads of 10 MiB
the wait for a slot nears the 8 s request timeout and one run of three
gave 7 of 80 a 503. Those timeouts left 67 invisible intents; the record
shows the reconciler seeing them as fresh and the sweep removing all of
them after the grace period.

Message write load is taken with tests/load.py from a container on the
edge network: 2 106 RPS, no errors, replicas and PostgreSQL at their CPU
limits. The first try from the macOS host is kept as a discarded attempt,
it ran out of ephemeral ports while the replicas answered every request.

The report gets the defense answers, the load section, the evidence
commits, the upload limit order as the pipeline applies it, medians in
the track 2 cost table and the proposals over the word limit; the evidence
index lists every file with its command and commit.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
This commit is contained in:
Artyom
2026-10-30 07:55:34 +03:00
co-authored by Claude Opus 5.5
parent 81dd816df2
commit c8cb263c77
90 changed files with 2851 additions and 957 deletions
+37 -33
View File
@@ -1,30 +1,32 @@
date: 2026-10-28T19:01:15Z commit: 24f9d61
date: 2026-10-30T04:32:50Z commit: 81dd816
$ docker compose ps --format '{{.Service}} {{.Status}} {{.Ports}}'
api Up 17 seconds (healthy)
api Up 17 seconds (healthy)
lb Up 23 seconds (healthy) 127.0.0.1:18084->8080/tcp, 127.0.0.1:24084->8404/tcp
migrate Exited (0) 17 seconds ago
postgres Up 23 seconds (healthy)
s3 Up 8 seconds (healthy)
s3-init Exited (0) 18 seconds ago
valkey Up 23 seconds (healthy)
api Up 18 seconds (healthy)
api Up 18 seconds (healthy)
lb Up 29 seconds (healthy) 127.0.0.1:18084->8080/tcp, 127.0.0.1:24084->8404/tcp
migrate Exited (0) 28 seconds ago
postgres Up 30 seconds (healthy)
s3 Up 30 seconds (healthy)
s3-init Exited (0) 24 seconds ago
valkey Up 30 seconds (healthy)
$ psql -c '\d attachments'
Table "public.attachments"
Column | Type | Collation | Nullable | Default
--------------+--------------------------+-----------+----------+---------
id | uuid | | not null |
chat_id | uuid | | not null |
owner_id | uuid | | not null |
filename | text | | not null |
content_type | text | | not null |
size_bytes | bigint | | not null |
sha256 | text | | not null |
width | integer | | not null |
height | integer | | not null |
object_key | text | C | not null |
status | text | | not null |
created_at | timestamp with time zone | | not null |
updated_at | timestamp with time zone | | not null |
Table "public.attachments"
Column | Type | Collation | Nullable | Default
-------------------+--------------------------+-----------+----------+---------
id | uuid | | not null |
chat_id | uuid | | not null |
owner_id | uuid | | not null |
filename | text | | not null |
content_type | text | | not null |
size_bytes | bigint | | not null |
sha256 | text | | not null |
width | integer | | not null |
height | integer | | not null |
object_key | text | C | not null |
status | text | | not null |
created_at | timestamp with time zone | | not null |
updated_at | timestamp with time zone | | not null |
quarantine_reason | text | | |
quarantined_at | timestamp with time zone | | |
Indexes:
"attachments_pkey" PRIMARY KEY, btree (id)
"attachments_chat_key" UNIQUE CONSTRAINT, btree (id, chat_id)
@@ -34,6 +36,8 @@ Check constraints:
"attachments_content_type_check" CHECK (content_type = ANY (ARRAY['image/png'::text, 'image/jpeg'::text]))
"attachments_filename_check" CHECK (char_length(filename) >= 1 AND char_length(filename) <= 255)
"attachments_height_check" CHECK (height > 0)
"attachments_quarantine_check" CHECK ((quarantine_reason IS NULL) = (quarantined_at IS NULL))
"attachments_quarantine_reason_check" CHECK (quarantine_reason = ANY (ARRAY['missing'::text, 'size_mismatch'::text, 'sha_mismatch'::text]))
"attachments_sha256_check" CHECK (sha256 ~ '^[0-9a-f]{64}$'::text)
"attachments_size_bytes_check" CHECK (size_bytes >= 1 AND size_bytes <= 10485760)
"attachments_status_check" CHECK (status = ANY (ARRAY['pending'::text, 'ready'::text]))
@@ -71,22 +75,22 @@ $ psql: столбцы bytea во всей схеме (хеши токенов
$ psql: вложения по статусу и максимальный размер строки attachments
status | count | max_row_bytes
---------+-------+---------------
ready | 14 | 256
pending | 1 | 256
ready | 16 | 264
pending | 1 | 264
(2 rows)
$ rc object list --recursive root/messenger-attachments/attachments/ | count
14
16
$ rc object list root/messenger-attachments/ (первые 3 объекта, ключи назначены сервером)
[2026-10-28 17:51:13] 109.20 KiB attachments/01a183a3-351f-76fa-aeea-a062669b6d93
[2026-10-28 18:08:05] 109.20 KiB attachments/01a183b2-a436-72cf-be25-cebcbb7b5753
[2026-10-28 18:08:15] 109.20 KiB attachments/01a183b2-cbcf-721b-afae-a1b01f9fdbbd
[2026-10-30 04:29:04] 109.20 KiB attachments/01a18b11-8813-7355-a90c-65a4532e2480
[2026-10-30 04:29:08] 109.20 KiB attachments/01a18b11-97b6-7641-a82b-06b56dc04f0c
[2026-10-30 04:29:15] 109.20 KiB attachments/01a18b11-b2c9-7385-a99d-aa018f1053cb
$ сверка вне API: sha256 и размер последнего ready-вложения в PostgreSQL против байтов объекта в bucket
postgres: 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75 111817
s3: 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75 111817
$ docker inspect api: ReadonlyRootfs, tmpfs, volumes/bind mounts
196b3a876d81 ro=true tmpfs={"/tmp":""} mounts=bind:/run/secrets/database_url bind:/run/secrets/cache_url bind:/run/secrets/cursor_secret bind:/run/secrets/s3_access_key_id bind:/run/secrets/s3_secret_access_key
8bd1d38428d0 ro=true tmpfs={"/tmp":""} mounts=bind:/run/secrets/s3_access_key_id bind:/run/secrets/s3_secret_access_key bind:/run/secrets/database_url bind:/run/secrets/cache_url bind:/run/secrets/cursor_secret
0cc3ee358e59 ro=true tmpfs={"/tmp":""} mounts=bind:/run/secrets/s3_secret_access_key bind:/run/secrets/database_url bind:/run/secrets/cache_url bind:/run/secrets/cursor_secret bind:/run/secrets/s3_access_key_id
899a952a5a21 ro=true tmpfs={"/tmp":""} mounts=bind:/run/secrets/cursor_secret bind:/run/secrets/s3_access_key_id bind:/run/secrets/s3_secret_access_key bind:/run/secrets/database_url bind:/run/secrets/cache_url
$ docker inspect s3: volume данных
volume:mtusi2026lab4_s3data:/data bind::/run/secrets/s3_root_user bind::/run/secrets/s3_root_password
$ секреты сервисов: root-ключи S3 только у s3/s3-init/s3-cli