Skip to content

Make Xerces-C++ a private link dependency of libOpenMS - #9712

Merged
timosachsenberg merged 10 commits into
developfrom
feature/xerces-private-link
Jul 8, 2026
Merged

timosachsenberg merged 10 commits into
developfrom
feature/xerces-private-link

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

What & why

Makes Xerces-C++ a PRIVATE link dependency of libOpenMS. Previously XercesC::XercesC was linked PUBLIC because Xerces types leaked out of installed headers — the SAX handler base Internal::XMLHandler derived from xercesc::DefaultHandler, subclasses overrode startElement(..., const xercesc::Attributes&), input-source adapters derived from xercesc::InputSource/BinInputStream, and a few signatures named xercesc::SAXParseException / DOMNode. As a result every consumer of the OpenMS target (pyOpenMS, the GUI, 29 TOPP tools, class tests, third parties) inherited Xerces on its include and link path.

After this PR, Xerces appears in no installed OpenMS header; downstream consumers neither include nor link it, while libOpenMS.so still uses Xerces internally. Closes the Xerces part of #8547.

How

Xerces is encapsulated behind a Xerces-free public API + an internal bridge:

  • XMLHandler no longer derives from xercesc::DefaultHandler. New native callbacks onStartElement(const char16_t* qname, const XMLAttributes&), onEndElement(const char16_t*), onCharacters(const char16_t*, Size) replace the Xerces SAX callbacks. A new internal, non-installed SAX2HandlerAdapter bridges the Xerces SAX2 interface to these (installed as the content+error handler in XMLFile.cpp and ImzMLFile.cpp). EndParsingSoftly still unwinds through parse() unchanged (adapter overrides are intentionally not noexcept).
  • XMLAttributes — a new Xerces-free, opaque (void*-backed) view over xercesc::Attributes exposing value(name) / index(name) / valueByIndex(i).
  • StringManager extracted into its own Xerces-free header with a char16_t API (transcode bodies + doRelease_ specializations moved to StringManager.cpp). CONST_XMLCH is now a plain u"" literal.
  • ~28 handler / *File / validator subclasses migrated to the native callbacks (unused uri/localname dropped — the SAX parser runs namespace-unaware; the handlers only ever used qname).
  • XMLValidator pimpl'd (internal ErrorHandler bridge in the .cpp); MzMLSpectrumDecoder's private handleBinaryDataArray_ takes void* instead of xercesc::DOMNode*.
  • MzIdentMLDOMHandler.h and the four Xerces input-source adapter headers moved to OpenMS_private_headers (compiled, never installed).
  • CMake: XercesC::XercesC (and the macOS CoreFoundation/CoreServices frameworks) moved to OPENMS_DEP_PRIVATE_LIBRARIES. The five class tests that exercise the internal Xerces input-source adapters link Xerces explicitly.
  • Dropped the two pyOpenMS QcMLFile.error/warning(SAXParseException) bindings.

Commits are split by phase (A: additive native surface → B: migrate subclasses → C: cut the base + secondary leaks → D: flip CMake), each building green, so the diff is reviewable phase-by-phase.

Verification

  • Functional: the full parser/validator/handler round-trip suite passes unchanged — MzMLFile, MzXMLFile, MzDataFile, FeatureXMLFile, ConsensusXMLFile, IdXMLFile, MzIdentMLFile, TraMLFile, PepXMLFile, XTandemXMLFile, UnimodXMLFile, ParamXMLFile, ImzMLFile, XQuestResultXMLFile, SemanticValidator, MzMLValidator, XMLValidator, MzMLSpectrumDecoder, XMLHandler, and the four input-stream tests (26/26).
  • Acceptance test: force-recompiling FileInfo (which transitively includes MzMLFile.h etc.) succeeds with no Xerces include dir on its command line, while ldd libOpenMS.so still shows libxerces-c. TOPP tools and pyOpenMS build against the cleaned headers.
  • Reviewed by Codex and an independent agent pass: no correctness regressions found.

Note

XMLCh is assumed to be char16_t (guaranteed on Xerces-C++ ≥3.2, the supported config; a sizeof static_assert guards the boundary casts). On a hypothetical XMLCh = unsigned short build this would be a compile error, not a silent runtime bug.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Improved XML import consistency across multiple file formats via a unified, UTF-16–based handler callback model and a shared attribute wrapper.
  • Bug Fixes
    • More reliable XML parsing/validation behavior with centralized attribute/text handling and updated error/warning/fatal-error routing.
  • Compatibility
    • Python bindings: removed exception-exposing error and warning methods from the QcMLFile wrapper.
  • Build/Platform
    • Refined dependency visibility (including macOS linkage) and updated test/build wiring for internal XML adapters and private headers.

timosachsenberg and others added 5 commits July 7, 2026 22:34
…e SAX callbacks

Introduce Internal::XMLAttributes, an opaque (void*-backed) Xerces-free view over
a SAX attribute list, and add native onStartElement/onEndElement/onCharacters
callbacks to XMLHandler (char16_t / std::u16string_view / XMLAttributes). The
existing Xerces DefaultHandler overrides now forward to these native callbacks;
subclasses still on the Xerces signatures are unaffected (the native path is
dormant until they migrate). Attribute helper signatures switch to XMLAttributes
(constructed transparently from xercesc::Attributes& via a constrained template
ctor). No behavior change; libOpenMS still links Xerces PUBLIC.

Co-Authored-By: Claude Fable 5 <[email protected]>
…native callbacks

