forked from mtusi2026/mtusi2026lab2
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