Skip to content

[Pipe] Make two pipe fields thread-safe for SonarCloud's reliability gate - #19109

Merged
JackieTien97 merged 1 commit into
masterfrom
fix/sonar-reliability-pipe-fields
Nov 5, 2026
Merged

JackieTien97 merged 1 commit into
masterfrom
fix/sonar-reliability-pipe-fields

Conversation

@chrisdutz

Copy link
Copy Markdown
Contributor

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):

File Rule Fix
PipeTaskInfo (#19056) pipeMetaExceptionPersistencePending |= hasException on a volatile boolean is not atomic AtomicBoolean, set only when there is an exception
PipeResourceMetrics (#19106) a Map published through a volatile field is not thread-safe AtomicReference holding an unmodifiable map; bindTo/unbindFrom replace it as a whole

Behavior 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:check passes.

🤖 Generated with Claude Code

…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.
@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.23%. Comparing base (814b770) to head (5df911a).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Caideyipi Caideyipi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JackieTien97
JackieTien97 merged commit 03a28ba into master Nov 5, 2026
42 checks passed
@JackieTien97
JackieTien97 deleted the fix/sonar-reliability-pipe-fields branch November 5, 2026 01:37
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.

3 participants