Migrate the ~28 SAX handler / *File / validator subclasses from the Xerces-typed
callbacks (startElement/endElement/characters with const XMLCh*, xercesc::Attributes&,
XMLSize_t) to the native onStartElement/onEndElement/onCharacters callbacks
(char16_t / Internal::XMLAttributes / Size). Unused uri/localname args are dropped
(the parser runs namespace-unaware, so localname is always empty). Raw attribute
access (getValue/getIndex/getValue(index)) is rerouted through the XMLAttributes
accessors (value/index/valueByIndex). Extra Xerces-typed private helpers
(handleCVParam_, readRTMZCharge_, getLinkPosition_, getCVTerm_) are retyped to
XMLAttributes. Subclass headers no longer name any Xerces type. Xerces still links
PUBLIC (XMLHandler.h base cut happens in Phase C). All 18 parser round-trip tests
pass unchanged.

Co-Authored-By: Claude Fable 5 <[email protected]>
Remove Xerces from all public/installed OpenMS headers so it can become a PRIVATE
link dependency:

- XMLHandler no longer derives from xercesc::DefaultHandler. A new internal,
  non-installed SAX2HandlerAdapter bridges the Xerces SAX2 interface to the
  Xerces-free onStartElement/onEndElement/onCharacters callbacks and OpenMS-typed
  error handlers. XMLFile.cpp and ImzMLFile.cpp install the adapter as the Xerces
  content+error handler (EndParsingSoftly still unwinds through parse() unchanged).
- Extract StringManager into its own Xerces-free public header (char16_t API;
  transcode bodies + doRelease_ specializations move to StringManager.cpp). The
  shared/unique_xerces_ptr wrappers and CONST_XMLCH move with it; CONST_XMLCH is
  now a plain u"" literal.
- XMLHandler's attribute helpers take XMLAttributes and use char16_t names; parseInt
  is delegated to StringManager::parseInt; equal_ uses std::u16string_view compare.
- XMLValidator no longer derives xercesc::ErrorHandler; an internal
  XMLValidatorErrorHandler_ bridge (in the .cpp) forwards to it.
- MzMLSpectrumDecoder's private handleBinaryDataArray_ takes void* (cast in .cpp)
  instead of xercesc::DOMNode*, dropping the DOM include from its public header.
- MzIdentMLDOMHandler.h and the four Xerces input-source adapter headers are moved
  to OpenMS_private_headers (compiled, never installed).
- Internal .cpp that genuinely use Xerces now include it directly; the common
  `XMLString::transcode("lit")` statics become compile-time u"lit" literals.
- Drop the two pyOpenMS QcMLFile error/warning(SAXParseException) bindings.
- Update XMLHandler_test (StringManager) to the char16_t API.

Xerces still links PUBLIC (flipped in Phase D). All 26 parser/validator/handler
tests pass.

Co-Authored-By: Claude Fable 5 <[email protected]>
Move XercesC::XercesC (and the macOS CoreFoundation/CoreServices frameworks it
needs) from OPENMS_DEP_LIBRARIES to OPENMS_DEP_PRIVATE_LIBRARIES. Xerces is now
fully encapsulated: it appears in no installed OpenMS header, so downstream
consumers (TOPP tools, GUI, pyOpenMS, third parties) neither include nor link it,
while libOpenMS.so still links Xerces internally.

The five class tests that exercise the internal Xerces InputSource / BinInputStream
adapters directly now link XercesC::XercesC explicitly.

Verified: FileInfo (previously pulled Xerces transitively via XMLHandler.h)
recompiles with no Xerces include dir on its command line; libOpenMS.so still
depends on libxerces-c.

Co-Authored-By: Claude Fable 5 <[email protected]>
Address Codex + independent review feedback:
- Replace XMLAttributes' SFINAE templated implicit constructor with an explicit
  XMLAttributes(const void*) ctor (removes the footgun of silently wrapping any
  type); the sole caller, SAX2HandlerAdapter, now passes &attrs as void*.
- Refresh the now-stale UniProtXMLHandler comment that described a local_name
  fallback removed by the native-callback migration.
- Strip trailing whitespace in XMLHandler_test.cpp.

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: d3c1bb10-5663-4ffe-8722-69d05a5ba56c

📥 Commits

Reviewing files that changed from the base of the PR and between 1b080d5 and 6f609ff.

📒 Files selected for processing (7)
  • src/openms/include/OpenMS/FORMAT/HANDLERS/XMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/XQuestResultXMLHandler.h
  • src/openms/include/OpenMS/config.h.in
  • src/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/FeatureXMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/MzDataHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/StringManager.cpp
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/openms/source/FORMAT/HANDLERS/FeatureXMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/MzDataHandler.cpp
  • src/openms/include/OpenMS/FORMAT/HANDLERS/XQuestResultXMLHandler.h
  • src/openms/source/FORMAT/HANDLERS/StringManager.cpp
  • src/openms/include/OpenMS/FORMAT/HANDLERS/XMLHandler.h

📝 Walkthrough

Walkthrough

This PR adds UTF-16 XML helper types, routes SAX parsing through an adapter, migrates XML handlers and validators to on* callbacks, and moves Xerces to private linkage.

Changes

Xerces decoupling and handler migration

