Repository navigation
Conversation
Tiny Code Reviewthe AI provider rate-limited the request This is advice, not a gate. Re-run with the |
unRekable
left a comment
There was a problem hiding this comment.
Code Review
🟡 1 finding (0 blocking).
The PR wires Signal file sends onto the existing plumbing: Command::SendWith, the shared upload helper, Context::landed, and the capabilities the composer already reads; no protocol field changes. The picture re-encode in chatd mirrors the Tiny sealing path (same decode limits, same JPEG/PNG strategy), so no process boundary is crossed that the repo does not already cross. The echo suppression in apply is sound (timestamp list plus a stored-attachments backstop covers restarts). The one real defect is memory: the send holds every payload and then deep-clones the whole set, several GB at this PR's own caps.
Residual risk
- A picture that fails to decode, or is past the 100-megapixel or 16384-pixel limits, goes out as the original file with its EXIF, XMP or GPS intact — the same fallback the Tiny sealing path takes, so the module's no-metadata promise holds only for pictures that decode.
- Photos and files the phone itself sends still arrive as text rows with the Photo/Video placeholder (the pre-existing unsupported handling in real.rs); this diff covers sends from this computer only.
- A cancel cannot interrupt presage once an attachment upload has begun: check runs between files, so a 100 MB upload runs to completion after Cancel.
- wire::File derives Debug while holding full payload bytes; nothing formats it today, but any future {:?} on a Body would copy a user's file into a log.
| let quote = quote_of(account, conversation, reply_to).map_err(|fault| fault.words())?; | ||
| let sent = account | ||
| .wire | ||
| .send(&to, Body::Files { text: text.to_owned(), quote: quote.clone(), files: prepared.clone() }) |
There was a problem hiding this comment.
There was a problem hiding this comment.
The send moves the prepared files into the wire instead of cloning them. Each payload is written to disk under the client id first, and a failed send deletes those files. Signal's upload still holds that one buffer, because upload_attachment takes the bytes.
unRekable
left a comment
There was a problem hiding this comment.
Code Review
🟢 No findings.
The delta (old head 658053d to new head 09e0984) touches only crates/chatd/src/adapters/signal.rs: send_files now writes each prepared file to the media cache before the wire send, moves prepared into Body::Files instead of cloning it, keys the attachment ids on the shell's client id (known before Signal names the message), and a failed send deletes the copies it just wrote (forget_landed). That resolves the prior major: no second copy of a message's payload exists; the bytes are held once and then consumed per file by presage's upload_attachment. I found no blocker or major in the new full diff: the phone-copy echo guard is bounded and has a store-side fallback, image decoding is capped before allocation, media ids are hashed before they reach a path, nothing logs a File's bytes, and the new test and e2e scenario cover the send and the phone-copy rule.
Residual risk
- A send still holds one full copy of every file in memory at once (up to ~3.2 GB at the PR's own 32x100 MB caps) until presage consumes them; streaming would need a presage change, so the single copy is the smallest fix.
- A failed send deletes the files it just landed but leaves their registered media rows, so orphaned rows naming a missing file sit in the store until the cache's LRU sweep reaches them.
- If the media-cache write fails before the send (a full disk), the message still goes and the local row shows the attachment with no local copy behind it; only the sender's own view is affected.
The row writes the payloads to disk, then the wire takes that same buffer. A failed send removes the files it wrote.
09e0984 to
0af1525
Compare
What changed and why
A Signal chat can send photos, videos and files. The composer can attach them because Signal now reports a file size and a count. A still picture is written again so camera data stays here, and a copy that comes back from the phone does not replace the file already shown.
Type
Platforms
Proof
Scenario: e2e/scenarios/signal-send-file
Lab run:
Compatibility
No protocol change. An older client still sends text. The file limits use the fields the composer already reads.
Risk and rollback
A bad send fails that one message, or a phone copy could replace the file already shown. Revert this change.
Release note
Photos, videos and files can be sent in a Signal chat.