Repository navigation
[FIX] QPX export: the feature view accepted merged runs it cannot attribute - #9835
Conversation
…ribute id_run_file_name is resolved through IdentifierMSRunMapper, which falls back to the run's FIRST file when a PSM carries no 'id_merge_index'. So for a merged run the column named a file the best PSM did not come from -- silently, and it is the column whose whole purpose is recording that identification and quantification happened in different runs. The psm and pg views already refuse this input. Matching them matters beyond consistency: ProteomicsLFQ and ProteinQuantifier write the feature view FIRST and pg THIRD, so accepting here and refusing there left a wrong feature.parquet on disk beside a half-written collection. Refusing in all three means the run fails before anything is written. Implemented as a preflight, single-threaded before any OpenMP region and before the output file is opened, for the same reason requireUnambiguousIdentities is -- an exception escaping the parallel batch build would be flattened into a boolean by the worker's catch-all, and one escaping the region is std::terminate. Wired into both exportToArrow and exportToParquetStreaming. Test asserts both directions: the refusal, and that the same input with id_merge_index=1 exports and resolves to runB. Verified it discriminates -- without the preflight it reports "no exception thrown!". 153/153 TOPP tests; Arrow/QPX class tests green. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
📝 WalkthroughWalkthroughThe export validates identification-run mappings before Arrow and streaming Parquet output. It rejects duplicate identifiers and unresolved selected hit mappings. Tests cover missing and valid merge indices, hitless identifications, and duplicate identifiers. ChangesMerged-run export validation
Possibly related issues
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/source/FORMAT/ConsensusMapArrowExport.cpp`:
- Around line 1255-1277: Update the CHANGELOG entry for merged-run rejection to
also document ConsensusMapArrowExport and quantms.feature.parquet. State that
the feature-export preflight throws Exception::MissingInformation when merged
runs lack a usable id_merge_index, while preserving the existing QPX and
consensus:annotate_ids_with_subelements coverage.
- Around line 1255-1277: Update requireResolvableIdRuns to validate only the
identification returned by selectFeatureIdentity for each ConsensusFeature,
rather than iterating every PeptideIdentification. Skip features whose handles
cannot produce output, preserving the existing feature-export behavior, and pass
the selected identification with the correct PSM index to
mapper.validateMergeIndex.
🪄 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 Plus
Run ID: 396494ba-dfb8-4699-bfb3-0327bd87b5fb
📒 Files selected for processing (2)
src/openms/source/FORMAT/ConsensusMapArrowExport.cppsrc/tests/class_tests/openms/source/ConsensusMapArrowExport_test.cpp
…ntifiers Two defects found reviewing the preflight added in the previous commit. 1. It validated EVERY identification attached to a feature, but the row draws all identification-derived values from the winning hit alone. So a feature whose winner resolves perfectly was refused because a sibling -- hitless, or simply not selected -- lacked an index nobody asks for. Now it selects the same identity the row builder does (selectFeatureIdentity) and validates only that. Third over-scoped guard in this area: validate exactly the values the output depends on, not everything in reach. 2. Duplicate identification-run identifiers were accepted. The mapper's forward map assigns with operator[], so two runs sharing an identifier leave only the last one's paths and a feature of the first is stamped with a file it never came from -- silently, since one row gives nothing away. The pg exporter already refuses this. Placement matters and the test caught getting it wrong: the check must sit OUTSIDE the existing try/catch, which swallows Exception::InvalidValue. That handler exists for the mapper's duplicate-PATH-LIST throw, which is safe to downgrade because the forward map is still complete; a duplicate IDENTIFIER is the opposite case wearing the same exception type. Inside the try, the new throw was caught and logged as a warning while the export continued on the very mapping it was meant to reject. Known limitation, unchanged: the preflight narrows the partial-collection window without closing it. Unassigned identifications do not affect feature rows but do reach the PSM export, which validates them and can throw after quantms.feature.parquet is already written. Closing that means validating the whole collection in the caller before the first write, in three TOPP tools. 157/157 tests. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/openms/source/FORMAT/ConsensusMapArrowExport.cpp (1)
1287-1294: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winSkip validation for features that cannot emit a QPX row.
buildFeatureTableRangedrops a feature when none of its handles has a matching entry inid_lut.run_columns. This preflight validates that feature before the drop. A selected identification withoutid_merge_indexcan then reject an export even though the feature cannot produceid_run_file_nameor any output row.Only call
validateMergeIndexafter confirming that the feature has at least one exportable handle. Add a regression test for a dropped feature with a selected identification and noid_merge_index.Also applies to: 1296-1296
🤖 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/ConsensusMapArrowExport.cpp` around lines 1287 - 1294, The preflight validation around the feature loop currently validates selected identifications before confirming the feature can emit a row. In the loop over cmap features and before calling validateMergeIndex, first determine whether at least one handle has a matching entry in id_lut.run_columns, matching buildFeatureTableRange’s drop condition; skip validation for non-exportable features, and add a regression test covering a dropped feature with a selected identification lacking id_merge_index.
🧹 Nitpick comments (1)
src/openms/source/FORMAT/ConsensusMapArrowExport.cpp (1)
1295-1295: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueFormat the conditional block on separate lines.
Put the opening and closing braces on aligned lines.
As per coding guidelines, C++ blocks must use braces on their own aligned 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/ConsensusMapArrowExport.cpp` at line 1295, Reformat the conditional in selectFeatureIdentity so the opening and closing braces appear on separate, aligned lines, while preserving the existing continue behavior.Source: Coding guidelines
🤖 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.
Duplicate comments:
In `@src/openms/source/FORMAT/ConsensusMapArrowExport.cpp`:
- Around line 1287-1294: The preflight validation around the feature loop
currently validates selected identifications before confirming the feature can
emit a row. In the loop over cmap features and before calling
validateMergeIndex, first determine whether at least one handle has a matching
entry in id_lut.run_columns, matching buildFeatureTableRange’s drop condition;
skip validation for non-exportable features, and add a regression test covering
a dropped feature with a selected identification lacking id_merge_index.
---
Nitpick comments:
In `@src/openms/source/FORMAT/ConsensusMapArrowExport.cpp`:
- Line 1295: Reformat the conditional in selectFeatureIdentity so the opening
and closing braces appear on separate, aligned lines, while preserving the
existing continue behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bcf05e50-c51a-4d40-a5b8-f67dd000a441
📒 Files selected for processing (2)
src/openms/source/FORMAT/ConsensusMapArrowExport.cppsrc/tests/class_tests/openms/source/ConsensusMapArrowExport_test.cpp
…9835, #9836 (#9841) Backfills the QPX export spec-conformance series, the macOS PKG notarization fix, and the Windows GUI DLL export fix that merged into develop without changelog entries. #9805 and #9821 were intentionally skipped (test-only / comment-only, no user-visible behavior change), and #9818 was already documented. Claude-Session: https://claude.ai/code/session_0118Yt3TZEMzhMhH6FwZPDVt Co-authored-by: Claude <[email protected]>
The QPX
featureview resolvesid_run_file_namethroughIdentifierMSRunMapper, which falls back to the run's first file when a PSM carries noid_merge_index. For a merged run the column therefore named a file the best PSM did not come from — silently, and it is precisely the column whose purpose is to record that identification and quantification happened in different runs (match-between-runs).The
psmandpgviews already refuse this input; the feature view did not.Why this is worth refusing rather than nulling
ProteomicsLFQandProteinQuantifierwrite the three views in a fixed order — feature first, psm second, pg third. Accepting the input here and refusing it in pg left a wrongfeature.parqueton disk next to a half-written collection, with a non-zero exit code. Refusing in all three means the run fails before anything is written.Implementation
A preflight (
requireResolvableIdRuns), single-threaded, before any OpenMP region and before the output file is opened — the same constraint as the existingrequireUnambiguousIdentities, and for the same reason: an exception escaping the parallel batch build would be flattened into a boolean by the worker's catch-all, and one escaping the region at all isstd::terminate. Wired into bothexportToArrowandexportToParquetStreaming.It reuses
IdentifierMSRunMapper::validateMergeIndex, so all three views now apply one implementation of the check rather than three.Review follow-ups (second commit)
An adversarial review of the preflight itself found two defects, both fixed here:
It was over-scoped. It validated every identification attached to a feature, but the row draws all identification-derived values from the winning hit alone — so a feature whose winner resolves perfectly was refused because a sibling, hitless or simply not selected, lacked an index nobody asks for. It now selects the same identity the row builder does and validates only that.
Duplicate identification-run identifiers were accepted here though the pg exporter refuses them. The mapper's forward map assigns with
operator[], so two runs sharing an identifier leave only the last one's paths and a feature of the first is stamped with a file it never came from — one row, no warning.Placement mattered, and the test caught getting it wrong: the check must sit outside the existing
try/catch, which swallowsException::InvalidValue. That handler exists for the mapper's duplicate-path-list throw, safe to downgrade because the forward map is still complete; a duplicate identifier is the opposite case wearing the same exception type. Inside thetry, the new throw was caught and logged as a warning while the export continued on the very mapping it was meant to reject.Known limitation
The preflight narrows the partial-collection window without closing it. Unassigned identifications do not affect feature rows, but they do reach the PSM export, which validates them and can throw after
quantms.feature.parquetis already on disk. Closing that means validating the whole collection in the caller before the first write, across three TOPP tools — a separate change.Verification
id_merge_index=1exports and resolves torunB.no exception thrown!.ProteomicsLFQ,ProSE,ProteinQuantifier,IsobaricAnalyzer, Arrow/QPX class tests); no reference-file churn.Found by an adversarial review pass over the QPX export surface after #9832; the gap is in code merged earlier, not from that PR. Tracked in #9817.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
Summary by CodeRabbit