Check upload faults and user errors against the stand

test_attachment_faults.py runs through the balancer against the real
PostgreSQL and RustFS. The negative suite sends a body one byte over
the limit with Content-Length (answered before any body byte) and
chunked, a decompression bomb, truncated and disguised images, missing
and foreign content types, dangerous names, a stranger's reads and
references, an attachment of another chat and invalid lists, checks
each code and error body, and finds no 5xx in the replica logs and no
extra rows.

Faults come from triggers installed for the module and dropped after
it: an AFTER INSERT trigger remembers the id and key of each fault
intent, a BEFORE UPDATE trigger rejects the ready commit for
fault-fail names and holds it for 1.8 s for fault-crash names, while
the test finds the waiting backend's client address and kills that
replica with SIGKILL. The rejected commit leaves neither row nor
object right away and an audit line says compensation; a crash leaves
a pending row and an object, the one aged past the grace period is
swept with its object while the fresh one stays, and an aged ready
attachment in a message still downloads. A body cut after 256 KiB is
logged as 400 with nothing written, and a stalled body gets 503 after
8 s with nothing written.

make upload-faults stores the output in evidence/upload-faults.txt
without tracebacks of locals, and the CI acceptance job runs it.

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-28 22:48:46 +03:00
co-authored by Claude Opus 5.5
parent 28055a8551
commit 98df351235
4 changed files with 482 additions and 5 deletions
@@ -22,10 +22,10 @@
## 4. Проверки против стенда
- [ ] 4.1 `student-tests/stack/test_attachment_faults.py`: негативный suite через LB и журнал без `500`
- [ ] 4.2 Там же: отказ `COMMIT` (триггер) → компенсация; падение реплики между `PUT` и `COMMIT` → остаток виден, свежий переживает проход, старый убран; готовое вложение в сообщении переживает проход; обрыв и зависание тела
- [ ] 4.3 Цель `make upload-faults`, шаг CI
- [ ] 4.4 Проверка группы: `make upload-faults`, `make s3-check`
- [x] 4.1 `student-tests/stack/test_attachment_faults.py`: негативный suite через LB и журнал без `500`
- [x] 4.2 Там же: отказ `COMMIT` (триггер) → компенсация; падение реплики между `PUT` и `COMMIT` → остаток виден, свежий переживает проход, старый убран; готовое вложение в сообщении переживает проход; обрыв и зависание тела
- [x] 4.3 Цель `make upload-faults`, шаг CI
- [x] 4.4 Проверка группы: `make upload-faults`, `make s3-check`
## 5. Замер памяти