Skip to content

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Sep 15, 2025

This PR adjusts the interface of Attachment so that it always conforms to Copyable even if the value it wraps does not. This allows us to avoid eagerly serializing attachments that are not Copyable but are Sendable. We must still eagerly serialize non-sendable attachments.

This change will allow us to support "attachment lifetime" (API to be designed, see XCTest's API here) more efficiently and for more attachable values. If you're paying the cost of serialization for attachments you don't end up keeping, that's a waste of\ resources.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

This PR adjusts the interface of `Attachment` so that it always conforms to
`Copyable` even if the value it wraps does not. This allows us to avoid eagerly
serializing attachments that are not `Copyable` but _are_ `Sendable`. We must
still eagerly serialize non-sendable attachments.

This change will allow us to support "attachment lifetime" (API to be designed,
see XCTest's API [here](https://developer.apple.com/documentation/xctest/xctattachment/lifetime-swift.enum))
more efficiently and for more attachable values. If you're paying the cost of
serialization for attachments you don't end up keeping, that's a waste of\
resources.
@grynspan grynspan added this to the Swift 6.x (main) milestone Sep 15, 2025
@grynspan grynspan self-assigned this Sep 15, 2025
@grynspan grynspan added the enhancement New feature or request label Sep 15, 2025
@grynspan grynspan added concurrency 🔀 Swift concurrency/sendability issues performance 🏎️ Performance issues attachments/activities 🖇️ Work related to attachments and/or activities labels Sep 15, 2025
@grynspan grynspan merged commit 368a94d into main Sep 15, 2025
18 checks passed
@grynspan grynspan deleted the jgrynspan/avoid-eager-copying-attachments branch September 15, 2025 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attachments/activities 🖇️ Work related to attachments and/or activities concurrency 🔀 Swift concurrency/sendability issues enhancement New feature or request performance 🏎️ Performance issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants