Skip to content

cleanup: trim transitive includes from KERNEL and METADATA headers - #8946

Merged
timosachsenberg merged 2 commits into
developfrom
cleanup/trim-transitive-includes-kernel-metadata
Mar 19, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
cleanup/trim-transitive-includes-kernel-metadata

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Remove dead #include directives from 5 core headers (ExperimentalSettings.h, SpectrumSettings.h, FeatureMap.h, ConsensusMap.h, ProteinIdentification.h) and replace full includes with forward declarations where only references/pointers are used
  • Breaks deep transitive include chains rooted in MSExperiment.h (~81 includers), notably removing the entire ProteinIdentification.h chain (25K + 15 transitive includes) from every MSExperiment consumer
  • Adds direct includes to 15 downstream .cpp/test files that previously relied on transitive includes

Test plan

  • Full build (cmake --build with -j$(nproc)) succeeds — all libraries, TOPP tools, and tests compile
  • Full test suite passes (2463/2465 — 2 pre-existing failures unrelated to this PR: LPWrapper_test missing COIN lib, MRMFeatureSelector_test vector bounds assert)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Optimized internal header dependencies across multiple core modules to reduce compile-time coupling while maintaining existing functionality and public APIs.

timosachsenberg and others added 2 commits March 18, 2026 19:55
Remove dead and redundant #include directives from core headers
(ExperimentalSettings.h, SpectrumSettings.h, FeatureMap.h,
ConsensusMap.h, ProteinIdentification.h) and replace full includes
with forward declarations where possible. This breaks deep transitive
include chains rooted in MSExperiment.h (~81 includers), reducing the
headers dragged in by each consumer.

Downstream .cpp files and tests that relied on transitive includes now
include the needed headers directly.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 057b8917-3c82-4e16-b03e-9fb21e9c88e5

📥 Commits

Reviewing files that changed from the base of the PR and between 1ff4dd0 and 21a0ea5.

📒 Files selected for processing (20)
  • src/openms/include/OpenMS/KERNEL/ConsensusMap.h
  • src/openms/include/OpenMS/KERNEL/FeatureMap.h
  • src/openms/include/OpenMS/METADATA/AnnotatedMSRun.h
  • src/openms/include/OpenMS/METADATA/ExperimentalSettings.h
  • src/openms/include/OpenMS/METADATA/ProteinIdentification.h
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h
  • src/openms/source/ANALYSIS/ID/AScore.cpp
  • src/openms/source/ANALYSIS/ID/IDScoreGetterSetter.cpp
  • src/openms/source/ANALYSIS/XLMS/OPXLHelper.cpp
  • src/openms/source/FORMAT/InspectOutfile.cpp
  • src/openms/source/FORMAT/OMSFileLoad.cpp
  • src/openms/source/KERNEL/FeatureMap.cpp
  • src/openms/source/KERNEL/MassTrace.cpp
  • src/openms_gui/include/OpenMS/VISUAL/MetaDataBrowser.h
  • src/openms_gui/source/VISUAL/Painter1DBase.cpp
  • src/tests/class_tests/openms/source/AScore_test.cpp
  • src/tests/class_tests/openms/source/ExperimentalSettings_test.cpp
  • src/tests/class_tests/openms/source/FragmentMassError_test.cpp
  • src/tests/class_tests/openms/source/InspectOutfile_test.cpp
  • src/tests/class_tests/openms/source/PSMExplainedIonCurrent_test.cpp
💤 Files with no reviewable changes (2)
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h
  • src/openms/include/OpenMS/KERNEL/ConsensusMap.h

📝 Walkthrough

Walkthrough

This pull request reorganizes header dependencies across the OpenMS codebase by replacing full includes with forward declarations where possible, adjusting include locations in header files, and adding missing includes to implementation files to ensure proper type definitions at compile time.

Changes

