fix(extensions): return pooled buffers after enumeration failures - #34
Conversation
Protect pooled Error buffers from exceptional and short ICollection enumeration so rentals are not lost and stale slots cannot be exposed.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
ChangesErrorCollection pooling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized change returns pooled buffers correctly after enumeration failures and uses the number of items actually yielded; the public API is unchanged and no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Merged. Thank you, and I owe you an explanation for three days of silence that had nothing to do with the work. Why it sat. Two failures stacked, both mine:
Neither was about your code, and you had no way to see either from your side. The reviewI verified it rather than reading it:
Three things I want to name specifically. The You fixed something the issue did not ask for. Using You diagnosed #33 three days before I did. Your checklist left Leaving a box unticked and explaining why is worth more than a green checklist, and it is rarer. It is now in Where to next, if you want moreYour instinct for buffer ownership is exactly what these need, in the order I would pick them:
No pressure on any of them, and comment |
|
@snowyukitty this shipped in Verdict 2.8.0, and you are now on https://baryo.dev/community and on the org profile at https://github.com/BaryoDev. Written up as what it was: buffers were returned to the pool only on the success path, so an enumeration that threw leaked them. A quiet failure that would have been very hard to find from the symptom. Sorry again about the three days of silence, which was a workflow gate on my side rather than anything about your PR. #25, #28 and #30 are still open if you fancy another. Thank you. |
What this changes
Return the rented
ErrorCollectionbuffer when anICollection<Error>enumerator throws, and use the number of items actually yielded whenCountoverstates the sequence length. A private pool seam makes the exception-path ownership test deterministic without changing the public API.Related issue
Fixes #24.
Checklist
dotnet test Verdict.slnpasses locally (one unrelated existingProblemDetailsFactorytest races with tests that mutate process-wide defaults when the assembly runs in parallel; it passes in isolation)CHANGELOG.mdupdated under## [Unreleased]Verification
dotnet build Verdict.sln --configuration Release(0 errors)Verdict.Extensions.Tests(145 passed)Verdict.ApiApproval.Tests(8 passed; public API unchanged)dotnet format ... --verify-no-changes(0 files changed)git diff --checkPublic API and performance
The public API is unchanged. The new helper is private, and the normal path still uses
ArrayPool<Error>.Shared; no relevant benchmark exists in the repository.Disclosure: OpenAI Codex assisted with implementation and tests. The exact revised patch was independently reviewed by Google Antigravity and validated locally; no AI model is credited as a legal author.
Summary by CodeRabbit
Bug Fixes
Documentation