Layer / File(s) Summary
String and attribute contracts
src/openms/include/OpenMS/FORMAT/HANDLERS/StringManager.{h,cpp}, src/openms/include/OpenMS/FORMAT/HANDLERS/XMLAttributes.{h,cpp}, src/openms/include/OpenMS/FORMAT/HANDLERS/sources.cmake
Adds the UTF-16 string and attribute helper APIs and registers their headers and sources.
XMLHandler base and SAX bridge
src/openms/include/OpenMS/FORMAT/HANDLERS/XMLHandler.{h,cpp}, src/openms/include/OpenMS/FORMAT/HANDLERS/SAX2HandlerAdapter.h, src/openms/source/FORMAT/XMLFile.cpp, src/openms/source/FORMAT/ImzMLFile.cpp, src/openms/source/FORMAT/HANDLERS/MzMLSpectrumDecoder.{h,cpp}
Updates the base handler API, adds the Xerces SAX adapter, wires parsing through it, and adjusts the spectrum decoder helper signature.
Format handler migration
src/openms/include/OpenMS/FORMAT/*, src/openms/include/OpenMS/FORMAT/HANDLERS/*, src/openms/source/FORMAT/*, src/openms/source/FORMAT/HANDLERS/*, src/pyOpenMS/bindings/bind_misc.cpp
Migrates format handlers and parsers to onStartElement/onEndElement/onCharacters, updates attribute access to XMLAttributes, and drops obsolete Python bindings for removed Xerces error hooks.
Validator callback migration
src/openms/include/OpenMS/FORMAT/VALIDATORS/*, src/openms/source/FORMAT/VALIDATORS/*
Moves MzMLValidator and SemanticValidator to the new handler API and replaces XMLValidator’s direct Xerces ErrorHandler inheritance with an internal adapter.
Private Xerces dependency and test wiring
src/openms/CMakeLists.txt, cmake/OpenMSConfig.cmake.in, src/openms/include/OpenMS/FORMAT/sources.cmake, src/openms/source/FORMAT/*.cpp, src/tests/class_tests/openms/CMakeLists.txt, src/tests/class_tests/openms/source/XMLHandler_test.cpp
Moves Xerces and related headers/frameworks to private linkage, adds missing Xerces includes, links affected tests explicitly, and updates XMLHandler tests to use StringManager.

Possibly related PRs

  • OpenMS/OpenMS#9649 — Shares the same XML handler callback transition from Xerces startElement/endElement/characters to the new on* API.
  • OpenMS/OpenMS#9660 — Touches PepXMLFile.cpp in the same start-element parsing path and attribute handling area.
  • OpenMS/OpenMS#9649 — Shares the same XML handler callback transition from Xerces startElement/endElement/characters to the new on* API.

Suggested reviewers: cbielow, jpfeuffer

Poem

A rabbit hopped through XML snow,
With char16_t now in tow 🐇
No more Xerces on the trail,
New on* callbacks set sail.
Soft ears up, the code runs bright,
StringManager keeps the bytes just right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the PR’s main change: moving Xerces-C++ to a private dependency of libOpenMS.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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 feature/xerces-private-link

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/openms/include/OpenMS/FORMAT/HANDLERS/XQuestResultXMLHandler.h (1)

172-177: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Stale Doxygen comment still references Xerces.

getLinkPosition_'s parameter type was migrated from xercesc::Attributes to XMLAttributes, but the doc comment at Line 174 still says @param[in] attributes XML attributes of Xerces.

📝 Proposed fix
       /**
        * `@brief` Gets the link location of a xQuest xlinkPositionString.
-       * `@param`[in] attributes XML attributes of Xerces.
+       * `@param`[in] attributes XML attributes.
        * `@param`[out] pair Pair to be populated with the xlinkposition in xQuest.
        */
       void getLinkPosition_(const XMLAttributes & attributes, std::pair<SignedSize, SignedSize> & pair);

As per path instructions, src/openms/include/OpenMS/**/*.h requires "update relevant documentation when modifying existing functionality."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openms/include/OpenMS/FORMAT/HANDLERS/XQuestResultXMLHandler.h` around
lines 172 - 177, Update the stale Doxygen for getLinkPosition_ in
XQuestResultXMLHandler so the `@param`[in] documentation no longer mentions Xerces
and instead describes the current XMLAttributes parameter accurately. Keep the
comment aligned with the current signature of getLinkPosition_(const
XMLAttributes&, std::pair<SignedSize, SignedSize>&) and refresh any related
wording in the same block if needed.

Source: Path instructions

🧹 Nitpick comments (6)
src/openms/source/FORMAT/HANDLERS/StringManager.cpp (1)

117-159: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Normalize indentation/brace style in strLength.

This function uses 4-space indentation and same-line opening braces (Lines 119, 134), unlike the 2-space, braces-on-own-line style used elsewhere in this file.

As per coding guidelines: "Use 2-space indentation for C++ code (no tabs)" and "Place opening and closing braces on their own lines".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openms/source/FORMAT/HANDLERS/StringManager.cpp` around lines 117 - 159,
The strLength function in StringManager.cpp uses inconsistent indentation and
brace placement compared with the rest of the file. Update
StringManager::strLength to follow the project’s C++ style by converting it to
2-space indentation and moving opening/closing braces onto their own lines,
matching the surrounding formatting conventions in the file.

Source: Coding guidelines

src/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cpp (1)

486-486: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Inconsistent attribute lookup: bypasses optionalAttributeAsString_ used everywhere else in this method.

This is the only attribute lookup in onStartElement that manually builds a char16_t name via sm_.convert(...).c_str() and calls XMLAttributes::value() directly, instead of the optionalAttributeAsString_/attributeAsString_ helpers used consistently for every other attribute (e.g. lines 143, 209, 337). Worth consolidating for consistency, though this mirrors the pre-existing attributes.getValue(...) pattern that was simply renamed during migration.

