Skip to content

[FEATURE] Remote XML loading (S3, HTTP/FTP) — experimental - #9262

Merged
jpfeuffer merged 16 commits into
developfrom
copilot/redo-pr-8671-with-aws-s3-support
Oct 25, 2026
Merged

jpfeuffer merged 16 commits into
developfrom
copilot/redo-pr-8671-with-aws-s3-support

Conversation

Copilot AI commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

Adds experimental support for loading XML-based formats (mzML, idXML, etc.) directly from remote URLs in MzMLFile and all Xerces-based XML readers.

Changes Made

  • Remote HTTP/FTP loading: MzMLFile and all Xerces-based XML readers can now accept HTTP/FTP URLs (e.g. https://example.org/data.mzML) directly, delegating URL resolution to the Xerces-C++ built-in network transport — no temporary download step required.
  • AWS S3 loading: S3 (s3://) URL support is implemented but not covered by the automated test suite.
  • Marked as experimental: Both HTTP/FTP and S3 remote loading are declared experimental and unsupported; network availability, authentication, and redirect handling depend entirely on the Xerces network layer.
  • CHANGELOG: Added entry under OpenMS 3.6.0 General section documenting the feature as experimental and noting that S3 is not yet in the test suite.
  • Tests: HTTP and S3 test sections in MzMLFile_test.cpp are both kept as NOT_TESTABLE (no live network calls in CI); commented-out examples remain for manual verification.

Copilot AI and others added 2 commits May 3, 2026 22:21
Support loading XML files (mzML, etc.) from remote locations:
- HTTP/HTTPS/FTP via Xerces URLInputSource
- S3 via AWS SDK (optional, WITH_S3=ON)

Features:
- S3 streaming with auto-decompression (gzip, bzip2)
- Compression detection via magic bytes or Content-Encoding header
- IndexedMzML support for S3 via range requests
- Network URI support in DocumentIdentifier

Based on PR #8671 by @jpfeuffer/@timosachsenberg with review fixes:
- Fixed PRIVATE keyword in cmake list(APPEND)
- Added OPENMS_DLLAPI to all public classes
- Added Doxygen documentation throughout
- Added override keywords consistently
- Fixed infinite loops (break on stream/fetch errors)
- Fixed error handling in stream constructors
- Uses larger (4096) decompression buffers

Agent-Logs-Url: https://github.com/OpenMS/OpenMS/sessions/9cd62545-8f51-4bfb-9d37-0c4e65f8cab9

Co-authored-by: jpfeuffer <[email protected]>
{
MzMLFile file;
PeakMap exp;
file.load("https://raw.githubusercontent.com/OpenMS/OpenMS/develop/src/tests/class_tests/openms/data/MzMLFile_2_minimal.mzML", exp);

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.

In industry it is considered code smell to use the network from a test. In this case the test depends on GitHub being up and the resource available, which, given GitHub's recent track record, isn't always going to be the case.

The preferred solution is to mock out the network code and simulate both a successful response and alternate responses like 301 and 404.

@jpfeuffer jpfeuffer May 4, 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.

Yes I agree. Although I am not sure if a full http and s3 mocking library is something we really want for such a niche feature. I would rather vote for no regular tests at all then.

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.

And label this feature as experimental/use at your own risk.

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.

@pjones @timosachsenberg What do you think? s3 tests will require a full external server running in a docker container for tests. Or a significant mocking library which does not exist in C++.
As mentioned I would be fine if this is just a "hidden" feature.

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.

I think it is fine if we mark it as experimental/unsupported feature...

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.

Reverted the HTTP test back to NOT_TESTABLE in 44d65c9 — the live network call is gone and only the commented-out example remains, consistent with the S3 section.

Comment thread cmake/cmake_findExternalLibs.cmake Resolved
@jpfeuffer
jpfeuffer marked this pull request as ready for review May 13, 2026 13:35
@jpfeuffer

Copy link
Copy Markdown
Contributor

@copilot Add this to the changelog and document it. Make sure to declare it as an experimental feature and that s3 support is not yet included in the test suite

Copilot AI commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Add this to the changelog and document it. Make sure to declare it as an experimental feature and that s3 support is not yet included in the test suite

Done in 44d65c9 + 587aff4: added a CHANGELOG entry under the 3.6.0 General section marking remote XML loading (HTTP/FTP and S3) as experimental, noting that S3 is not covered by the automated test suite. The HTTP test was also reverted to NOT_TESTABLE per the thread discussion.

Copilot AI changed the title [FEATURE] Remote XML loading (S3, HTTP/FTP) [FEATURE] Remote XML loading (S3, HTTP/FTP) — experimental May 13, 2026
Copilot AI requested a review from jpfeuffer May 13, 2026 13:41
@jpfeuffer

Copy link
Copy Markdown
Contributor

@copilot we will need a vcpkg build with curl to support https. The default vcpkg port for xerces-c is trash as usual and uses noncurl accessors.

Copilot AI commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

@copilot we will need a vcpkg build with curl to support https. The default vcpkg port for xerces-c is trash as usual and uses noncurl accessors.

Implemented in 29ad772 and f93670a: a Xerces vcpkg overlay requires the curl accessor with TLS/FTP support, adds a portable wait API for Windows, and exports curl dependencies for static CMake/pkg-config consumers. Updated the experimental feature documentation.

Dependency plans and patch checks passed; curl built with TLS/FTP enabled. Xerces compilation/runtime tests remain unverified because archive.apache.org does not resolve in this sandbox.

@jpfeuffer

Copy link
Copy Markdown
Contributor

@copilot windows CI fails with undeclared curl symbols

Copilot AI commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot windows CI fails with undeclared curl symbols

Fixed in 29017bb. The Windows errors were LNK2019 unresolved curl symbols: CMake’s FindXercesC module discarded static Xerces’s transitive curl dependency. The vcpkg wrapper now loads XercesCConfig explicitly, preserving that dependency; the overlay port-version is bumped.

Reproduced the missing symbols locally with the old wrapper. With the fix, the static consumer links and passes in all four find-package modes; five upstream offline Xerces tests also passed. Native Windows confirmation still awaits CI.

@jpfeuffer

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved in merge commit 28833f7 by merging current develop. Preserved both changelog entries and develop’s updated ProSE test comments; remote-loading implementation and Xerces overlay are unchanged. Verified two merge parents, a clean tree, and no remaining conflicts. GitHub no longer reports the PR as conflicting.

Copilot AI requested a review from jpfeuffer October 19, 2026 13:18
@jpfeuffer
jpfeuffer merged commit f72ff32 into develop Oct 25, 2026
32 checks passed
@jpfeuffer
jpfeuffer deleted the copilot/redo-pr-8671-with-aws-s3-support branch October 25, 2026 21:10
timosachsenberg pushed a commit that referenced this pull request Oct 25, 2026
develop brought remote XML loading (#9262): HTTP/HTTPS/FTP through Xerces'
URLInputSource, and S3 through S3InputSource, a Xerces InputSource over
Arrow's S3 filesystem.

- S3InputSource now returns an OpenMS InputStream. XMLFile reads it through
  the read-ahead thread, like compressed local files.
- Its gzip/bzip2 decompression moves to DecompressingInputStream, for any
  stream. It reads concatenated members (pigz, pbzip2) and reports truncated
  or corrupt data, instead of ending the document early. S3 read errors
  throw instead of returning 0 bytes.
- IndexedMzMLDecoder keeps develop's S3 range reads on top of this branch's
  file reading.
- HTTP/HTTPS/FTP URLs fail with a clear error until the libxml2 reader has
  its own transport (follow-up PR). The xerces-c overlay port, which built
  Xerces with curl, is removed.
- XMLHandler keeps the File::exists() check and adds develop's guard for
  remote URIs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h
timosachsenberg pushed a commit that referenced this pull request Oct 26, 2026
…uffer

- MzMLHandler reported the load rate from File::fileSize(), which is -1 for
  remote URIs (develop's #9262), so S3 loads logged an absurd rate. It now
  reports none when the size is unknown.
- DecompressingInputStream refilled only the end of its input buffer after
  the buffer was consumed; it now starts at the front again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h
poshul pushed a commit that referenced this pull request Oct 29, 2026
* Replace Xerces with libxml2 on OpenMS 3.7 develop

* Document develop integration validation and remaining CI blocker

* [TEST] Adapt imzML parse-error tests to the current loadSpectraIndex signature

develop added the MSExperiment output to ImzMLFile::loadSpectraIndex; the
two malformed-input sections from the libxml2 branch still used the old
three-argument form and no longer compiled after the merge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [PERF] libxml2 adapter: decode Latin-1 in bulk, pass UTF-8 names and attributes through

Reading mzML spent much of its time converting text rather than parsing:

- OpenMS writes ISO-8859-1 declarations, which libxml2 decodes byte by
  byte. The adapter now detects such a declaration (or an enforced
  Latin-1 encoding, using libxml2's own name table), forces UTF-8, passes
  ASCII chunks through unchanged and converts the rest word-wise itself.
- Attributes are kept as UTF-8 slices of the parser buffer in a reusable
  XMLAttributes::NativeStore. UTF-16 values are produced only on access;
  the XMLHandler attribute helpers copy the UTF-8 value directly.
  Element names and character data reuse conversion buffers, so a parse
  no longer allocates per element or attribute.
- New opt-in hooks tryOnStartElementUTF8/tryOnEndElementUTF8 (same contract
  as tryOnCharactersUTF8) let MzMLHandler take UTF-8 tag names without the
  UTF-8 -> UTF-16 -> UTF-8 round trip.
- MzMLHandler drops character data outside <binary> before scanning it,
  scans <binary> payloads branch-free, and compares tags and accessions
  against string_view literals instead of strlen-ing C strings.

On a 196 MB DDA-like mzML (Linux, 4 cores) full loads take 0.91 s instead
of 1.56 s and metadata-only loads 0.84 s instead of 1.39 s; zlib-compressed
arrays 1.13 s instead of 1.66 s. Decoded data are identical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [PERF] XMLFile: decompress gzip/bzip2/zip input on a read-ahead thread

Inflating outer-gzip mzML costs about as much as parsing it, and both ran
serially. A helper thread now fills a small queue of 256 KiB blocks while
the parser consumes earlier ones; stream exceptions are rethrown to the
caller and an early stop (EndParsingSoftly) shuts the helper down.

While it runs, the parsing thread starts OpenMP regions with one thread
fewer: idle OpenMP workers spin between the handlers' decoding regions and,
on all cores, starve the helper (no gain at all otherwise).

196 MB mzML.gz: full load 0.94 s instead of 1.76 s, metadata-only 0.96 s
instead of 1.64 s, i.e. as fast as the uncompressed file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [FIX] vcpkg: require libxml2 2.13.5, a version the registry knows

"version>=" must name an entry of the vcpkg version database. There is no
2.13.0 port, so every vcpkg-based CI job (all build-and-test jobs and the
Linux/Windows wheels) stopped in "vcpkg install". 2.13.5 is the oldest
available release meeting the 2.13 minimum; the baseline still selects
the newer libxml2 it pins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [FIX] XMLFile: accept large attributes like Xerces, clean libxml2 diagnostics

Review follow-ups for the libxml2 SAX reader:

- Set XML_PARSE_HUGE with an explicit entity amplification budget, as the
  mzIdentML and spectrum DOM readers already do. Without it libxml2 rejects
  attribute values over 10 MB and nesting deeper than 256 levels, which
  Xerces read (e.g. large UserParam values in idXML/featureXML).
- Strip libxml2's trailing line break from parse and validation messages;
  OpenMS appends the location itself.
- Reserve a core for the decompression thread only when OpenMP uses all
  cores; a lower thread count chosen by the caller is left alone.
- Decode element names and text with StringManager::convert instead of a
  second, non-validating UTF-8 decoder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [TEST] FileInfo_15: expect libxml2's wording of the mzIdentML schema error

The XSD validator now is libxml2. It reports the same single error for the
invalid PeptideEvidence@post value ']' on line 327, but words it
differently and gives column 0 (Xerces: 183). The whitelist term keyed on
Xerces' column no longer matched, so the line with the machine-specific
input path was compared literally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [PERF] mzML cvParams: hash-indexed CV lookups, fewer allocations and string compares

MzMLHandler work per cvParam, the most frequent element:

- ControlledVocabulary keeps an unordered index next to its ordered term
  map (whose iteration order is unchanged); getTerm, exists and the
  ancestry walk of isChildOf use it instead of tree lookups. Copies
  rebuild the index, moves keep it. A load ran about 580 lookups per
  spectrum.
- cvParamToValue creates the string DataValue only for values that stay
  strings, not before replacing it with a number.
- cvParam/userParam attributes are read into reused buffers; the
  binaryDataArray branch computes isChildOf once instead of twice.
- handleCVParam_ compares "MS:nnnnnnn" accessions as numbers (fixed width)
  instead of memcmp'ing 347 same-length strings.
- XMLAttributes::index rejects names by their first byte before decoding.

196 MB mzML, best of 9: metadata-only loads 0.80-0.82 s instead of
0.89-0.91 s, full loads 0.95-0.96 s instead of 1.06 s; decoded data are
identical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [FIX] Windows: open XML input via to_path, build UTF-8 literal tests with /utf-8

Windows CI (first run of the libxml2 reader there):

- XMLFile::parse_ opened files with std::filesystem::u8path, which throws on
  the code-page file names OpenMS passes around on Windows (File::exists
  accepts them through to_path). TOPP_FileConverter_nonascii aborted with
  0xc0000409. Use to_path, which takes UTF-8 and falls back to the code page.
- StringManager_test, XMLHandler_test and XMLParserBackend_test spell UTF-8
  text as narrow literals; MSVC encoded them in the build machine's code page
  (cp1252: "Grüße β ??"), so comparisons failed and a missing lookup
  segfaulted. Compile these three with /utf-8.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [FIX] XMLFile: keep the 64 KiB parse chunk on the heap

The libxml2 reader read input into a 64 KiB stack array; Xerces kept its
buffers on the heap. Readers run deep in call stacks and on OpenMP worker
threads, with 1 MB stacks on Windows. FragmentIndex_test, whose single
test function holds ~90 FragmentIndex objects (7 KB each) and loads the
modification and enzyme databases from that frame, crashes on Windows CI
on this branch (develop: passes); a stack overflow is consistent with it.
One allocation per parsed file, no measurable cost.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* fix: warn about same-file parent name mismatches while loading OBO files

checkName_() runs while loadFromOBO() is still filling terms_, so it must not
look ids up via index_, which is only rebuilt once loading finishes.

Also find libxml2's own package config first in OpenMSConfig.cmake for static
installations, as the build does, and drop the stale validation section from
the migration notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [DOC] Install: libxml2 >= 2.13 is not packaged on several current distributions

Builds without vcpkg take libxml2 from the system. Ubuntu 24.04 and
Debian 13 ship 2.9.14, and RHEL, AlmaLinux and Rocky Linux 10 ship 2.12.5,
so the configure fails there. Name the minimum version and required
features, and point to vcpkg or a source build. The Dockerfile is no
longer a pure Ubuntu-packages build; say that it builds libxml2 itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h

* [TEST] DecompressingInputStream_test: include <algorithm> and Exception.h

GCC and Clang on Linux did not find std::min(initializer_list),
std::copy_n and the Exception namespace through the other includes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h

* [FIX] Remote mzML: no bogus I/O rate; reuse the whole decompression buffer

- MzMLHandler reported the load rate from File::fileSize(), which is -1 for
  remote URIs (develop's #9262), so S3 loads logged an absurd rate. It now
  reports none when the size is unknown.
- DecompressingInputStream refilled only the end of its input buffer after
  the buffer was consumed; it now starts at the front again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h

* [DOC] Install: without a preset, OPENMS_USE_VCPKG=ON uses the vcpkg submodule's toolchain

CMakeLists.txt picks vcpkg/scripts/buildsystems/vcpkg.cmake when the
submodule is initialized and no toolchain file is given. An explicit
toolchain is only needed without the submodule (source tarballs).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb

* [FIX] mzML: name CV-typed binary data arrays in one shared helper, for indexed reads too

MzMLHandler named arrays typed by a child term of MS:1000513 (binary data
array), e.g. ion mobility arrays (MS:1003008), after the term; the
indexed decoder (MzMLSpectrumDecoder) did not, so on-disc and indexed
reads lost these names and with them the ion mobility data.

MzMLHandlerHelper::handleBinaryDataArrayCVParam() now names these
arrays (and marks absorbance intensities), and MzMLHandler relies on it.
Both paths therefore agree, including the precedence of MzMLHandler:
the last array term wins. Accessions missing from the bundled CV stay
unidentified instead of throwing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb

* MzMLSpectrumDecoder: store m/z and intensity array meta data in the spectrum, as MzMLHandler does

Indexed reads dropped the meta data of the default arrays, e.g. the
absorbance flag of an intensity array (MS:1000515 with UO:0000269), so
writing such a spectrum back to mzML used the wrong intensity unit.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb

* MzMLFile::load: parallel load of indexed mzML with OpenMP (#10728)

Uncompressed indexed mzML without load filters is split at spectrum offsets
from the index into byte-balanced chunks (at least 1 MB, up to 4 per
thread, at most 32 threads). Each chunk is parsed with the document header
and closing tags by a normal MzMLHandler, so metadata and peaks are parsed
exactly as in the serial load; chromatograms form one extra chunk. Parts are
concatenated in document order.

Single-threaded, compressed, unindexed, small or filtered loads, and any
index/document count mismatch, keep the serial streaming parse.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>

* MzMLFile::load: keep remote input on the serial path and its document identifier (#10752)

#10728 was merged without the fix from its review: the serial fallback reset
the map and called setLoadedFileType(filename)/setLoadedFilePath(filename)
unconditionally, undoing the remote branch above it. For a URL,
setLoadedFileType(filename) sniffs the content and throws FileNotFound, so
every s3:// load failed (and every http(s)/ftp load once #10727 is in), and
MzMLFile_test's "load from HTTP URL" section got FileNotFound instead of the
expected ParseError. With 2+ threads, loadParallelIndexed_ also ran on URLs,
which it cannot read (std::ifstream on the URI).

Now remote input always takes the streaming parse, and the document
identifier is set once, in the serial branch.


Claude-Session: https://claude.ai/code/session_0149aXmaayHbZ6MkxFhfzX1D

Co-authored-by: Claude <[email protected]>

* [FIX] IndexedMzMLDecoder::findIndexListOffset: no error output for a file without index

MzMLFile probes every uncompressed mzML for an index before a parallel load
(#10728) and in hasIndex(), so ordinary mzML loads printed 'Could not find
element indexListOffset' when OpenMP had two or more threads. -1 is the
documented result for a missing index; IndexedMzMLHandler, the caller that
needs one, now reports it instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [CLEANUP] Remove leftovers of the Xerces migration

- CI: the Xerces-removal guard (tools/ci/check_no_xerces.py, its tests and the
  build step) and -DCMAKE_DISABLE_FIND_PACKAGE_XercesC, which nothing looks for
  any more.
- doc/xml_libxml2_migration.md: notes of the fork's migration (guard commands,
  links to its benchmark reports); the PR description has the current state.
- Xerces API shapes no caller uses: InputStream::getContentType(),
  CompressedInputSource's char16_t* constructor and getSystemId(), and the
  global XMLCh alias of the test framework (tests use char16_t).
- Stale Xerces mentions: the Xerces valgrind suppression, the devcontainer's
  dependency list, and comments that compared with Xerces.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [DOC] cmake_findExternalLibs: say which libxml2 installations lack a usable package config

Only libxml2's CMake build installs libxml2-config-version.cmake and exported
targets. Its autotools and meson builds (distribution packages) install an
unversioned libxml2-config.cmake, which find_package(LibXml2 2.13 CONFIG)
rejects, so the FindLibXml2 module is used for them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

---------

Co-authored-by: Oliver <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: Oliver Kohlbacher <[email protected]>
poshul pushed a commit that referenced this pull request Oct 29, 2026
* Replace Xerces with libxml2 on OpenMS 3.7 develop

* Document develop integration validation and remaining CI blocker

* [TEST] Adapt imzML parse-error tests to the current loadSpectraIndex signature

develop added the MSExperiment output to ImzMLFile::loadSpectraIndex; the
two malformed-input sections from the libxml2 branch still used the old
three-argument form and no longer compiled after the merge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [PERF] libxml2 adapter: decode Latin-1 in bulk, pass UTF-8 names and attributes through

Reading mzML spent much of its time converting text rather than parsing:

- OpenMS writes ISO-8859-1 declarations, which libxml2 decodes byte by
  byte. The adapter now detects such a declaration (or an enforced
  Latin-1 encoding, using libxml2's own name table), forces UTF-8, passes
  ASCII chunks through unchanged and converts the rest word-wise itself.
- Attributes are kept as UTF-8 slices of the parser buffer in a reusable
  XMLAttributes::NativeStore. UTF-16 values are produced only on access;
  the XMLHandler attribute helpers copy the UTF-8 value directly.
  Element names and character data reuse conversion buffers, so a parse
  no longer allocates per element or attribute.
- New opt-in hooks tryOnStartElementUTF8/tryOnEndElementUTF8 (same contract
  as tryOnCharactersUTF8) let MzMLHandler take UTF-8 tag names without the
  UTF-8 -> UTF-16 -> UTF-8 round trip.
- MzMLHandler drops character data outside <binary> before scanning it,
  scans <binary> payloads branch-free, and compares tags and accessions
  against string_view literals instead of strlen-ing C strings.

On a 196 MB DDA-like mzML (Linux, 4 cores) full loads take 0.91 s instead
of 1.56 s and metadata-only loads 0.84 s instead of 1.39 s; zlib-compressed
arrays 1.13 s instead of 1.66 s. Decoded data are identical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [PERF] XMLFile: decompress gzip/bzip2/zip input on a read-ahead thread

Inflating outer-gzip mzML costs about as much as parsing it, and both ran
serially. A helper thread now fills a small queue of 256 KiB blocks while
the parser consumes earlier ones; stream exceptions are rethrown to the
caller and an early stop (EndParsingSoftly) shuts the helper down.

While it runs, the parsing thread starts OpenMP regions with one thread
fewer: idle OpenMP workers spin between the handlers' decoding regions and,
on all cores, starve the helper (no gain at all otherwise).

196 MB mzML.gz: full load 0.94 s instead of 1.76 s, metadata-only 0.96 s
instead of 1.64 s, i.e. as fast as the uncompressed file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [FIX] vcpkg: require libxml2 2.13.5, a version the registry knows

"version>=" must name an entry of the vcpkg version database. There is no
2.13.0 port, so every vcpkg-based CI job (all build-and-test jobs and the
Linux/Windows wheels) stopped in "vcpkg install". 2.13.5 is the oldest
available release meeting the 2.13 minimum; the baseline still selects
the newer libxml2 it pins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [FIX] XMLFile: accept large attributes like Xerces, clean libxml2 diagnostics

Review follow-ups for the libxml2 SAX reader:

- Set XML_PARSE_HUGE with an explicit entity amplification budget, as the
  mzIdentML and spectrum DOM readers already do. Without it libxml2 rejects
  attribute values over 10 MB and nesting deeper than 256 levels, which
  Xerces read (e.g. large UserParam values in idXML/featureXML).
- Strip libxml2's trailing line break from parse and validation messages;
  OpenMS appends the location itself.
- Reserve a core for the decompression thread only when OpenMP uses all
  cores; a lower thread count chosen by the caller is left alone.
- Decode element names and text with StringManager::convert instead of a
  second, non-validating UTF-8 decoder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [TEST] FileInfo_15: expect libxml2's wording of the mzIdentML schema error

The XSD validator now is libxml2. It reports the same single error for the
invalid PeptideEvidence@post value ']' on line 327, but words it
differently and gives column 0 (Xerces: 183). The whitelist term keyed on
Xerces' column no longer matched, so the line with the machine-specific
input path was compared literally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [PERF] mzML cvParams: hash-indexed CV lookups, fewer allocations and string compares

MzMLHandler work per cvParam, the most frequent element:

- ControlledVocabulary keeps an unordered index next to its ordered term
  map (whose iteration order is unchanged); getTerm, exists and the
  ancestry walk of isChildOf use it instead of tree lookups. Copies
  rebuild the index, moves keep it. A load ran about 580 lookups per
  spectrum.
- cvParamToValue creates the string DataValue only for values that stay
  strings, not before replacing it with a number.
- cvParam/userParam attributes are read into reused buffers; the
  binaryDataArray branch computes isChildOf once instead of twice.
- handleCVParam_ compares "MS:nnnnnnn" accessions as numbers (fixed width)
  instead of memcmp'ing 347 same-length strings.
- XMLAttributes::index rejects names by their first byte before decoding.

196 MB mzML, best of 9: metadata-only loads 0.80-0.82 s instead of
0.89-0.91 s, full loads 0.95-0.96 s instead of 1.06 s; decoded data are
identical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [FIX] Windows: open XML input via to_path, build UTF-8 literal tests with /utf-8

Windows CI (first run of the libxml2 reader there):

- XMLFile::parse_ opened files with std::filesystem::u8path, which throws on
  the code-page file names OpenMS passes around on Windows (File::exists
  accepts them through to_path). TOPP_FileConverter_nonascii aborted with
  0xc0000409. Use to_path, which takes UTF-8 and falls back to the code page.
- StringManager_test, XMLHandler_test and XMLParserBackend_test spell UTF-8
  text as narrow literals; MSVC encoded them in the build machine's code page
  (cp1252: "Grüße β ??"), so comparisons failed and a missing lookup
  segfaulted. Compile these three with /utf-8.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [FIX] XMLFile: keep the 64 KiB parse chunk on the heap

The libxml2 reader read input into a 64 KiB stack array; Xerces kept its
buffers on the heap. Readers run deep in call stacks and on OpenMP worker
threads, with 1 MB stacks on Windows. FragmentIndex_test, whose single
test function holds ~90 FragmentIndex objects (7 KB each) and loads the
modification and enzyme databases from that frame, crashes on Windows CI
on this branch (develop: passes); a stack overflow is consistent with it.
One allocation per parsed file, no measurable cost.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* fix: warn about same-file parent name mismatches while loading OBO files

checkName_() runs while loadFromOBO() is still filling terms_, so it must not
look ids up via index_, which is only rebuilt once loading finishes.

Also find libxml2's own package config first in OpenMSConfig.cmake for static
installations, as the build does, and drop the stale validation section from
the migration notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [DOC] Install: libxml2 >= 2.13 is not packaged on several current distributions

Builds without vcpkg take libxml2 from the system. Ubuntu 24.04 and
Debian 13 ship 2.9.14, and RHEL, AlmaLinux and Rocky Linux 10 ship 2.12.5,
so the configure fails there. Name the minimum version and required
features, and point to vcpkg or a source build. The Dockerfile is no
longer a pure Ubuntu-packages build; say that it builds libxml2 itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h

* [TEST] DecompressingInputStream_test: include <algorithm> and Exception.h

GCC and Clang on Linux did not find std::min(initializer_list),
std::copy_n and the Exception namespace through the other includes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h

* [FIX] Remote mzML: no bogus I/O rate; reuse the whole decompression buffer

- MzMLHandler reported the load rate from File::fileSize(), which is -1 for
  remote URIs (develop's #9262), so S3 loads logged an absurd rate. It now
  reports none when the size is unknown.
- DecompressingInputStream refilled only the end of its input buffer after
  the buffer was consumed; it now starts at the front again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h

* [FEATURE] XMLFile: read HTTP, HTTPS and FTP URLs with libcurl

develop read these URLs through Xerces' network transport (#9262), which
the libxml2 reader no longer has. HTTPInputSource streams the resource with
libcurl's multi interface, driven from readBytes(), so at most one transfer
step is buffered. XMLFile reads it through the read-ahead thread, as it does
S3 objects and compressed local files, which overlaps network waits with
parsing.

- gzip and bzip2 content is decompressed (DecompressingInputStream), and
  HTTP transfer compression is decoded by libcurl.
- Redirects are followed, but only to HTTP(S) and FTP. HTTP 4xx/5xx are
  errors; 404/410 and missing FTP or file resources are FileNotFound.
- A transfer slower than 1 byte/s for two minutes fails instead of hanging.
- InputStream::cancel() lets the read-ahead thread stop a blocked read when
  a parse ends early (e.g. a metadata-only load), instead of waiting for a
  stalled server. libcurl's poll is woken up for it.
- The protocol restriction uses only protocols the libcurl build supports,
  and a transfer whose URL or restriction cannot be set does not start.
- CMake requires libcurl 7.66, for curl_multi_poll().
- file:// URLs are accepted by HTTPInputSource, so its class test reads
  local files through libcurl without network access.

The MzMLFile test checks that an unreachable server is a load error, and
loads OPENMS_TEST_HTTP_URL when it is set.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h

* [DOC] Install: without a preset, OPENMS_USE_VCPKG=ON uses the vcpkg submodule's toolchain

CMakeLists.txt picks vcpkg/scripts/buildsystems/vcpkg.cmake when the
submodule is initialized and no toolchain file is given. An explicit
toolchain is only needed without the submodule (source tarballs).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb

* [FIX] Remote input: no credentials of the URL in log and error messages

A URL can carry credentials: user info (ftp://user:password@host/...,
s3://key:secret@bucket/...) or a token in the query of a presigned URL.
HTTPInputSource::redactURL() drops user info, query and fragment and
leaves local file names unchanged. HTTPInputSource, S3InputSource,
XMLFile's parse errors, XMLHandler's messages and the ParseError of
MzMLFile::load() use it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb

* [FIX] mzML: name CV-typed binary data arrays in one shared helper, for indexed reads too

MzMLHandler named arrays typed by a child term of MS:1000513 (binary data
array), e.g. ion mobility arrays (MS:1003008), after the term; the
indexed decoder (MzMLSpectrumDecoder) did not, so on-disc and indexed
reads lost these names and with them the ion mobility data.

MzMLHandlerHelper::handleBinaryDataArrayCVParam() now names these
arrays (and marks absorbance intensities), and MzMLHandler relies on it.
Both paths therefore agree, including the precedence of MzMLHandler:
the last array term wins. Accessions missing from the bundled CV stay
unidentified instead of throwing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb

* MzMLSpectrumDecoder: store m/z and intensity array meta data in the spectrum, as MzMLHandler does

Indexed reads dropped the meta data of the default arrays, e.g. the
absorbance flag of an intensity array (MS:1000515 with UO:0000269), so
writing such a spectrum back to mzML used the wrong intensity unit.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb

* MzMLFile::load: parallel load of indexed mzML with OpenMP (#10728)

Uncompressed indexed mzML without load filters is split at spectrum offsets
from the index into byte-balanced chunks (at least 1 MB, up to 4 per
thread, at most 32 threads). Each chunk is parsed with the document header
and closing tags by a normal MzMLHandler, so metadata and peaks are parsed
exactly as in the serial load; chromatograms form one extra chunk. Parts are
concatenated in document order.

Single-threaded, compressed, unindexed, small or filtered loads, and any
index/document count mismatch, keep the serial streaming parse.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>

* MzMLFile::load: keep remote input on the serial path and its document identifier (#10752)

#10728 was merged without the fix from its review: the serial fallback reset
the map and called setLoadedFileType(filename)/setLoadedFilePath(filename)
unconditionally, undoing the remote branch above it. For a URL,
setLoadedFileType(filename) sniffs the content and throws FileNotFound, so
every s3:// load failed (and every http(s)/ftp load once #10727 is in), and
MzMLFile_test's "load from HTTP URL" section got FileNotFound instead of the
expected ParseError. With 2+ threads, loadParallelIndexed_ also ran on URLs,
which it cannot read (std::ifstream on the URI).

Now remote input always takes the streaming parse, and the document
identifier is set once, in the serial branch.


Claude-Session: https://claude.ai/code/session_0149aXmaayHbZ6MkxFhfzX1D

Co-authored-by: Claude <[email protected]>

* [FEATURE] HTTPInputSource: range reads, so IndexedMzMLDecoder reads the index over HTTP

objectSize() (HEAD) and readRange() (range request) mirror S3InputSource's, and
IndexedMzMLDecoder uses them for HTTP/HTTPS/FTP URLs as it does for s3://.
From a server that ignores the range (200 instead of 206), readRange() skips
to the offset itself. The transfer options and the error mapping are shared by
the stream and the new single requests.

HTTPInputSource_test now also runs a small HTTP server on 127.0.0.1: plain,
gzip and bzip2 resources, HTTP 404, MzMLFile::load, objectSize, byte ranges
(also from a server that ignores them) and the index of an indexed mzML.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [FIX] IndexedMzMLDecoder::findIndexListOffset: no error output for a file without index

MzMLFile probes every uncompressed mzML for an index before a parallel load
(#10728) and in hasIndex(), so ordinary mzML loads printed 'Could not find
element indexListOffset' when OpenMP had two or more threads. -1 is the
documented result for a missing index; IndexedMzMLHandler, the caller that
needs one, now reports it instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [FIX] No URL credentials in Arrow and libcurl diagnostics or binary-data parse errors

poshul's review of #10710 (reproduced on this branch):
- Arrow's status messages repeat the URI they were given, e.g. for an invalid
  port, so S3InputSource exposed the access key, secret and query token although
  it redacted the name it shows itself. HTTPInputSource::redactURLs() redacts
  every URL inside such a text; S3InputSource passes Arrow's diagnostics and
  HTTPInputSource libcurl's error messages through it.
- MzMLHandler, MzXMLHandler and ImzMLHandler threw ParseErrors for undecodable
  binary data with the file name as given, and MzMLFile::load rethrows those
  unchanged. They now use the redacted name.

Tests: redactURLs() on Arrow-style messages; an S3 URI with credentials and an
invalid port; MzMLFile::load of corrupt binary data from a URL with a password
and a token (fails without the handler fix).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [FIX] HTTPInputSource: decompress gzip transfer compression as the stream is read

libcurl decoded Content-Encoding itself, and it decodes everything one
curl_multi_perform() receives at once. For highly compressed content the
write callback then buffered far more than one transfer step: a 128 MiB
XML document served with Content-Encoding: gzip (190 KiB on the wire)
was buffered completely in makeStream(), raising the peak RSS from 36 to
294 MiB.

The stream now asks for gzip itself (Accept-Encoding: gzip) with libcurl's
content decoding off. The compressed body is recognized by its magic bytes
and decompressed by DecompressingInputStream as the parser reads, as a
.gz resource is. The same document now reads with a peak RSS of 38 MiB.

The test server serves /encoded/ paths with gzip transfer compression when
the client accepts it; HTTPInputSource_test checks the content and that it
is decompressed by the stream, and MzMLFile::load of such a URL.

Also: TEST_FALSE for a boolean check, and [in] tags for all documented
parameters of HTTPInputSource.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb

* [CLEANUP] Remove leftovers of the Xerces migration

- CI: the Xerces-removal guard (tools/ci/check_no_xerces.py, its tests and the
  build step) and -DCMAKE_DISABLE_FIND_PACKAGE_XercesC, which nothing looks for
  any more.
- doc/xml_libxml2_migration.md: notes of the fork's migration (guard commands,
  links to its benchmark reports); the PR description has the current state.
- Xerces API shapes no caller uses: InputStream::getContentType(),
  CompressedInputSource's char16_t* constructor and getSystemId(), and the
  global XMLCh alias of the test framework (tests use char16_t).
- Stale Xerces mentions: the Xerces valgrind suppression, the devcontainer's
  dependency list, and comments that compared with Xerces.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r

* [FIX] S3InputSource: finalize S3 at exit also when no object was opened

The exit handler that finalizes Arrow's S3 APIs was registered only after the
first S3 filesystem was made. A URI that failed before that (e.g. an invalid
port, as in S3InputSource_test since b145d05) left S3 initialized but never
finalized: Arrow warned at exit, and on macOS the test crashed at exit
(SEGFAULT after PASSED).

The handler must run before the statics that Arrow creates with its first S3
client are destroyed, so it is registered after them. ensureS3Initialized()
now makes that first client right after the initialization (anonymous, it
does not connect) and registers the handler then, once, whatever the URI.

S3InputSource_test also checks an S3 server that cannot be reached: a client
is made after the first one, and the process still exits cleanly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb

* [FIX] HTTPInputSource::objectSize: a GET of the first byte instead of HEAD

A presigned URL (e.g. of S3 or GCS) is signed for one request method, usually
GET, and refuses a HEAD request (403), so objectSize() failed for it and the
index of an indexed mzML could not be read. For HTTP(S), objectSize() now
requests the first byte (Range: bytes=0-0) and stops the transfer at the
first byte of the body:
- 206: the size from Content-Range ("bytes 0-0/<size>")
- 416: the same ("bytes */<size>"), for an empty resource
- 200 (a server that ignores the range): Content-Length
- other 4xx/5xx: errors as before (404/410: FileNotFound)
FTP and file URLs, also after a redirect from HTTP to FTP, keep a request
without body (SIZE).

The test server gains a redirect (/moved/, with a body), a URL presigned for
GET (/signed/: 403 for HEAD or without the signature), an empty resource and
Content-Range in its 416. Tests: objectSize() of each, a redirect for
makeStream(), readRange() of a presigned URL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb

* [FIX] Remote input: both compression layers over HTTP; no URL parts in Arrow and libcurl messages

Two findings of poshul's review of c0524b1:

1. A server can send a compressed resource (.mzML.gz, .mzML.bz2) with gzip
   transfer compression. makeStream() decoded by magic bytes once, so it
   removed only the transfer compression and handed the parser gzip or bzip2
   bytes. The response's Content-Encoding is now collected (ResponseHeader,
   shared with objectSize()'s Content-Range). With gzip transfer compression,
   makeStream() decompresses that layer first, then the resource's own
   compression by its magic bytes, as for a local file. A small
   PeekingInputStream gives the decompressed stream the peek() for that;
   every layer still decompresses as the stream is read.

2. Arrow can repeat a part of the URI on its own, e.g. "Invalid S3
   connection scheme 'MY_SECRET_SCHEME'" for ?scheme=MY_SECRET_SCHEME, which
   redactURLs(text) cannot recognize. New HTTPInputSource::redactURLs(text,
   url) also replaces the user name, password, query values and fragment of
   the URL (as given and percent-decoded) with "***" where they are a whole
   word of the text. All Arrow messages of S3InputSource and all libcurl
   messages of HTTPInputSource go through it.

Tests:
- The test server sends .mzML.gz and .mzML.bz2 with gzip transfer
  compression (new test files MzMLFile_6_uncompressed.mzML.gz.gz and
  .mzML.bz2.gz); makeStream() and MzMLFile::load of both match the local
  files. The check that OpenMS, not libcurl, decodes the transfer compression
  is now behavioural: corrupt transfer-compressed data is a ParseError
  (libcurl would report an IOException).
- redactURLs(text, url): a query value on its own, user info as given and
  decoded, the fragment, whole words only, nothing for URLs without such
  parts or local file names.
- S3InputSource_test: the reproduction (an invalid scheme value) is not in
  the message.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb

---------

Co-authored-by: Oliver <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: Oliver Kohlbacher <[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.

5 participants