Skip to content

lint: fix clang-tidy errors exposed by WarningsAsErrors '*' - #7707

Merged
knst merged 2 commits into
dashpay:developfrom
PastaPastaPasta:fix/tidy-warnings-as-errors-develop
Sep 21, 2026
Merged

knst merged 2 commits into
dashpay:developfrom
PastaPastaPasta:fix/tidy-warnings-as-errors-develop

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

develop currently fails the linux64_multiprocess-build / Build source → "Run linters" step (ci/dash/lint-tidy.sh).

#7693 backported bitcoin#26905, which replaced the explicit WarningsAsErrors allowlist in src/.clang-tidy with WarningsAsErrors: '*' (and added a matching -warnings-as-errors=-clang-diagnostic-old-style-cast,-google-readability-casting to ci/dash/lint-tidy.sh so the C-style-cast checks stay advisory). Every other enabled check is now a hard error, which promoted five pre-existing diagnostics from warnings to build failures:

llmq/quorumproofs.cpp:220:38: error: 'push_back' is called inside a loop [performance-inefficient-vector-operation]
llmq/quorumproofs.cpp:405:43: error: 'push_back' is called inside a loop [performance-inefficient-vector-operation]
rpc/quorums.cpp:1569:25:     error: 'push_back' is called inside a loop [performance-inefficient-vector-operation]
rpc/output_script.cpp:133:17: error: 'push_back' is called inside a loop [performance-inefficient-vector-operation]
rpc/util.cpp:890:1:          error: return type 'const std::optional<UniValue::VType>' is 'const'-qualified at the top level [readability-const-return-type]

The three quorum-proof sites came in with #7107; the two rpc/ sites are older code that was only ever a warning before.

The failure is not visible on PRs branched before #7693 merged, because CI checks out the PR head and therefore uses that branch's .clang-tidy. It shows up on any PR whose merge base is at or after #7693 — e.g. https://github.com/dashpay/dash/actions/runs/35530545254/job/106137443857.

What was done?

  • hashes.reserve(...) / leaves.reserve(...) / pubkeys.reserve(...) ahead of the four flagged loops. The sizes are known up front in every case, so this is also a small genuine improvement.
  • Dropped the top-level const from ExpectedType's by-value return type in src/rpc/util.cpp. It never conferred anything.

No behavior changes.

How Has This Been Tested?

Reproduced the failure and verified the fix locally with clang-tidy 19 (same major version as CI's LLVM_VERSION), running the repo's src/.clang-tidy config against a compilation database for the four affected translation units:

  • Before: the two llmq/quorumproofs.cpp errors reproduce verbatim, including the [performance-inefficient-vector-operation,-warnings-as-errors] tag from CI.
  • After: zero performance-inefficient-vector-operation and zero readability-const-return-type diagnostics across all four files.

All four translation units compile clean (rpc/util.cpp, rpc/output_script.cpp, rpc/quorums.cpp, llmq/quorumproofs.cpp) on an aarch64-apple-darwin depends build. Full CI will cover the rest.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

🤖 Generated with Claude Code

PastaPastaPasta and others added 2 commits September 20, 2026 23:07
clang-tidy's performance-inefficient-vector-operation check flags these four loops. They became hard errors when dashpay#7693 backported bitcoin#26905, which replaced the explicit WarningsAsErrors allowlist in src/.clang-tidy with '*'.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
readability-const-return-type: a const-qualified by-value return adds nothing here, and is now a hard error under WarningsAsErrors '*'.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 65ebfb06-7964-48f9-a9cb-d3e2157bebbb

📥 Commits

Reviewing files that changed from the base of the PR and between 75ffaf5 and cf70026.

📒 Files selected for processing (4)
  • src/llmq/quorumproofs.cpp
  • src/rpc/output_script.cpp
  • src/rpc/quorums.cpp
  • src/rpc/util.cpp

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

The change pre-reserves vector capacity in quorum proof construction and RPC handlers before appending hashes, commitment leaves, or public keys. It also removes a top-level const qualifier from the internal ExpectedType return type. The vector contents, RPC behavior, and ExpectedType behavior remain unchanged.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately identifies the clang-tidy fixes. It is concise and directly related to the main changes.
Description check ✅ Passed The description clearly explains the clang-tidy failures, the vector reservation and return-type fixes, testing, and the absence of behavior changes.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

⚠️ DEGRADED — Final review complete — no blockers (commit cf70026) · triage: low · stand-in models (primary models out of quota)

@thepastaclaw thepastaclaw 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.

⚠️ DEGRADED — Final validation — Phase 1 + Phase 2

⚠️ DEGRADED review. The primary review models were unavailable (gpt-6-astra unavailable: All credentials for model gpt-6-astra are cooling down (last error: usage_limit_reached: The usage limit has been reache), so this review ran on stand-in models: gpt-5.6-luna → muse-spark-1.3-contributor, gpt-5.6-sol → muse-spark-1.3-contributor, gpt-5.6-terra → muse-spark-1.3-contributor, gpt-6-astra → muse-spark-1.3-contributor. Both review phases and the independent verifiers still ran, but on weaker models, with Phase 1 capped at high effort. Treat the verdict as provisional; a full-strength re-review will run on the next push once the primary models are back.

Lint-only fix verified against the diff: four reserve() calls use exact up-front sizes with one push per slot, and dropping top-level const from the by-value optional return is a behavior-preserving no-op. No behavior change, no correctness risk.

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: dash-core-commit-history); reviewer 3: muse-spark-1.3-contributor (standing in for gpt-6-astra) (agent: phase2-reviewer, role: general); reviewer 4: muse-spark-1.3-contributor (standing in for gpt-6-astra) (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: muse-spark-1.3-contributor (standing in for gpt-6-astra) (agent: astra-verifier, role: final-verifier)

  • Degraded mode: gpt-6-astra unavailable: All credentials for model gpt-6-astra are cooling down (last error: usage_limit_reached: The usage limit has been reache (detected by probe, since 2026-09-20T20:45:34Z); stand-ins gpt-5.6-luna → muse-spark-1.3-contributor, gpt-5.6-sol → muse-spark-1.3-contributor, gpt-5.6-terra → muse-spark-1.3-contributor, gpt-6-astra → muse-spark-1.3-contributor; Phase 1 effort capped at high
  • Triage: low by muse-spark-1.3-contributor (standing in for gpt-6-astra) (effort low) — Adds vector reserve() calls and removes top-level const on a by-value return across 4 files with no behavior change, small and easy to verify.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort high); agent phase1-reviewer, muse-spark-1.3-contributor — dash-core-commit-history (completed, effort high); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (lane failed), glm-5.3-flash (zai below 15% reserve: 5h 100% left, weekly 13% left)
  • Fresh verifier: muse-spark-1.3-contributor (standing in for gpt-6-astra) — final-verifier; agent astra-verifier
  • Phase 2 reviewers: muse-spark-1.3-contributor (standing in for gpt-6-astra) — general (completed, effort medium); agent phase2-reviewer, muse-spark-1.3-contributor (standing in for gpt-6-astra) — dash-core-commit-history (completed, effort medium); agent phase2-reviewer

@thepastaclaw thepastaclaw added the pastaclaw:commented thepastaclaw's latest review was comment-only label Sep 21, 2026

@knst knst 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.

utACK cf70026

@knst knst modified the milestone: 24 Sep 21, 2026
@knst
knst self-requested a review September 21, 2026 10:13

@knst knst 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.

utACK cf70026

@knst knst closed this Sep 21, 2026
@knst knst reopened this Sep 21, 2026
@knst
knst merged commit f94c4b3 into dashpay:develop Sep 21, 2026
64 checks passed
@thepastaclaw thepastaclaw removed the pastaclaw:commented thepastaclaw's latest review was comment-only label Sep 21, 2026
@PastaPastaPasta
PastaPastaPasta deleted the fix/tidy-warnings-as-errors-develop branch September 21, 2026 15:29
PastaPastaPasta added a commit that referenced this pull request Sep 22, 2026
Since #7707 set WarningsAsErrors: '*' in .clang-tidy, the ten clang-tidy findings in the shared masternode Qt tests merged with #7701 fail the linux64_multiprocess-build lint step. Match the argument comments to CBLSLazyWrapper::Set's specificLegacyScheme parameter, bind const references instead of copying from accessors and optionals that outlive the use, drop const from a returned shared_ptr so it can be moved, and reserve before a push_back loop. Test-only change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
PastaPastaPasta added a commit that referenced this pull request Sep 22, 2026
…tests

2543d64 fix(qt): resolve clang-tidy errors in shared masternode tests (pasta)

Pull request description:

  ## Issue being fixed or feature implemented
  Since #7707, `.clang-tidy` has `WarningsAsErrors: '*'`, so every clang-tidy finding fails the lint step. #7701 (shared masternode Qt GUI) then merged Qt tests that trigger ten clang-tidy checks. As a result, develop's `linux64_multiprocess-build` job has failed in its "Run linters" step since e5de15a (e.g. https://github.com/dashpay/dash/actions/runs/35780433329/job/106931610784).

  ## What was done?
  This change only touches tests (`src/qt/test/`). It makes mechanical fixes for exactly the ten errors in the failing job log (deduplicated):

  - `masternodetestutil.cpp:114` `performance-no-automatic-move`: dropped `const` from the local `shared_ptr<CWallet>` so the return can move it.
  - `masternodetestutil.cpp:211`, `masternodemaintenancetests.cpp:613` `bugprone-argument-comment`: changed `/*bls_legacy_scheme=*/` to `/*specificLegacyScheme=*/` to match the parameter name of `CBLSLazyWrapper::Set`. The callee is unchanged.
  - `masternodewidgettests.cpp:212` `performance-inefficient-vector-operation`: added `ret.reserve(m_shares.size())` before the `push_back` loop.
  - `mnsharesessiontests.cpp:695,698,725` `performance-unnecessary-copy-initialization`: `alice`, `bob` and `conflicting` are now `const MnShareSession&` bound to the function-local `std::optional`s they were copied from. Each optional outlives its reference, and `mergeEnvelope` takes `const MnShareSession&`.
  - `masternodemaintenancetests.cpp:683,685,925` `performance-unnecessary-copy-initialization`: `shares` and `voting` are now `const&` to `MasternodeEntry::shares()` / `votingAddress()`. The `entry` they reference is a function-local that is only passed on by const reference (`UpdateShareDialog` / `DissolveDialog` constructors), so the references stay valid.

  ## How Has This Been Tested?
  On macOS arm64, with depends and `--enable-debug`:
  - `make -C src qt/test/test_dash-qt` builds cleanly.
  - `QT_QPA_PLATFORM=minimal src/qt/test/test_dash-qt`: every suite passes, including MasternodeWidgetTests, MnShareSessionTests, MasternodeMaintenanceTests, SharedMnWidgetTests, SharedMnWizardTests and SharedMnWalkthroughTests. The only skip is the existing `OptionTests::updateFontsWithPixelSizedWidget`, which cannot run under the minimal platform plugin.
  - I ran clang-tidy (Homebrew LLVM 22.1.8; CI uses llvm-19) with the repo `.clang-tidy` on the four files, using a compile database built from the real compile commands. On the base commit it reproduces all ten errors from the CI log. With this change it reports zero diagnostics.
  - `contrib/devtools/clang-format-diff.py` reports nothing for the diff.

  ## Breaking Changes
  None. Test-only change.

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

Top commit has no ACKs.

Tree-SHA512: d20b1a7a5ccf7da96c29b666834581a6bd4b9d60f71b9a23f921daf6fde62c52cb6fe11e25f26b2f2f74443f2b03b8f5fcc71c607a8f1a185bd37d241654baa2
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