Skip to content

Releases: Tyler-Keith-Thompson/Afluent

Release 1.0.11

24 Nov 02:05
f90d0fc

Choose a tag to compare

Fix hang in SingleValueSubject + Timeout (#198)

## Bug

Fixes a bug in `SingleValueSubject` that could cause hangs due to lack of cooperative cancellation.

Most notably, it would prevent `timeout` from throwing an error if the subject never finished.

### Before

```swift
// this would hang if subject never finishes (does not throw a TimeoutError)
DeferredTask { try await subject.execute() }.timeout(.seconds(1)).execute()
```

### After

```swift
// this throws a TimeoutError as expected
DeferredTask { try await subject.execute() }.timeout(.seconds(1)).execute()
```

I've verified that without the fix (the cooperative cancellation `cancel()` implementation on `SingleValueSubject`) both new tests will hang.

## Caveats

With the diff at time of writing, this change is "opt in", due to the fact that a cancelled `SingleValueSubject` will now throw if `send()` is called and the subject has been cancelled. This is breaking behavioral change that may cause unexpected failures in consumer code (in fact, some of Afluent's own tests would break with this change).

Another option to consider would be ignoring the already-finished continuation when `send()` is called if the `SingleValueSubject` was finished due to cancellation. This may be a more desirable behavior, since it would enable cooperative cancellation to be rolled out without breaking current consumer expectations.

Please let me know what you think and which path forward seems preferable!

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **New Features**
  * Added public cancellation capability for single-value operations so they can be cancelled cleanly.

* **Documentation**
  * Added a warning about requiring cooperative cancellation on inputs to avoid hangs.

* **Bug Fixes**
  * Suppress spurious completion errors when an operation is cancelled, improving cancellation behavior.

* **Tests**
  * Added tests for cancellation behavior and timeout error message assertions.

<sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Release 1.0.10

15 Sep 03:06
2e5423c

Choose a tag to compare

[serial-task-queue-cleanup] - Added an enqueue method as well as a sy…

Release 1.0.9

04 Jul 20:34
7b33947

Choose a tag to compare

Added syntax highlighting for DocC on web (#194)

Guess who forgot that you need the language specified in your example markdown so that DocC on the web highlights it?

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Documentation**
  * Improved documentation formatting by specifying Swift syntax highlighting for all example code blocks in the API reference. This enhances readability and clarity of code examples in the generated documentation. No changes were made to functionality or behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Release 1.0.8

04 Jul 20:14
e75692e

Choose a tag to compare

Added examples to documentation for all operators (#192)

Added examples to the DocC documentation to help bring Afluent more in line with the usability of Combine

Release 1.0.7

17 Jun 20:03
1c93840

Choose a tag to compare

[retry-on-type] - Added retry on cast - TT (#190)

Closes #187 by adding new retry operators that retry if the error can be cast to a specific type for both AsyncSequence and AsynchronousUnitOfWork

Release 1.0.6

16 Jun 18:58
f3d640e

Choose a tag to compare

[scan-operator] - Added a scan operator - TT (#188)

[Scan](https://developer.apple.com/documentation/combine/publisher/scan(_:_:)) is an operator provided by Combine that's handy for creating streams that know how to operate over previous values. For example, you can use a trick like this to look at the previous and current value in a sequence:
```swift
scan(Optional<(Output?, Output)>.none) { ($0?.1, $1) }
    .compactMap { $0 }
```

This would allow you to build up sequences that only emit when the upstream changes its value. 

The addition to Afluent furthers the parity between Afluent and Combine.

Release 1.0.5

26 Mar 19:45
418c6f5

Choose a tag to compare

[publicize-share] - Remove all SPI protections - TT (#184)

Previously the `share` operator on `AsyncSequence` was behind `@_spi(Experimental)` because it'd been taken from swift-async-algorithms. This also prevented `shareFromCache`, `CurrentValueSubject`, and `PassthroughSubject` from being exposed without the SPI. Now that we've had some users in production with it I think it's about time to get rid of the SPI protections. They've honestly been more irritating than helpful.

Release 1.0.4

21 Mar 14:36
e3ad390

Choose a tag to compare

Implement output in (#180)

Implement `output(in:)` similar to Combine - https://developer.apple.com/documentation/combine/publisher/output(in:)
Incoming ranges are reduced to `Range<Int>` same way as Apple does it in Combine.

Release 1.0.3

19 Mar 21:03
e7ae58e

Choose a tag to compare

Enable URLSession additions on other OS's in swift 6 (#181)

With [this PR](https://github.com/swiftlang/swift-corelibs-foundation/pull/4970), the async/await URLSession functions are now available on other OS's, but only in swift 6.

Updates `URLSessionAdditions.swift` to also check for swift 6, and enable these urlsession -> afluent bridge functions when possible.

Release 1.0.2

10 Mar 01:54
c9b2a6b

Choose a tag to compare

Implement async sequence output at (#178)

Feature parity with Combine - https://developer.apple.com/documentation/combine/publisher/output(at:)

1. Implement `output(at:)` similar to `collect`.
2. Document.
3. Test.
4. Extract some repeated test helpers to avoid copying them.