Retarget to netstandard2.0 + automate publish; include AbortOnCancel - #17
Merged
Merged
Conversation
- Add _withAbortOnCancel field and WithAbortOnCancel()/WithNoAbortOnCancel() fluent methods to Bus<T> - When enabled, cancellation records an abort result instead of throwing OperationCanceledException, allowing the final station to run - Refactor loop to hoist stationType/isLastStation above cancellation check and wrap station execution in else branch - Add cancellation test stations: SyncAdderThenCancel, AsyncAdderThenCancel, AsyncCooperativeCanceller - Add tests 15-18 for default cancellation throw behavior - Add tests 19-22 for AbortOnCancel graceful abort behavior Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Document WithAbortOnCancel()/WithNoAbortOnCancel() in README features, cancellation section, and API reference table - Add "Last updated" timestamp to README - Add Releasing section to CLAUDE.md
- Cargo: single netstandard2.0 target replaces net472;net48;net6.0;net7.0;net8.0 (broadens floor to .NET Framework 4.6.1+; zero-dependency lib needs no polyfills) - Cargo.Tests: fix invalid .net7.0/.net8.0 monikers; keep runnable TFMs - CLAUDE.md: document new target layout
Bring WithAbortOnCancel Bus option into the next release alongside the netstandard2.0 retarget.
- Trigger publish workflow on push to master (was tag push, which never ran) - Add Nerdbank.GitVersioning step to compute the published version - After nuget push, auto-tag the commit with that version and push the tag - Add --skip-duplicate and tag-exists guard so re-runs are safe - Grant contents:write so the workflow can push tags - Update CLAUDE.md Releasing section to describe the automated flow
There was a problem hiding this comment.
Pull request overview
This PR broadens library compatibility by retargeting LightPath.Cargo to netstandard2.0, adds an option to treat cancellation as a graceful abort (WithAbortOnCancel), and introduces an automated publish workflow that releases on merges to master.
Changes:
- Retarget
Cargolibrary tonetstandard2.0and fix invalid test TFMs (.net7.0/.net8.0→net7.0/net8.0). - Add
WithAbortOnCancel/WithNoAbortOnCancelbehavior plus integration tests and README updates. - Add a
publish.ymlworkflow to build/test/pack/push to NuGet and tag the published version.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents new cancellation behavior and API options (needs framework/usage corrections per comments). |
| CLAUDE.md | Updates repo/docs notes, including release automation details. |
| Cargo/Cargo.csproj | Retargets library to netstandard2.0. |
| Cargo/Bus.cs | Implements WithAbortOnCancel behavior in pipeline execution. |
| Cargo.Tests/Integration/Stations/Async.cs | Adds stations used by new cancellation tests. |
| Cargo.Tests/Integration/Async.cs | Adds/adjusts integration tests covering cancellation + AbortOnCancel scenarios. |
| Cargo.Tests/Cargo.Tests.csproj | Fixes invalid TFMs and keeps multi-targeting for tests. |
| .github/workflows/publish.yml | Adds automated publish-on-master workflow (needs Linux build scoping and action pinning per comments). |
Comments suppressed due to low confidence (1)
.github/workflows/publish.yml:36
dotnet build Cargo.slnonubuntu-latestwill try to build all TFMs inCargo.Tests(includingnet472/net48), which typically fails on Linux because .NET Framework reference assemblies aren’t available. Since the workflow only runs tests onnet8.0, build/test steps should be scoped to Linux-runnable TFMs (or switch the job to a Windows runner).
- name: Build
run: dotnet build Cargo.sln --configuration Release
- name: Test
run: dotnet test Cargo.sln --configuration Release --no-build --framework net8.0
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
77
to
78
| var stationType = stationList[currentStationIndex]; | ||
| var isLastStation = stationList[currentStationIndex] == stationList.Last(); |
Comment on lines
+224
to
+231
| var result = await Bus.New<OrderContext>() | ||
| .WithAbortOnCancel() | ||
| .WithStation<SlowStation>() | ||
| .WithFinalStation<CleanupStation>() | ||
| .GoAsync(context, cts.Token); | ||
|
|
||
| // No exception thrown — check bus.Package.IsAborted instead | ||
| ``` |
| - **Cancellation** — pass a `CancellationToken` to `GoAsync()`, accessible via `Package.CancellationToken`. Optionally treat cancellation as a graceful abort instead of an exception. | ||
| - **Tracing** — built-in trace messages for pipeline execution | ||
| - **Result tracking** — inspect results from each station via `Package.Results` | ||
| - **Multi-target** — supports net472, net48, net6.0, net7.0, net8.0 |
Comment on lines
298
to
+302
| - .NET 7.0 | ||
| - .NET 8.0 | ||
|
|
||
| *Last updated: 2026-03-21* | ||
|
|
Comment on lines
+28
to
+31
| - name: Compute version (Nerdbank.GitVersioning) | ||
| id: nbgv | ||
| uses: dotnet/nbgv@master | ||
|
|
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.
Summary
Cargolibrary to a singlenetstandard2.0target (broadens floor to .NET Framework 4.6.1+; zero-dependency lib needs no polyfills).net7.0/.net8.0monikers in the test projectfeature/bug-fixes: addsWithAbortOnCancelBus option + testsVerification
Merging this PR triggers the first automated publish.