Cohort / File(s) Summary
Metadata Header Dependencies
src/openms/include/OpenMS/KERNEL/ConsensusMap.h, src/openms/include/OpenMS/KERNEL/FeatureMap.h, src/openms/include/OpenMS/METADATA/ProteinIdentification.h
Removed or converted several metadata-related includes to forward declarations (PeptideIdentification, PeptideIdentificationList) while maintaining public API via forward declarations; reduces transitive dependencies.
Annotation and Settings Headers
src/openms/include/OpenMS/METADATA/AnnotatedMSRun.h, src/openms/include/OpenMS/METADATA/ExperimentalSettings.h, src/openms/include/OpenMS/METADATA/SpectrumSettings.h
Added ProteinIdentification.h include to AnnotatedMSRun.h; replaced ProteinIdentification.h with DateTime.h in ExperimentalSettings.h; removed PeptideIdentification.h include from SpectrumSettings.h.
Implementation Files – Analysis Modules
src/openms/source/ANALYSIS/ID/AScore.cpp, src/openms/source/ANALYSIS/ID/IDScoreGetterSetter.cpp, src/openms/source/ANALYSIS/XLMS/OPXLHelper.cpp
Added explicit includes for PeptideHit.h, LogStream.h, and ProteinIdentification.h respectively to ensure type declarations at point of use.
Implementation Files – Format and Kernel
src/openms/source/FORMAT/InspectOutfile.cpp, src/openms/source/FORMAT/OMSFileLoad.cpp, src/openms/source/KERNEL/FeatureMap.cpp, src/openms/source/KERNEL/MassTrace.cpp
Added includes for ProteinIdentification.h, LogStream.h, MSExperiment.h, and numeric library respectively to resolve dependencies previously provided transitively.
GUI and Test Files
src/openms_gui/include/OpenMS/VISUAL/MetaDataBrowser.h, src/openms_gui/source/VISUAL/Painter1DBase.cpp, src/tests/class_tests/openms/source/AScore_test.cpp, src/tests/class_tests/openms/source/ExperimentalSettings_test.cpp, src/tests/class_tests/openms/source/FragmentMassError_test.cpp, src/tests/class_tests/openms/source/InspectOutfile_test.cpp, src/tests/class_tests/openms/source/PSMExplainedIonCurrent_test.cpp
Added includes for MSExperiment.h, LogStream.h, PeptideHit.h, ProteinIdentification.h, and other required types to test and GUI implementations.

Possibly related PRs

Suggested reviewers

  • cbielow
  • jpfeuffer
  • poshul

Poem

🐰 Headers trimmed with careful care,
Forward declarations here and there,
Transitive ties now severed clean,
The compilation graph grows lean! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective: removing redundant includes and replacing them with forward declarations in core KERNEL and METADATA headers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleanup/trim-transitive-includes-kernel-metadata
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@timosachsenberg
timosachsenberg enabled auto-merge (squash) March 18, 2026 19:14
@timosachsenberg
timosachsenberg merged commit 72101f7 into develop Mar 19, 2026
41 checks passed
@timosachsenberg
timosachsenberg deleted the cleanup/trim-transitive-includes-kernel-metadata branch March 19, 2026 01:29
github-actions Bot pushed a commit that referenced this pull request Mar 21, 2026
Add missing changelog entries for:
- BREAKING: Qt string API removal from String/DataValue (#8940)
- BREAKING: Qt6::Core removed from libOpenMS PUBLIC CMake deps (#8965)
- BREAKING: Transitive includes trimmed from KERNEL/METADATA headers (#8946)
- Fix: segfault in FeatureLinkerUnlabeledKD with charge_merging=Any (#8944)

Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Mar 21, 2026
Add missing changelog entries for:
- BREAKING: Qt string API removal from String/DataValue (#8940)
- BREAKING: Qt6::Core removed from libOpenMS PUBLIC CMake deps (#8965)
- BREAKING: Transitive includes trimmed from KERNEL/METADATA headers (#8946)
- Fix: segfault in FeatureLinkerUnlabeledKD with charge_merging=Any (#8944)

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
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.

1 participant