Repository navigation
fix: settle traceScenario as success when the consumer unsubscribes after a value - #27
Open
lukasmatta wants to merge 6 commits into
Conversation
Contributor
Coverage report
Show files with reduced coverage 🔻
Test suite run success753 tests passing in 24 suites. Report generated by 🧪jest coverage report action from 6cca207 |
There was a problem hiding this comment.
🟢 Approval recommended
The focused implementation and regression coverage support the intended behavior, with only a non-blocking documentation inconsistency remaining.
1 open issue
What changed in this PR
Fixes traceScenario settlement for consumers that unsubscribe after receiving a value, addressing the incorrect abandonment reporting described in #26.
Changes:
- Treats teardown after a value as success and runs the outcome mapper.
- Adds
valueThenTeardown: 'cancel'to preserve abandonment behavior for multi-value streams. - Adds real-scenario regression coverage for promise consumers, operator ordering, supersession, and retries.
| File | Description |
|---|---|
projects/ngx-ui-watchtower/src/lib/scenario/uwt-scenario-operators/uwt-scenario-operators.ts |
Updates teardown settlement and adds the cancellation opt-out. |
projects/ngx-ui-watchtower/src/lib/scenario/uwt-scenario-operators/uwt-scenario-operators.spec.ts |
Adds real-scenario tests for consumption and teardown behavior. |
Review effort: Balanced
lukasmatta
marked this pull request as ready for review
October 26, 2026 19:48
fateeand
reviewed
Oct 27, 2026
…-as-abandoned-when-used-with-firstvaluefrom-take1-or-first
lukasmatta
requested review from
TerranceKhumalo-absa and
korel-san
as code owners
October 29, 2026 15:02
fateeand
approved these changes
Oct 29, 2026
…-as-abandoned-when-used-with-firstvaluefrom-take1-or-first
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

traceScenariorecordedabandonedinstead ofsuccesswhen the stream was consumed withfirstValueFrom, or whentake(1)/first()came after it. These unsubscribe upstream once they have a value, before the source'scompletearrives, so the operator only saw a teardown and calledcancel(). Theoutcomemapper never ran either.Changes
successand runs theoutcomemapper. An unsubscribe before any value is stillabandoned, soswitchMapsuperseding an in-flight request andtakeUntilDestroyedbehave as before.valueThenTeardown: 'complete' | 'cancel'(default'complete'). Multi-value streams such as polling can opt back into treating a teardown after a value as abandonment.UwtScenarioand coverfirstValueFrom,lastValueFrom,take(1)/first()before and after the operator,switchMapsuperseding before and after a value, andretryplacement.Behaviour change
Code that relied on the old behaviour, a teardown after a value recorded as
abandoned, will now recordsuccess. UsevalueThenTeardown: 'cancel'to keep the old behaviour.Closes #26