♻️ Proposed refactor
-      const char16_t* refs = attributes.value(sm_.convert("protein_refs").c_str());
-      if (refs != nullptr)
-      {
-        std::string accession_string = sm_.convert(refs);
-        StringUtils::trim(accession_string);
+      std::string accession_string;
+      if (optionalAttributeAsString_(accession_string, attributes, "protein_refs"))
+      {
+        StringUtils::trim(accession_string);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cpp` at line 486,
`ConsensusXMLHandler::onStartElement` has one inconsistent attribute fetch for
`protein_refs` that bypasses the `optionalAttributeAsString_` helper used
throughout the method. Replace the direct
`attributes.value(sm_.convert(...).c_str())` lookup with the same optional
string accessor pattern used for the other attributes in `onStartElement`, so
the parsing logic stays consistent and centralized.
src/openms/include/OpenMS/FORMAT/HANDLERS/SAX2HandlerAdapter.h (1)

46-46: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Type-erased XMLAttributes construction via raw void*.

XMLAttributes(static_cast<const void*>(&attrs)) discards all type information at the call site; nothing prevents a future caller from wrapping an unrelated pointer with the same constructor. Per the PR description, a follow-up commit already tightens XMLAttributes construction — flagging here for visibility since this specific file/commit still uses the loose form.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openms/include/OpenMS/FORMAT/HANDLERS/SAX2HandlerAdapter.h` at line 46,
The `SAX2HandlerAdapter::startElement` call still constructs `XMLAttributes`
from a raw `void*`, which keeps the API type-erased at the call site. Update
this usage to the stricter `XMLAttributes` construction introduced elsewhere in
the PR so the adapter passes a typed attribute object rather than
`static_cast<const void*>(&attrs)`. Keep the change localized to the
`handler_.onStartElement(...)` invocation in `SAX2HandlerAdapter`.
src/openms/source/FORMAT/XTandemXMLFile.cpp (1)

267-270: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Repeated per-element string conversion for the "z" attribute lookup.

sm_.convert("z") re-transcodes the same literal ASCII attribute name to UTF-16 on every <group type="model"> element (once per protein group in the XTandem output, potentially large). Elsewhere in this same function, optional attribute lookups use the higher-level optionalAttributeAsUInt_/optionalAttributeAsDouble_ helpers that presumably already handle this transcoding internally and more efficiently (e.g. line 150 optionalAttributeAsUInt_(count, attributes, ion_count.c_str())).

If an optionalAttributeAsInt_-style helper exists for this case, consider using it instead of the manual index()/valueByIndex() pattern to avoid the repeated conversion and improve consistency with the rest of the handler.

Please confirm whether Internal::XMLHandler (or its helpers) exposes an optionalAttributeAsInt_(int&, const XMLAttributes&, const char*) overload analogous to optionalAttributeAsUInt_, and whether StringManager::convert() caches/optimizes repeated ASCII→UTF-16 conversions of short literals.

♻️ Possible simplification (pending helper availability)
-        Int index = attributes.index(sm_.convert("z").c_str());
-        if (index >= 0)
-        {
-          current_charge_ = StringUtils::toInt32(std::string(sm_.convert(attributes.valueByIndex(index))));
-        }
+        optionalAttributeAsInt_(current_charge_, attributes, "z");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openms/source/FORMAT/XTandemXMLFile.cpp` around lines 267 - 270, The
manual `attributes.index(sm_.convert("z").c_str())` lookup in
`XTandemXMLFile::load` repeats the same ASCII-to-UTF-16 conversion for every
model group; replace this pattern with an `optionalAttributeAsInt_`-style helper
if `XMLHandler` exposes one, matching the existing
`optionalAttributeAsUInt_`/`optionalAttributeAsDouble_` usage in this function.
If no such overload exists, add or reuse a helper in `Internal::XMLHandler` to
read the `z` attribute directly so the conversion happens once per lookup path
and the code stays consistent with the other optional attribute reads.
src/openms/source/FORMAT/HANDLERS/FeatureXMLHandler.cpp (1)

592-627: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Hoist the protein_refs attribute name to a static UTF-16 literal.

sm_.convert("protein_refs").c_str() (Line 602) re-encodes the same string on every PeptideHit element, unlike every other attribute/tag lookup in this function which uses a pre-hoisted static const char16_t* (e.g. s_name, s_value, s_id). Consider also using optionalAttributeAsString_ here to match the style used for the sibling aa_before/aa_after/start/end attributes just below, avoiding the manual null check on the raw XMLAttributes::value() pointer.

♻️ Proposed fix
     // TODO The next line should be removed in OpenMS 1.7 or so!
     static const char16_t* s_unique_id = u"unique_id";
+    static const char16_t* s_protein_refs = u"protein_refs";
       //parse optional protein ids to determine accessions
-      const char16_t* refs = attributes.value(sm_.convert("protein_refs").c_str());
+      const char16_t* refs = attributes.value(s_protein_refs);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openms/source/FORMAT/HANDLERS/FeatureXMLHandler.cpp` around lines 592 -
627, The PeptideHit parsing block repeatedly re-encodes the protein_refs
attribute name and manually checks the raw attribute pointer, unlike the other
lookups in this handler. Hoist the protein_refs key to a static UTF-16 literal
near the existing tag/attribute symbols in FeatureXMLHandler::handleStartElement
(or the equivalent PeptideHit parsing scope), then use that constant for the
lookup and switch to optionalAttributeAsString_ to match the nearby
aa_before/aa_after/start/end handling while preserving the current accession
parsing and fatalError behavior in the PeptideHit branch.
src/openms/source/FORMAT/HANDLERS/MzDataHandler.cpp (1)

240-247: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Hoist completionTime into a static attribute literal. This block converts the same name twice for every <software> element; match the existing s_* pattern used for the other attributes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openms/source/FORMAT/HANDLERS/MzDataHandler.cpp` around lines 240 - 247,
The <software> parsing block in MzDataHandler::load uses repeated conversion of
"completionTime" on every element, unlike the existing static attribute pattern.
Hoist that attribute name into a static literal alongside the other s_*
attribute symbols and reuse it for both the index lookup and value access so the
code avoids redundant conversions and matches the surrounding style.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/openms/include/OpenMS/FORMAT/HANDLERS/XMLHandler.h`:
- Around line 231-234: The helper equal_ currently constructs
std::u16string_view directly from its inputs, which will fail on null XMLCh
pointers. Update equal_(const char16_t * a, const char16_t * b) in XMLHandler to
check for null arguments before creating the views, matching the null-safe
behavior of XMLString::compareString. If either pointer is missing, handle that
case explicitly and only compare views when both values are present.

---

Outside diff comments:
In `@src/openms/include/OpenMS/FORMAT/HANDLERS/XQuestResultXMLHandler.h`:
- Around line 172-177: Update the stale Doxygen for getLinkPosition_ in
XQuestResultXMLHandler so the `@param`[in] documentation no longer mentions Xerces
and instead describes the current XMLAttributes parameter accurately. Keep the
comment aligned with the current signature of getLinkPosition_(const
XMLAttributes&, std::pair<SignedSize, SignedSize>&) and refresh any related
wording in the same block if needed.

---

Nitpick comments:
In `@src/openms/include/OpenMS/FORMAT/HANDLERS/SAX2HandlerAdapter.h`:
- Line 46: The `SAX2HandlerAdapter::startElement` call still constructs
`XMLAttributes` from a raw `void*`, which keeps the API type-erased at the call
site. Update this usage to the stricter `XMLAttributes` construction introduced
elsewhere in the PR so the adapter passes a typed attribute object rather than
`static_cast<const void*>(&attrs)`. Keep the change localized to the
`handler_.onStartElement(...)` invocation in `SAX2HandlerAdapter`.

In `@src/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cpp`:
- Line 486: `ConsensusXMLHandler::onStartElement` has one inconsistent attribute
fetch for `protein_refs` that bypasses the `optionalAttributeAsString_` helper
used throughout the method. Replace the direct
`attributes.value(sm_.convert(...).c_str())` lookup with the same optional
string accessor pattern used for the other attributes in `onStartElement`, so
the parsing logic stays consistent and centralized.

In `@src/openms/source/FORMAT/HANDLERS/FeatureXMLHandler.cpp`:
- Around line 592-627: The PeptideHit parsing block repeatedly re-encodes the
protein_refs attribute name and manually checks the raw attribute pointer,
unlike the other lookups in this handler. Hoist the protein_refs key to a static
UTF-16 literal near the existing tag/attribute symbols in
FeatureXMLHandler::handleStartElement (or the equivalent PeptideHit parsing
scope), then use that constant for the lookup and switch to
optionalAttributeAsString_ to match the nearby aa_before/aa_after/start/end
handling while preserving the current accession parsing and fatalError behavior
in the PeptideHit branch.

In `@src/openms/source/FORMAT/HANDLERS/MzDataHandler.cpp`:
- Around line 240-247: The <software> parsing block in MzDataHandler::load uses
repeated conversion of "completionTime" on every element, unlike the existing
static attribute pattern. Hoist that attribute name into a static literal
alongside the other s_* attribute symbols and reuse it for both the index lookup
and value access so the code avoids redundant conversions and matches the
surrounding style.

In `@src/openms/source/FORMAT/HANDLERS/StringManager.cpp`:
- Around line 117-159: The strLength function in StringManager.cpp uses
inconsistent indentation and brace placement compared with the rest of the file.
Update StringManager::strLength to follow the project’s C++ style by converting
it to 2-space indentation and moving opening/closing braces onto their own
lines, matching the surrounding formatting conventions in the file.

In `@src/openms/source/FORMAT/XTandemXMLFile.cpp`:
- Around line 267-270: The manual `attributes.index(sm_.convert("z").c_str())`
lookup in `XTandemXMLFile::load` repeats the same ASCII-to-UTF-16 conversion for
every model group; replace this pattern with an `optionalAttributeAsInt_`-style
helper if `XMLHandler` exposes one, matching the existing
`optionalAttributeAsUInt_`/`optionalAttributeAsDouble_` usage in this function.
If no such overload exists, add or reuse a helper in `Internal::XMLHandler` to
read the `z` attribute directly so the conversion happens once per lookup path
and the code stays consistent with the other optional attribute reads.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 04b0747e-3626-43e7-8672-81e93f8ea526

📥 Commits

Reviewing files that changed from the base of the PR and between b14c3ba and d95c6aa.

📒 Files selected for processing (83)
  • src/openms/CMakeLists.txt
  • src/openms/include/OpenMS/FORMAT/CVMappingFile.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/ConsensusXMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/FeatureXMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/ImzMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/MascotXMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/MzDataHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/MzIdentMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/MzMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/MzMLSpectrumDecoder.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/MzXMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/PTMXMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/ParamXMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/SAX2HandlerAdapter.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/StringManager.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/ToolDescriptionHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/TraMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/UniProtXMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/UnimodXMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/XMLAttributes.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/XMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/XQuestResultXMLHandler.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/sources.cmake
  • src/openms/include/OpenMS/FORMAT/IdXMLFile.h
  • src/openms/include/OpenMS/FORMAT/OMSSAXMLFile.h
  • src/openms/include/OpenMS/FORMAT/PepXMLFile.h
  • src/openms/include/OpenMS/FORMAT/PepXMLFileMascot.h
  • src/openms/include/OpenMS/FORMAT/ProtXMLFile.h
  • src/openms/include/OpenMS/FORMAT/QcMLFile.h
  • src/openms/include/OpenMS/FORMAT/TransformationXMLFile.h
  • src/openms/include/OpenMS/FORMAT/VALIDATORS/MzMLValidator.h
  • src/openms/include/OpenMS/FORMAT/VALIDATORS/SemanticValidator.h
  • src/openms/include/OpenMS/FORMAT/VALIDATORS/XMLValidator.h
  • src/openms/include/OpenMS/FORMAT/XTandemXMLFile.h
  • src/openms/include/OpenMS/FORMAT/sources.cmake
  • src/openms/source/FORMAT/Bzip2InputStream.cpp
  • src/openms/source/FORMAT/CVMappingFile.cpp
  • src/openms/source/FORMAT/CompressedInputSource.cpp
  • src/openms/source/FORMAT/GzipInputStream.cpp
  • src/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/FeatureXMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/ImzMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/IndexedMzMLDecoder.cpp
  • src/openms/source/FORMAT/HANDLERS/MascotXMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/MzDataHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/MzIdentMLDOMHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/MzMLSpectrumDecoder.cpp
  • src/openms/source/FORMAT/HANDLERS/MzXMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/PTMXMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/ParamXMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/StringManager.cpp
  • src/openms/source/FORMAT/HANDLERS/ToolDescriptionHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/TraMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/UniProtXMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/UnimodXMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/XMLAttributes.cpp
  • src/openms/source/FORMAT/HANDLERS/XMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/XQuestResultXMLHandler.cpp
  • src/openms/source/FORMAT/HANDLERS/sources.cmake
  • src/openms/source/FORMAT/IdXMLFile.cpp
  • src/openms/source/FORMAT/ImzMLFile.cpp
  • src/openms/source/FORMAT/MascotXMLFile.cpp
  • src/openms/source/FORMAT/OMSSAXMLFile.cpp
  • src/openms/source/FORMAT/PepXMLFile.cpp
  • src/openms/source/FORMAT/PepXMLFileMascot.cpp
  • src/openms/source/FORMAT/ProtXMLFile.cpp
  • src/openms/source/FORMAT/QcMLFile.cpp
  • src/openms/source/FORMAT/TransformationXMLFile.cpp
  • src/openms/source/FORMAT/UnimodXMLFile.cpp
  • src/openms/source/FORMAT/VALIDATORS/MzDataValidator.cpp
  • src/openms/source/FORMAT/VALIDATORS/MzIdentMLValidator.cpp
  • src/openms/source/FORMAT/VALIDATORS/MzMLValidator.cpp
  • src/openms/source/FORMAT/VALIDATORS/SemanticValidator.cpp
  • src/openms/source/FORMAT/VALIDATORS/TraMLValidator.cpp
  • src/openms/source/FORMAT/VALIDATORS/XMLValidator.cpp
  • src/openms/source/FORMAT/XMLFile.cpp
  • src/openms/source/FORMAT/XTandemXMLFile.cpp
  • src/openms/source/FORMAT/ZipInputStream.cpp
  • src/pyOpenMS/bindings/bind_misc.cpp
  • src/tests/class_tests/openms/CMakeLists.txt
  • src/tests/class_tests/openms/source/XMLHandler_test.cpp
💤 Files with no reviewable changes (6)
  • src/openms/source/FORMAT/VALIDATORS/MzIdentMLValidator.cpp
  • src/openms/source/FORMAT/UnimodXMLFile.cpp
  • src/openms/source/FORMAT/VALIDATORS/MzDataValidator.cpp
  • src/openms/source/FORMAT/VALIDATORS/TraMLValidator.cpp
  • src/openms/source/FORMAT/MascotXMLFile.cpp
  • src/pyOpenMS/bindings/bind_misc.cpp

timosachsenberg and others added 4 commits July 8, 2026 07:38
- XMLAttributes.h: use @c instead of @ref for XMLAttributes.cpp; a .cpp
  filename is not a valid Doxygen \ref target, which failed
  Doxygen_Warning_test on Linux/macOS/clang/arm.
- StringManager.cpp: include <cmath> before SIMDe.h; MSVC needs
  std::isnormal/isnan/... in scope for simde-math.h. The new lean
  StringManager.h no longer pulls <cmath> transitively, breaking the
  Windows build and Windows wheel.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…aders

Making XercesC PRIVATE removed the accidental propagation of Boost's
include directory to consumers. The installed public header config.h
includes <boost/current_function.hpp> (via Macros.h), but Boost was a
PRIVATE dependency, so its include dir only ever reached consumers by
riding on XercesC's (formerly PUBLIC) interface include dir. On the macOS
wheel all deps share one vcpkg prefix, so once Xerces went private
pyOpenMS could no longer find boost/current_function.hpp; Linux was
unaffected because Boost lives in a standard system include path there.

Fix the latent bug directly: make the header-only Boost::boost target a
PUBLIC dependency so its include dir is exported. Only include dirs
propagate (no extra linking); the compiled Boost components
(date_time/iostreams/regex) stay PRIVATE.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…onfig

Commit 37dbf2b made the header-only Boost::boost target a PUBLIC
dependency so the installed config.h can pull in <boost/current_function.hpp>.
That correctly exported Boost::boost into OpenMS's INTERFACE_LINK_LIBRARIES,
but OpenMSConfig.cmake never ran a find_dependency for Boost, so the imported
target was undefined when a consumer configured against the install tree. The
pyOpenMS wheel builds (which use NO_DEPENDENCIES=ON) failed at generate time:

  OpenMSTargets.cmake: The link interface of target "OpenMS" contains:
    Boost::boost
  but the target was not found.

Add find_dependency(Boost 1.81.0) alongside the existing CURL/XercesC lookups
so the header-only Boost::boost target exists before the targets file is
included. Only the header-only target is resolved here; the compiled Boost
components (date_time/iostreams/regex) remain PRIVATE and are not needed by
consumers.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
- XMLHandler::equal_: guard null char16_t* pointers before constructing
  std::u16string_view (u16string_view(nullptr) is UB). Restores the null
  tolerance of the previous XMLString::compareString (both null => equal,
  one null => unequal). No current caller passes null (qname is always
  non-null from Xerces SAX2, the compared literals are constexpr arrays),
  so this is defensive parity, not a live-bug fix.
- Consensus/FeatureXMLHandler: use optionalAttributeAsString_ for the
  protein_refs lookup instead of a manual value()+convert()+null-check,
  matching the surrounding attribute accessors (behaviour-identical).
- MzDataHandler: fetch completionTime via optionalAttributeAsString_,
  dropping the redundant index() probe and the double sm_.convert of the
  attribute name.
- XQuestResultXMLHandler: drop the stale "of Xerces" wording in the
  getLinkPosition_ Doxygen now that it takes XMLAttributes.
- StringManager::strLength: normalise to the file's 2-space / own-line
  brace style.

Skipped (with reason):
- SAX2HandlerAdapter void* XMLAttributes ctor: the void* handle is the
  intentional Xerces-free bridge; XMLAttributes exposes no typed ctor.
- XTandemXMLFile "z" via optionalAttributeAsInt_: would swap
  StringUtils::toInt32 for XMLString::parseInt, a parser behaviour change.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

This is also a preparation for the splitting of an OpenMSIO library

find_dependency(CURL)
find_dependency(XercesC)
# Boost::boost (header-only) is part of OpenMS's PUBLIC link interface because
# the installed public header config.h includes <boost/current_function.hpp>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah interesting, I always wondered why!
Could be another cleanup here!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

do you have any idea what a proper cleanup would entail? finding out how it is used and get rid of it?

@jpfeuffer jpfeuffer Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The comment tells you how it is used. Current_function is used for the logging. For a compiler independent replacement of __PRETTY_FUNCTION__

We could probably easily handroll something ourselves if that is all that keeps us from also having boost private.

https://stackoverflow.com/questions/56283284/replicating-the-behavior-of-pretty-function-in-c

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it its (of course) again implementation dependent :)
I will create a custom one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Did the hand-roll in 6f609ff: OPENMS_PRETTY_FUNCTION is now defined directly via __PRETTY_FUNCTION__ (GCC/Clang) / __FUNCSIG__ (MSVC) / __func__ (fallback), and #include <boost/current_function.hpp> is gone from config.h. That's exactly what BOOST_CURRENT_FUNCTION expands to on every compiler we support, so the function-name strings in exceptions/logs are byte-identical. I skipped std::source_location::current().function_name() on purpose — its output is implementation-defined and on GCC/Clang is less detailed than __PRETTY_FUNCTION__, so it would churn exception-message strings (and any references that embed them) for no functional gain.

One caveat though: this on its own does not let us make Boost private. Auditing all installed headers, ~35 public headers still include header-only Boost — MetaInfo.h (boost/container/flat_map), all the METADATA/ID/* (boost/multi_index), MathFunctions.h (boost/math, boost/random), IDBoostGraph.h (boost/graph), plus dynamic_bitset, regex, heap, variant, … Those genuinely need Boost's include dir on the consumer's path, so Boost::boost has to stay a PUBLIC dependency and the find_dependency(Boost) here stays. current_function was just one of many leaks, so this is a nice decoupling of the near-universal config.h rather than the thing that unlocks private Boost.

@jpfeuffer

Copy link
Copy Markdown
Contributor

Makes a lot of sense. I like it. I assume the small indirection has miniscule impact on runtime?

OPENMS_PRETTY_FUNCTION was defined as BOOST_CURRENT_FUNCTION, which forced
config.h -- a header included by almost every OpenMS translation unit -- to
pull in <boost/current_function.hpp>. Define it directly via the compiler
builtins instead: __PRETTY_FUNCTION__ (GCC/Clang), __FUNCSIG__ (MSVC),
__func__ as the standard fallback. These are exactly what BOOST_CURRENT_FUNCTION
expands to on every compiler OpenMS supports, so the produced function-name
strings (which appear in exception messages and logs) are unchanged.

This removes one Boost include from the public config header. Note it does NOT
make Boost fully private: ~35 other installed public headers still include
header-only Boost (multi_index, dynamic_bitset, container/flat_map, math,
random, graph, regex, ...), so Boost::boost remains a PUBLIC dependency and
find_dependency(Boost) stays in OpenMSConfig.cmake.

Verified with a full libOpenMS recompile (config.h touches every TU): builds
clean, no translation unit was relying on the transitive Boost include.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@timosachsenberg

timosachsenberg commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor Author

I assume the small indirection has miniscule impact on runtime?

Confirmed by tracing the hot path — it's effectively free, and importantly there are no new copies on the data-heavy path.

Peak/binary data (the megabyte-scale path) — zero added copies. In MzMLHandler::onCharacters the base64 payload goes straight into the target buffer:

sm_.appendASCII(chars, length, bin_data_.back().base64); // SIMD UTF-16→ASCII, direct append

chars is a reinterpret_cast<const char16_t*> of Xerces' own buffer — a zero-copy view (XMLCh is char16_t, enforced by static_assert, so the cast compiles to nothing). No staging string. This is byte-for-byte the same work as before the PR; appendASCII predates it. Attribute values are likewise returned as the pointer Xerces already owns; a std::string is only materialized when a handler explicitly asks for one, exactly as before.

What the indirection actually adds — all O(nanoseconds):

  1. +1 virtual call per SAX event: Xerces → SAX2HandlerAdapter → onStartElement/onEndElement/onCharacters instead of Xerces → handler.
  2. +1 non-inlined wrapper call per attribute read (XMLAttributes::value() lives in its own TU), around the same attrs->getValue() virtual we always called.
  3. A trivial XMLAttributes per startElement — wraps one const void*, passed by const-ref, no allocation.

All dwarfed by the XML tokenization + base64 decode + string building that dominate parse time.

One costly primitive, kept off the hot path: XMLAttributes::value(const char*) does a transcode (malloc) + release per call. MzMLHandler's hot loop never hits it — it uses the char16_t* overloads with precomputed constexpr XMLCh[] attribute names, so zero transcoding per element. The narrow-char* overload only runs in cold paths (e.g. protein_refs/completionTime, once per PeptideHit / per file).

Pre-existing per-element cost (not from this PR): open_tags_.push_back(sm_.convert(qname)) in onStartElement transcodes and stores the tag name per element. Looking closer, this is cheaper than it first appears: convert() fills the string via resize() + SIMD, so for tag names ≤15 chars it stays in std::string's SSO buffer — no heap allocation. All the frequent mzML tags (spectrum, binary, cvParam, scan, precursor, binaryDataArray) are short, so on the hot path it's just a cheap transcode + SSO move; malloc/free only happens for the rare long structural tags (instrumentConfiguration, …) that occur ~once per file. The copy itself is unavoidable — Xerces' buffer is only valid during the callback, but the tag must survive start→children→end, so the stack must own it.

It could be tightened (a reuse-capacity tag stack behind pushTag_()/popTag_() helpers would remove the malloc/free churn for the long-tag case with no behavior change), but it touches all ~10 handlers that access open_tags_ directly and would be sub-percent for real files (mzML load is dominated by base64 decode + peak-vector building). So better as its own small follow-up than bundled into this Xerces diff.

Happy to run an A/B wall-clock benchmark (develop vs this branch, large mzML load) if we want hard numbers — I'd expect the delta to be in the noise (<1%).

@timosachsenberg
timosachsenberg merged commit f4c0907 into develop Jul 8, 2026
41 checks passed
@timosachsenberg
timosachsenberg deleted the feature/xerces-private-link branch July 8, 2026 14:07
timosachsenberg added a commit that referenced this pull request Jul 10, 2026
Adds entries for PRs merged in the last couple of days that were missing
changelog coverage: the TOPPView precursor-highlighting feature (#9715),
the Xerces-C++ PRIVATE-linkage/XMLHandler API change (#9712, which also
supersedes a stale note left by the LibSVM PRIVATE-linkage entry), the
FragmentMassError variance fix (#9618), the PepXMLFile duplicate Comet
metavalue fix (#9089), and the clang/OpenMP and TextExporter USI
documentation additions (#9162, #9173).

Co-authored-by: Claude <[email protected]>
timosachsenberg added a commit that referenced this pull request Jul 14, 2026
…eaders) (#9737)

* Make SQLite a fully private dependency (no SQLite type in installed headers)

SQLite (via vendored SQLiteCpp) was already PRIVATE-linked, but SQLite
types still leaked into installed public headers. This removes every
sqlite3 / sqlite3_stmt / SQLite:: reference from the installed header set,
so downstream consumers can build and link against libOpenMS without any
SQLite headers on their include path. Mirrors the Xerces work in #9712.

C API (SqliteConnector + Internal::SqliteHelper):
- Pimpl the native handle: sqlite3* db_ -> void* db_, exposed via a
  doc-hidden void* nativeHandle().
- Move getDB(), the sqlite3*-based static helpers, and the whole
  Internal::SqliteHelper namespace into a new non-installed
  include/OpenMS/FORMAT/SqliteConnector_impl.h (registered on
  OpenMS_private_headers). Add SqliteHelper::getNativeHandle(SqliteConnector&)
  and a prepareStatement(SqliteConnector&, ...) convenience overload.

SQLiteCpp C++ API (SQLite::Database/Statement):
- OMSFileStore.h / OMSFileLoad.h are Internal:: helpers; de-install them
  (move to OpenMS_private_headers). Remove the unused OMSFileLoad.h include
  from FeatureFinderMetaboIdent.cpp (its only external includer).

pyOpenMS-wrapped classes (must stay installed):
- MzMLSqliteHandler.h / TransitionPQPFile.h exposed sqlite3* only in private
  methods -> change the parameter to void* and cast inside the .cpp.
- MzMLSqliteSwathHandler.h: drop a stale, unused `struct sqlite3;`.

Internal call sites now obtain the raw handle via
SqliteHelper::getNativeHandle() and include the private impl header.
SqliteConnector_test now covers the public, SQLite-free API only (a
consumer test has no <sqlite3.h> on its include path, by design).

Verified: libOpenMS + pyOpenMS build clean; 14 SQLite-related class tests
pass (SqliteConnector, OSWFile(+Inference), OpenSwath{Export,OSWWriter,
PercolatorScoring}, TransitionPQPFile, BrukerTimsImagingFile,
MzMLSqlite{Handler,SwathHandler}, OMSFile, SqMassFile, SpectrumAccessSqMass,
CachedMzML).

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

* Reduce void* usage in the SQLite-private headers

Follow-up to the previous commit: replace the void* handle parameters that
type-hiding introduced with properly typed references, so the installed
headers name neither a SQLite type nor a bare void* (down from 9 void* to 1).

- MzMLSqliteHandler / TransitionPQPFile: the private helpers now take a
  SqliteConnector& (a SQLite-type-free type) instead of void*; the native
  sqlite3* is resolved inside the .cpp via SqliteConnector_impl.h. Callers
  pass the connection object directly (readExperiment no longer needs a raw
  db local).
- SqliteConnector: drop the public void* nativeHandle() accessor. The one
  remaining void* is the private db_ member; it is reachable only from the
  non-installed SqliteConnector_impl.h through a new friend,
  Internal::SqliteConnectorFriend. (A unique_ptr pimpl would remove even this
  but would make SqliteConnector move-only; it is kept copyable because
  OSWFile embeds it by value and declares a defaulted copy ctor.)
- SqliteConnector_test: verify a fresh connection is usable functionally
  (the native handle is now fully private).

Verified: libOpenMS builds clean; 9 SQLite-related class tests pass
(SqliteConnector, OSWFile(+Inference), OpenSwath{Export,OSWWriter},
TransitionPQPFile, MzMLSqlite{Handler,SwathHandler}, SqMassFile).

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[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.

2 participants