PR #9675 review: attachments in a host workspace no longer hang the composer

PR #9675Review workspace Reviewed at b2d50134

Summary

addAttachments seeded an upload entry {progress: 0} for every attachment. Since #9064, a host draft never starts an upload, so nothing ever settled that entry: the native composer drew a 0% ring and kept Send disabled ("Uploading"). The PR removes the seed and makes beginUpload the only writer that creates an entry, guarded on the attachment still being in the draft. Host drafts now have no entries (no ring, Send works); the cloud path is unchanged because upload() calls beginUpload synchronously in the same handler as addAttachments.

Verdict

Looks good

The root cause is correct and the fix is the smallest one that removes it; all consumers (waitForSettledUploads, awaitAttachmentUploads, both composers, ComposerAttachment.isUploading) already treat a missing entry as "not uploading", so nothing else needs to change.

Findings

No blocking issues. Nits only:

  1. apps/mobile/lib/attachments/settle.test.ts:99 — the describe("beginUpload") block tests store behaviour, and the new composerDraftsStore.test.ts:24 overlaps its first case. Fix: move the two beginUpload tests (retry clears error, ignores removed attachment) into composerDraftsStore.test.ts so the store's tests sit next to the store, and drop the duplicate.
  2. apps/mobile/screens/(authenticated)/stores/composerDraftsStore/composerDraftsStore.test.ts:14 — the SUPER-3442 comment is rationale; AGENTS.md puts that in the commit/PR. Fix: delete it; the test name already says the behaviour.
  3. Coverage gap (optional): no test drives the host path end to end (setDraftAttachmentHome(key,"host") → startAttachmentUploads → entries stay empty). The store test covers the cause, so this is nice-to-have; upload.ts imports expo-file-system, which makes that test cost more.

Checked and fine: awaitAttachmentUploads (upload.ts:192-201) still starts uploads for attachments with no entry, so a draft that switches host→cloud uploads at send instead of hanging. The comment at upload.ts:195 about beginUpload refusing removed attachments is still true with the new guard.

Evidence

iOS (EAS cloud simulator, dev client built from this head's fingerprint, JS from Metro at b2d50134).

Home loaded against the local API.
Cloud path (home composer): photo attached, Send shows the uploading spinner — entry created by beginUpload.
~5 s later the upload settled and Send is enabled. Cloud path unchanged.
Host workspace (deep link): "host is offline", so the composer does not render.

Not verified in the app: the host-workspace composer itself (the actual bug). The sandbox runs neither the relay nor a host-service, so every host shows offline and the workspace screen shows no composer. Tried: the workspace list (empty, host unreachable), then a deep link to a host workspace on satyas-mbp (offline screen above). The host behaviour is covered only by the unit test.

Questions for the author

Test / CI notes