Repository navigation
[Pipe] Make two pipe fields thread-safe for SonarCloud's reliability gate - #19109
Conversation
…gate PipeTaskInfo updated a volatile boolean with |=, which is not atomic; it is now an AtomicBoolean. PipeResourceMetrics published a Map through a volatile field; it is now an AtomicReference holding an unmodifiable map. Both were reported as new bugs by SonarCloud and fail the quality gate (new_reliability_rating) for every pull request.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19109 +/- ##
============================================
- Coverage 48.23% 48.23% -0.01%
Complexity 625 625
============================================
Files 5572 5572
Lines 411672 411675 +3
Branches 54225 54226 +1
============================================
- Hits 198558 198557 -1
- Misses 213114 213118 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Caideyipi
left a comment
There was a problem hiding this comment.
Reviewed 5df911a; no actionable issues found. Checked the exception-persistence call paths and the metrics bind/unbind lifecycle. Setting the flag only on failures preserves its pending-state semantics, and the map is fully populated before publication and never modified afterward, with the no-op fallback preserved. All 42 CI checks on this commit passed. No additional tests were run for this review.



Description
SonarCloud's quality gate currently fails for every pull request with
new_reliability_rating= 3 (C, the limit is 1). The rating comes from two bugs in recently merged code, not from the pull requests themselves (e.g. #19104, #19107, #19108):PipeTaskInfo(#19056)pipeMetaExceptionPersistencePending |= hasExceptionon avolatile booleanis not atomicAtomicBoolean, set only when there is an exceptionPipeResourceMetrics(#19106)Mappublished through avolatilefield is not thread-safeAtomicReferenceholding an unmodifiable map;bindTo/unbindFromreplace it as a wholeBehavior is unchanged: the flag is still set on a recorded exception and cleared after persistence, and the reject counters are still looked up by reason with a no-op default.
Tests
PipeResourceMetricsTest,PipeMemoryManagerTest,PipeMemoryManagerResizeTest,PipeTaskInfoAutoRestartTest,PipeTaskInfoConsensusPipeTest,PipeMetaSyncProcedureTest,AbstractOperatePipeProcedureV2Test: 67 tests pass;spotless:checkpasses.🤖 Generated with Claude Code