Skip to content

[TEST,FIX] QPX: assert schema and a row-count floor instead of file existence (#9864 Phase 0.1) - #9878

Merged
timosachsenberg merged 4 commits into
OpenMS:developfrom
timosachsenberg:qpx-value-assertions
Aug 6, 2026
Merged

timosachsenberg merged 4 commits into
OpenMS:developfrom
timosachsenberg:qpx-value-assertions

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

#9864 Phase 0.1: the first assertion on the QPX surface that isn't an existence check.

The gap

All 19 QPX assertions in src/tests/topp/CMakeLists.txt were cmake -E sha256sum <file> — a hash, printed and compared to nothing. The only property asserted was that a file had been created. No value, no column and no row count on the QPX exchange surface was compared against anything.

It is demonstrable, not theoretical. Feed a correctly shaped but empty pg table — same schema, same file metadata — to the old check:

cmake -E sha256sum empty_pg.parquet              -> exit 0   (passes)
ParquetDiff -in1 empty_pg.parquet -schema pg -min_rows 48
    Row count: 'empty_pg.parquet' holds 0 row(s), at least 48 required
    RESULT: differ                               -> exit 11  (fails)

TOPP_ProSE_3_qpx_pg_exists was passing on a genuinely 0-row table.

It persisted because there was no instrument: FuzzyDiff cannot read Parquet, and the convert-to-text idiom used for .idparquet/.featureparquet/.consensusparquet has no route for the QPX views, since OpenMS has no QPX reader. #9865 supplied ParquetDiff; nothing used it.

What this adds

ParquetDiff -min_rows — a row-count floor, checked in both comparison and schema mode. It closes the one gap neither covers: an empty table satisfies any schema, and two empty tables compare equal. -1 disables it; 0 is accepted and always passes, to record deliberately that a table is expected to be empty.

All 19 checks now validate against the built-in QPX schema for their view and require a floor. The only remaining sha256sum in the file is a non-Parquet YAML smoke test.

Floors are minima, not equalities — they catch row loss while tolerating gain, and they are plain integers in CMakeLists rather than committed binary references. That is deliberate: a binary reference can only ever be regenerated wholesale, which is the operation that hides unrelated drift. Pinning values is a later phase.

The ProteinQuantifier and IsobaricWorkflow floors sit at the observed count — those read a committed consensusXML and do no feature finding. The two ProteomicsLFQ floors sit at ~75% of observed, because that tool finds features in mzML and counts legitimately differ a little across the five CI platforms; a floor tight enough to pin the count would report that variance as a regression.

Three ParquetDiff self-tests for the floor: satisfied, violated by one (WILL_FAIL), and violated on the second input only — it must apply to both.

ProSE no longer writes an empty pg file

Investigated rather than pinned. pg rows come only from getIndistinguishableProteins(), and ProSE infers proteins in exactly two places: single-file finalization, gated on FDR:protein > 0 and decoys, and the merged path, gated on -out_merged with more than one input. ProSE_1.ini sets decoys=ignore and leaves FDR:protein at 0, and the test passes a single -in — so neither gate opens and zero rows is correct for the configuration.

Writing the file anyway produced a schema-valid table saying "no protein groups", which a consumer cannot tell apart from "inference ran and found none". Both pg files are now omitted and the reason logged, naming the settings that would produce groups.

Conditional, not blanket — verified both directions: an identification-only run writes only the two psm files; -Search:decoys generate -Search:FDR:protein 0.05 still writes both pg files with 3 rows each.

The tests assert the absence (sha256sum + WILL_FAIL — sha256sum errors on a missing file, so a failing hash is exactly "not there"), and go red in both directions.

A hole this surfaced

ctest never cleans TESTS_TEMP_DIR, so a producer that crashed left the previous run's Parquet on disk for the assertions to read — and they passed on it. The same hole existed under sha256sum, but a value assertion invites more confidence in the result.

Not hypothetical: it fired the moment ProSE stopped writing its empty pg files and the stale ones from a run 16 minutes earlier kept the absence check red (psm rewritten at 14:12:49, pg still dated 13:56:30). Every QPX producer now clears its output directory first.

Notes for review

  • Test names. The converted checks keep their _exists names — the new assertion is a strict superset of existence, so the name is understated rather than false, and renaming would break CDash history for no functional gain. The two ProSE pg checks are renamed to _absent, because there the old name would be flatly wrong.
  • Why not class tests. QPXFile_test and ProteinGroupArrowExport_test already assert QPX values, but on hand-built maps. They cannot detect a change in ProteomicsLFQ's or ProteinQuantifier's numbers reaching QPX, which is what §A3 and §A4 will move.

Full local ctest, -E "BrukerTims|PASEF": 9 failures, all pre-existing environmental (6 CometAdapter version-string, PercolatorAdapter numerics, Doxygen_Warning_test HAVE_DOT, ThermoRawFile_test .NET) — unchanged from the baseline.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y9DY9JfJasCr76qof5n5rx

Summary by CodeRabbit

  • New Features
    • Added a min_rows option to require minimum row counts during Parquet comparisons and schema checks.
    • ProSE QPX now omits per-input and merged protein-group Parquet files when no protein inference was performed.
  • Bug Fixes
    • Improved QPX output validation, including schema/minimum-row checks, stale-output cleanup, and stronger identity/emptiness assertions.
  • Documentation
    • Updated ParquetDiff and ProSE QPX docs to reflect the new minimum-row behavior and when protein-group files are generated.

timosachsenberg and others added 3 commits August 6, 2026 14:49
…ence

Every assertion OpenMS made about its QPX Parquet output was an existence check.
All 19 were 'cmake -E sha256sum <file>', which prints a hash and compares it to
nothing, so the only property asserted was that a file had been created. No
value, no column and no row count on the QPX exchange surface was compared
against anything.

The gap is demonstrable, not theoretical: TOPP_ProSE_3_qpx_pg_exists passed on a
pg table holding ZERO rows. Feed a correctly shaped but empty pg table - same
schema, same metadata - to the old check and it exits 0.

It persisted because there was no instrument. FuzzyDiff is string-based and
cannot read Parquet, and the convert-to-text idiom used for .idparquet,
.featureparquet and .consensusparquet has no route for the QPX views, since
OpenMS has no QPX reader. ParquetDiff supplied the instrument; no assertion used
it.

ParquetDiff gains 'min_rows', a row-count floor checked in both comparison and
schema mode. It closes the one gap neither covers: an empty table satisfies any
schema, and two empty tables compare equal, so neither can tell a correct table
from a correctly shaped nothing. '-1' disables it; '0' is accepted and always
passes, to record deliberately that a table is expected to be empty.

All 19 checks now validate against the built-in QPX schema for their view and
require a floor. Floors are minima, not equalities: they catch row loss while
tolerating gain. They are plain integers in CMakeLists rather than committed
binary references - deliberately, because a binary reference can only ever be
regenerated wholesale, which is the operation that hides unrelated drift. The one
remaining sha256sum is a non-Parquet YAML smoke test.

Three ParquetDiff self-tests cover the floor itself: satisfied, violated by one
(WILL_FAIL), and violated on the SECOND input only, since it must apply to both.

ProSE's empty pg tables are recorded as 'min_rows 0' with the reason in place. pg
rows come only from getIndistinguishableProteins(), and this invocation opens
neither of ProSE's inference gates - ProSE_1.ini sets 'decoys=ignore' and leaves
'FDR:protein' at 0, and a single '-in' is passed - so zero is correct for the
configuration. Whether ProSE should write a 0-row file at all is a contract
question, filed rather than silently pinned. A produced-vs-produced check
additionally asserts that merging its single run is the identity: the four
existing checks covered only two distinct artefacts, which was an unstated
coincidence.

Three comments asserting the obsolete rationale are corrected. "Not
byte-reproducible" was true and irrelevant: ParquetDiff compares schema and
values, not the per-run uuid and creation_date.

Part of OpenMS#9864 Phase 0.1. Values on this surface cannot be pinned until something
compares them, and the normalization fixes queued behind it each have to record a
numeric delta.

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

The floors landed at the exact observed row count. That is right for the
ProteinQuantifier and IsobaricWorkflow producers, which read a committed
consensusXML and do no feature finding, but wrong for the two ProteomicsLFQ ones:
they find features in mzML, and feature counts legitimately differ a little
between compilers and architectures - CI covers five. A floor tight enough to pin
the count would report that variance as a regression.

Those six are now set at roughly three quarters of the observed count, with the
reasoning recorded in place. The floor's job is to catch collapse, which is what
an existence check could not do at all; pinning a count is the job of a value
reference, deliberately a later phase.

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

pg rows come only from getIndistinguishableProteins(), and ProSE infers proteins
in exactly two places: single-file finalization, gated on 'FDR:protein' > 0 AND
decoys, and the merged path, gated on '-out_merged' with more than one input. An
identification-only run - the default, since 'FDR:protein' is 0 and decoy
handling may be 'ignore' - opens neither gate and produced a schema-valid pg
table holding zero rows.

That file is indistinguishable to a consumer from "inference ran and found
nothing", which is a different claim. Both the per-input '<basename>.pg.parquet'
and the merged 'quantms.pg.parquet' are now omitted in that case, and the reason
is logged at INFO naming the two settings that would produce groups. The psm
files are unaffected, and the parameter documentation for '-out_qpx' now states
the condition instead of promising the files unconditionally.

Verified in both directions: an identification-only run writes only the two psm
files, while '-Search:decoys generate -Search:FDR:protein 0.05' still writes both
pg files with 3 rows each. The suppression is conditional on there being nothing
to report, not blanket.

The tests assert the ABSENCE, via sha256sum + WILL_FAIL - sha256sum errors on a
missing file, so a failing hash is exactly "this file is not there". They go red
in both directions: if ProSE starts writing empty pg files again, and equally if
it starts inferring groups here.

Each QPX producer also now clears its output directory first. ctest never cleans
TESTS_TEMP_DIR, so a producer that crashed left the previous run's Parquet on
disk for the assertions to read, and they passed on it - the same hole existed
under sha256sum, but a value assertion invites more confidence in the result.
This was not hypothetical: it surfaced the moment ProSE stopped writing its empty
pg files and the stale ones from an earlier run kept the absence check red.

Part of OpenMS#9864 Phase 0.1.

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

coderabbitai Bot commented Aug 6, 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 Plus

Run ID: e58ecae1-5cc0-4258-96e0-ca6ed7f22e58

📥 Commits

Reviewing files that changed from the base of the PR and between cec0d5a and 05a96c4.

📒 Files selected for processing (3)
  • src/openms/include/OpenMS/FORMAT/ArrowIOHelpers.h
  • src/openms/source/FORMAT/ArrowIOHelpers.cpp
  • src/topp/ProSE.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/topp/ProSE.cpp

📝 Walkthrough

Walkthrough

ProSE omits empty QPX protein-group files and logs the reason. ParquetDiff supports minimum row-count validation. TOPP tests validate QPX schemas and data, remove stale outputs, and verify merged-output identity.

Changes

QPX validation and output behavior

Layer / File(s) Summary
ParquetDiff minimum-row validation
src/openms/include/OpenMS/FORMAT/ArrowIOHelpers.h, src/openms/source/FORMAT/ArrowIOHelpers.cpp, src/topp/ParquetDiff.cpp, src/tests/topp/CMakeLists.txt
Adds tableRowCount and the min_rows option. Comparison and schema checks now fail when input tables do not meet the configured row count.
ProSE conditional protein-group exports
src/topp/ProSE.cpp
Skips per-file and merged protein-group Parquet files when the corresponding tables are empty.
QPX producer test coverage
src/tests/topp/CMakeLists.txt, CHANGELOG
Adds output cleanup, schema checks, minimum-row checks, absent-file assertions, merged-output checks, and single-run identity validation.

Sequence Diagram(s)

sequenceDiagram
  participant ProSE
  participant QPXFiles
  participant ParquetDiff
  ProSE->>QPXFiles: Write non-empty QPX tables
  ProSE->>QPXFiles: Omit empty protein-group tables
  ParquetDiff->>QPXFiles: Validate schemas and minimum row counts
  ParquetDiff-->>QPXFiles: Return validation status
Loading

Possibly related PRs

Poem

I hop through QPX rows in line,
Empty group files now decline.
Schemas shine and counts stand tall,
Clean paths greet each fresh run call.
Merges match, the tests agree—
A tidy burrow pleases me.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the QPX test change from file-existence checks to schema and minimum row-count assertions.
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 unit tests (beta)
  • Create PR with unit tests

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.

The empty-pg check in ProSE called qpx_pg_table->num_rows() directly. That links
on Linux and macOS and fails on MSVC:

  ProSE.cpp.obj : error LNK2019: unresolved external symbol
  "__declspec(dllimport) public: __int64 __cdecl arrow::Table::num_rows(void)const"
  referenced in function ProSE::main_

Arrow is deliberately confined to libOpenMS' implementation so that binaries
linking libOpenMS need not import Arrow symbols - the note on
ParquetTableComparator says so, and ProSE.cpp's own include is annotated "only
for std::shared_ptr<arrow::Table> declarations". A member call is not a
declaration. On Windows those symbols are dllimport, so the rule is enforced by
the linker; on Linux nothing catches it.

ArrowIOHelpers::tableRowCount() keeps the Arrow call inside the library. It
returns 0 for a null table, so the caller's null check and its emptiness check
collapse into one condition.

No behaviour change: an identification-only run still writes only the two psm
files and logs the same reason, and no other TOPP tool calls an Arrow member
directly (checked).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y9DY9JfJasCr76qof5n5rx
@timosachsenberg
timosachsenberg merged commit c5f7577 into OpenMS:develop Aug 6, 2026
58 of 66 checks passed
timosachsenberg added a commit that referenced this pull request Aug 6, 2026
…feature (#9881)

The 3.6 section had grown to 217 KB (22x the 3.5 section), mostly because
recent entries were appended verbatim as PR-body-style root-cause writeups,
with newest entries prepended to "General:" regardless of topic.

Collapse incremental/superseded PR chains into one entry per feature:

  - QPX Parquet export: ~30 entries across #9692-#9878 (long-format
    conversion, run_file_name resolution, validation, transactional writes,
    streaming/parallel build) reduced to a 6-item block. The export is new in
    3.6, so the intermediate fixes never shipped to users.
  - ProteinQuantifier/PeptideAndProteinQuant: the per-assay grain change,
    fractions:aggregate, best_charge rename, the same undetected-peptide
    aggregation defect fixed at three levels, and the perf work bundled.
  - pyOpenMS nanobind lifetime/use-after-free work (#9792, #9794, #9795).
  - ProSE: 30 entries down to 17, grouped by search modes, calibration,
    FDR, Percolator and FragmentIndex.
  - Bruker TimsTOF, IMAGING, ThermoRawFile and the native Parquet formats
    each get one nested block instead of scattered entries.
  - ~20 near-identical per-tool ".idparquet/.featureparquet support" and
    "Thermo .raw input" entries folded into "TOPP tools > all:".

Remove exact duplicates (ProteinQuantifier -ratios removal, Annotation1DItem
DLLAPI, ConsensusMapArrowExport streaming, macOS pkg notarization, Qt removal
steps duplicated between General/Dependencies/Build System, IsoelectricPoint
and IMAGING multi-region duplicated between General and OpenMS Library).

File misplaced entries into the sections they belong to and add a GUI tools
section, matching the structure used by 3.5 and earlier releases.

Net: 217 KB -> 82 KB with all 440 distinct PR references preserved; the five
dropped refs are CI-internal test guards and a historical bug reference.


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

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant