Repository navigation
Description
User problem: pasting an image can do nothing visible because the clipboard event is consumed and failed saves are silently ignored.
Reproduced at 9fc8645: mounted real App/useCoder/Composer with fakeCoder. Dispatched an image clipboard event with FileReader returning a data URL. The host save callback returned attachment:null. Asserted the event was prevented, save was invoked, and neither an image chip nor a role=alert error appeared. Then changed the same callback to return an attachment and pasted again; the chip appeared. This success control verifies the mounted paste path. Assertions passed without React console errors. This uses simulated clipboard/host responses, not an actual oversized native clipboard image.
Cause: Composer.onPaste consumes image items, reads their data URL, adds only a truthy returned attachment and ignores rejection. It has no FileReader error recovery. useCoder.saveAttachmentImage also converts thrown host errors to null. attachments.saveImage can return null for unsupported/empty/oversized data. Drop already uses the composer's existing error strip; the paste path should share its failure presentation.
Smallest scope: reuse the composer error strip for reader failure, rejected save and null result. Preserve a useful host reason when available and provide a generic actionable fallback otherwise. Explain size/type rejection where it can be determined. Do not introduce format conversion or increase upload limits.
Acceptance:
- Rejected/null save shows an error, with no success chip; existing draft and attachments survive.
- Reader failure is visible instead of silently consuming the paste.
- A supported successful paste still attaches exactly once; a later good paste recovers after a failure.
- Multiple pasted images can show partial success without hiding rejected items.
- Async completion/errors remain associated with the originating thread.
- Include the mounted null/reject/success path, not only a saveImage unit check.
Dedup: #463 covers HEIC conversion, #469 drop affordances, #142 web picker visibility, #145 image storage/reads. #1206 is the parent screenshot ownership handoff. This issue only fixes failure handling on the existing clipboard-image path.
Activity