Skip to content

Fix low-priority Pipeline review findings (volatile reads, sentinel exception, assertion strengthening)#138

Merged
Chris-Wolfgang merged 1 commit into
feature/83-pipeline-apifrom
fix/pipeline-review-low-priority
Apr 25, 2026
Merged

Fix low-priority Pipeline review findings (volatile reads, sentinel exception, assertion strengthening)#138
Chris-Wolfgang merged 1 commit into
feature/83-pipeline-apifrom
fix/pipeline-review-low-priority

Conversation

@Chris-Wolfgang
Copy link
Copy Markdown
Owner

Stacks on top of #134 (parallel to #137). Addresses the low-priority findings from the code review.

Fixes

# Finding Fix
6 CurrentItemCount / CurrentSkippedItemCount getters read without Volatile.Read, while writers use Interlocked.Increment. Theoretical weak-memory-model hazard. Volatile.Read(ref _currentItemCount) in ExtractorBase, LoaderBase, TransformerBase. Free on x86/x64, correct on ARM NetFx.
7 Test doubles throw raw InvalidOperationException on unused overloads. A future routing bug surfaces as a confusing generic exception. Add WrongOverloadCalledException sentinel; CancelOnly* doubles now throw it with the overload signature in the message.
11 Pre-cancelled-token tests only assert "some OperationCanceledException was thrown" — a regression where cancellation fires mid-stream after 1-2 items still passes. Add Assert.Empty(loader.Loaded) after the cancellation throw in CancelOnlyTests and FullTests.

Stats

  • 9 files changed
  • 208/208 tests pass in Release on net10.0 (existing tests strengthened; no new tests needed)
  • 0 build warnings / errors

Not included

Review findings #10 (informational — covariance doc note), #12 (wait for CI signal on field keyword), and #13 (style nitpick) were judged not worth the churn.

🤖 Generated with Claude Code

Addresses findings #6, #7, and #11 from the review.

#6 — Use Volatile.Read when reading the Interlocked-incremented
CurrentItemCount and CurrentSkippedItemCount fields on ExtractorBase,
LoaderBase, and TransformerBase. Writers use Interlocked.Increment;
pairing the reads with Volatile.Read closes a theoretical
weak-memory-model read hazard (relevant primarily on older ARM NetFx
targets) and is free on x86/x64.

#7 — Replace the raw InvalidOperationException throws in the
CancelOnly* test doubles with a sentinel WrongOverloadCalledException.
A future Pipeline refactor that accidentally routes through a bare
overload will now produce a unique, named exception in test output
instead of a generic "Operation is not valid" message.

#11 — Assert Assert.Empty(loader.Loaded) after the pre-cancelled-token
cancellation tests on CancelOnlyTests and FullTests. Previously the
tests only verified that SOME OperationCanceledException was thrown;
a regression where cancellation fires mid-stream after one or two
items would have still passed.

208/208 tests pass in Release on net10.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Chris-Wolfgang Chris-Wolfgang merged commit 2309346 into feature/83-pipeline-api Apr 25, 2026
1 check passed
@Chris-Wolfgang Chris-Wolfgang deleted the fix/pipeline-review-low-priority branch April 25, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant