mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 09:11:37 +00:00
ci, iwyu: skip subtrees in compilation database #36252
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36252
Loading…
Reference in a new issue
No description provided.
Delete branch "pr/iwyusub"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem: The IWYU CI job analyzes
src/ipc/libmultiprocess/even though its results are thrown away. Every run prints IWYU suggestions for 14 libmultiprocess files in the non-enforced pass, applies them, and then reverts them with thegit restorefrom #36112. The suggestions also disagree with what libmultiprocess's own IWYU CI reports (it runs with-Xiwyu --errorand passes), because the two jobs use different IWYU versions and mapping files. libmultiprocess is the only subtree in this situation; leveldb, crc32c, minisketch and secp256k1 are already excluded fromcompile_commands.jsonwithEXPORT_COMPILE_COMMANDS OFF. #35361 reported this output and said IWYU shouldn't be running on subtrees.Solution: Filter
SHARED_EXCLUDED_SUBTREES(fromtest/lint/lint_ignore_dirs.py) out ofcompile_commands.jsonat the start of the IWYU section ofci/test/03_test_script.sh, so subtree sources are neither analyzed nor edited. This is done in the CI script rather than in cmake so that only IWYU is affected: clang-tidy keeps running on libmultiprocess, and no list of subtree targets has to be maintained incmake/libmultiprocess.cmake(that approach broke-DBUILD_TESTS=OFFin #35418 and was reverted in #35523). The change is three lines inci/test/03_test_script.sh; the rest of the diff is comments.Testing note: You can confirm this works by checking the IWYU CI logs and confirming that output like
/home/runner/work/_temp/src/ipc/libmultiprocess/src/mp/gen.cpp should add these lines:no longer appears.The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
No conflicts as of last run.
Why not https://github.com/bitcoin/bitcoin/pull/35418#pullrequestreview-4428862711?
I think excluding all subtrees from IWYU is better than individually setting in CMAKE_EXPORT_COMPILE_COMMANDS inside individual subtrees because:
It directly addresses the fact that IWYU's instability makes it inappropriate to run on subtrees. IWYU's output changes depending on compiler version, standard libary version, IWYU version, and local mappings so it's not realistic to expect subtrees will be able to pass IWYU checks in bitcoin core, and there's not much reason to care if they do, since benefits of IWYU are faster compile times and more consistent code style, not anything safety related.
This approach works for all subtrees, instead of requiring every individual subtree to hardcode cmake options.
This approach only disables IWYU, and does not disable all other tools or checks that use the compilation database. I don't think that turning off clang-tidy, bitcoin-tidy, and other tools for all subtrees is a good idea just to prevent IWYU noise, when IWYU noise can be prevented by just running it on the right files.
Seems fine, but All of those python3 -c '...' inside bash are fine, but seem a bit hacky.
At some point we can use vanilla Python and drop the jq dep. Something like:
completely untested draft diff
lgtm. Seems fine for a minimal speed-up and minimally smaller ci log output?
Code-review ACK
01e3eca2d8Filtering
SHARED_EXCLUDED_SUBTREESout ofcompile_commands.jsonbefore the IWYU run drops the libmultiprocess sources — including the generatedtest/mp/test/foo.capnp.c++that makes IWYU (llvm-23) abort on aUsingShadowDecl, the crash surfaced in #36235. The follow-upgit restoreis still correctly kept for subtree headers associated with non-subtree TUs. I didn't run the IWYU job locally; reasoning from the diff plus @hebasto's repro and green CI.ACK
01e3eca2d8.FWIW, we can use the
--excludeoption of theiwyu_tool.pytool:Base:
09e22fbbb0caafbd2167657c2a8d409ae435b2ccHead:
01e3eca2d8ee755eed4488a44093759f0eddcb34No verified findings are available from this partial review.
Review coverage was incomplete. The archaeology review had incomplete evidence.
Full review report
Concept ACK filtering SHARED_EXCLUDED_SUBTREES out of compile_commands.json before IWYU
I also agree with the suggestion to replace the IWYU inline python3 -c with vanilla python which also eliminates the need for
jqI tested the suggested python script with a patch to skip the subtrees on
github.com/BrandonOdiwuor/bitcoin@53cab06b3c(see run: https://github.com/BrandonOdiwuor/bitcoin/actions/runs/37636046096/job/112842444834)@ryanofsky do you want to take any of the remaining comments here?
TW: ai rant
Seems fine to merge, but my preference would be to not violate the AI policy in the pull description. The LLM-speak that re-hashes a random set of issues/references seems more confusing than a clear and concise human written opinion.
The discussion in https://github.com/bitcoin/bitcoin/issues/34928 is still ongoing, and it seems fine to have a belt-and-suspender lint for bugprone stuff (tidy and shellcheck?). Excluding iwyu seems fine, given the different/conflicting iwyu versions.
Thanks AI for telling me I can't count to one myself.
No need to push again to this pull, but the description can basically be something like: "The iwyu version used in this repo may differ from the one in a subtree and thus produce conflicting suggestions. Fix it by excluding the subtrees from the compilation database."
Mentioning #36112 seem unrelated, because this is true, before and after this pull.
re: sedited https://github.com/bitcoin/bitcoin/pull/36252#issuecomment-6684294053
@sedited Thanks, I'd like to leave the remaining suggestions for follow-ups. hebasto's
--excludeidea and maflcko's larger rewrite would both rework the whole IWYU block, not only the subtree skip.re: maflcko https://github.com/bitcoin/bitcoin/pull/36252#issuecomment-6685939713
@maflcko Thanks for the review. I updated the description to fix two things you pointed out: it no longer says #35361 asked for subtrees not to be linted at all (agree that is still being discussed in #34928), and it now says the change is three lines plus comments. I'd like to keep the rest, because I find a change easier to review when the description says what the code does now and how the change affects it. If any specific part is unclear, I'm happy to rewrite it.
re: https://github.com/bitcoin/bitcoin/pull/36252#discussion_r4106222875
Thanks, that would work too. I kept the
jqfilter so the subtree skip works the same way as theFILES_WITH_ENFORCED_IWYUsplit right below it, which also filterscompile_commands.jsonwithjq. Switching the whole block toiwyu_tool.pyoptions could be a nice follow-up, though the enforced/warnings split selects files instead of excluding them, so it may not map over as directly.