Skip to content

Add unit tests for OpenSwathParquetExporter - #9681

Merged
timosachsenberg merged 3 commits into
developfrom
claude/merge-conflict-resolution-m17hyd
Jun 29, 2026
Merged

timosachsenberg merged 3 commits into
developfrom
claude/merge-conflict-resolution-m17hyd

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR adds comprehensive unit tests for the OpenSwathParquetExporter class, which handles exporting OpenSWATH feature and transition score data to Parquet format.

The test suite covers:

  • Feature scores export: Tests writing and round-tripping of OpenSwathFeatureScoreTable data to Parquet, verifying that key columns (FEATURE_ID, PROTEIN_ACCESSION, MODIFIED_SEQUENCE, PRECURSOR_MZ, EXP_RT, etc.) are correctly serialized and deserialized.
  • Transition scores export: Tests writing and round-tripping of OpenSwathTransitionScoreTable data to Parquet, including validation of transition identifiers, product m/z values, annotations, and boolean flags (TRANSITION_DECOY).
  • Edge cases: Tests handling of empty tables (schema-only output with 0 rows).

The tests use the existing ParquetFile utility API to verify data integrity after round-tripping through the Parquet format.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

https://claude.ai/code/session_01L9EmQ8VLeYSbFGoeEDAevH

Summary by CodeRabbit

  • Tests
    • Added new OpenSWATH Parquet exporter tests that perform round-trip verification for exported feature and transition score tables.
    • Validated key column values (including per-row decoy fields) after re-reading the generated Parquet files.
    • Added assertions for empty-table exports to ensure they produce schema-only Parquet output with zero rows.

timosachsenberg and others added 2 commits June 29, 2026 06:29
…rquet export)

OpenSwathParquetExporter - the 3.6 native-Parquet exporter for OpenSWATH
feature- and transition-level score tables - had no test.

Adds a class test for both write methods that builds a small score table,
writes it to a Parquet file, reads it back via ParquetFile, and verifies the
round-tripped key columns:
- writeFeatureScores: FEATURE_ID, PROTEIN_ACCESSION, MODIFIED_SEQUENCE,
  PRECURSOR_MZ and EXP_RT survive the round-trip for two rows;
- writeTransitionScores: TRANSITION_ID, PRODUCT_MZ, ANNOTATION and the
  per-row TRANSITION_DECOY flag survive, and an empty table is accepted and
  produces a valid 0-row (schema-only) file.

Registered in executables.cmake (swath_executables_list, under
NOT DISABLE_OPENSWATH). Part of the OpenMS 3.6.0 pre-release testing plan
(#9460). Tests only; no production code changes.

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

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 1faf73c9-e599-4f70-a1b7-f245b2c7c5ff

📥 Commits

Reviewing files that changed from the base of the PR and between e2c1086 and a4ed75c.

📒 Files selected for processing (1)
  • src/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp

📝 Walkthrough

Walkthrough

A new OpenSwathParquetExporter test file adds Parquet round-trip checks for feature and transition score tables. The test is registered in the SWATH executable list and linked against the configured Arrow and Parquet targets.

Changes

OpenSwathParquetExporter Test

Layer / File(s) Summary
Test suite and build integration
src/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp, src/tests/class_tests/openms/executables.cmake, src/tests/class_tests/openms/CMakeLists.txt
Adds the OpenSwathParquetExporter class test with feature and transition score Parquet round-trip assertions, registers the executable in swath_executables_list, and conditionally links it against ${OPENMS_ARROW_TARGET} and ${OPENMS_PARQUET_TARGET}.

A bunny hops through Parquet rows,
And checks each column as it flows.
Features and transitions round-trip clean,
Zero-row files stay neat and clean.
🐇

🚥 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 clearly states the main change: adding unit tests for OpenSwathParquetExporter.
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 claude/merge-conflict-resolution-m17hyd

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: 2

🧹 Nitpick comments (1)
src/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp (1)

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

Cover the empty writeFeatureScores path too.

The API contract allows schema-only output for empty feature tables as well, but this suite only exercises that behavior through writeTransitionScores. Since the two writers build separate Arrow schemas, a feature-side empty-table regression would still pass here.

🤖 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/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp` around
lines 27 - 63, The OpenSwathParquetExporter::writeFeatureScores test only covers
populated rows, so it misses the schema-only empty-table path. Extend the
existing OpenSwathParquetExporter_test coverage to call writeFeatureScores with
an empty OpenSwathFeatureScoreTable and verify the resulting parquet/table can
still be read and has the expected schema or zero rows, similar to the
writeTransitionScores empty-case. Use the existing writeFeatureScores helper and
OpenSwathFeatureScoreTable to locate the right test block.
🤖 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/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp`:
- Around line 50-52: The OpenSwathParquetExporter_test.cpp round-trip checks
continue using tbl after a failed ParquetFile::readTable result, which can lead
to invalid dereferences. In each test block that uses ParquetFile::readTable and
then TEST_NOT_EQUAL(tbl, nullptr), add an ABORT_IF(tbl == nullptr) immediately
after the null check before any num_rows() or column access. Apply this in both
round-trip sections so the test stops as soon as the read fails.
- Around line 44-47: The temp-file setup in the OpenSwathParquetExporter test
should use the extension-aware helper instead of manually appending the suffix,
because `NEW_TMP_FILE` and `fn += ".parquet"` leave the tracked cleanup path out
of sync with the actual written file. Update the
`OpenSwathParquetExporter::writeFeatureScores` test call site to use
`NEW_TMP_FILE_EXT(..., ".parquet")` so the generated path and cleanup remain
aligned with the other parquet temp-file usages.

---

Nitpick comments:
In `@src/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp`:
- Around line 27-63: The OpenSwathParquetExporter::writeFeatureScores test only
covers populated rows, so it misses the schema-only empty-table path. Extend the
existing OpenSwathParquetExporter_test coverage to call writeFeatureScores with
an empty OpenSwathFeatureScoreTable and verify the resulting parquet/table can
still be read and has the expected schema or zero rows, similar to the
writeTransitionScores empty-case. Use the existing writeFeatureScores helper and
OpenSwathFeatureScoreTable to locate the right test block.
🪄 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: 52c37cbe-e07e-4b69-9291-b4036bbd1c43

📥 Commits

Reviewing files that changed from the base of the PR and between 3fe33a9 and e2c1086.

📒 Files selected for processing (3)
  • src/tests/class_tests/openms/CMakeLists.txt
  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp

- use NEW_TMP_FILE_EXT(..., ".parquet") so the tracked cleanup path
  matches the written file at all call sites
- ABORT_IF(tbl == nullptr) after each readTable null-check to stop the
  section before dereferencing on a failed read
- cover the empty-table (schema-only, 0-row) path for writeFeatureScores,
  mirroring the existing writeTransitionScores empty case

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L9EmQ8VLeYSbFGoeEDAevH
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