Matrix mouth: fetch and store chat images (cut A), ChatDelivery v3 #12
Loading…
Reference in a new issue
No description provided.
Delete branch "heimdall/chat-images-cut-a"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Cut A of chat images in the Matrix mouth. Unmerged; nothing deployed.
What it does. For
m.imageevents the Persona is delivered (not its own, not another room, not history), the mouth fetches/_matrix/client/v1/media/download/<server>/<id>as that Persona, from the event's owncontent.urlonly, skipping encrypted events. Type by magic bytes (png/jpeg/webp/gif; SVG refused; declared mime ignored), 5 MiB cap by Content-Length and bytes read, 40 MP header pixel cap, no decoding. Stored underIMAGE_STORE_ROOT/<slug>/<sha256 room id>/<sha256 bytes>[.ext], files 0640, dirs 2750 (setgid kept), temp+rename. Deleted when 24 h old and acked, whichever is later; 50 MiB per room, oldest first. UnsetIMAGE_STORE_ROOT= today's behaviour exactly.Wire. Delivery is a 12-tuple; index 11 is nil or
[path, mime, size, sha256]; pending kind isgamecult.persona.chat_pending.v2. Golden tests compare against Huginn'spersona-chat-v3fixtures byte for byte (copied intotests/fixtures/persona-chat-v3/). The obsolete v1 pending golden is deleted.docs/bridge.mdcorrected.Refusals keep the typed line plus
refused=<word>(encrypted, no-url, fetch-failed, too-big, wrong-type, bad-header, too-many-pixels, store-failed) and a nil image.Systemd wiring (not in this PR, Eureka owns it). The unit needs
StateDirectory=gamecult/bifrost/persona-imagesandIMAGE_STORE_ROOT=/var/lib/gamecult/bifrost/persona-images; per-Persona dirsbifrost:mind-<slug>mode 2750.Deviations. With no store, no
refused=word is added (today's line).tests/persona-matrix-mouth.test.mjsnow answers its fake homeserver in-process: Node's HTTP client cannot start underulimit -v 8000000, so the suite could not run under the memory cap at all.persona-matrix-mouth-send-gate.test.mjsstill uses a real socket and was not run under the cap. Three runtime tests (cursor, brake store, N-persona spawn) fail on this host before and after:koffinative module is missing in the CultLib checkout.Mutants (each guard removed by hand, one test file run under
ulimit -v 8000000, reverted, never committed):<sha256 room>/<sha256 bytes>..Tests:
tests/persona-chat-images.test.mjs(19),tests/persona-matrix-mouth.test.mjs(51),tests/persona-matrix-mouth-runtime.test.mjs(20 pass, 3 pre-existing koffi failures).🤖 Generated with Claude Code