Skip to content

[FIX] Guard all-hitless identifications in keep_matching resolution - #10445

Merged
timosachsenberg merged 2 commits into
developfrom
fix/idconflictresolver-keep-matching-all-hitless
Oct 8, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
fix/idconflictresolver-keep-matching-all-hitless

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #10444, limited to the remaining all-hitless case in resolve(..., keep_matching=true).

Change

After selecting the best identification, return if its hit list is empty, before reading getHits()[0]. Both score-ordering comparators prefer an identification with hits whenever one exists, so a hitless winner means that every identification is hitless. No additional scan is needed.

In this case the feature's identifications, their order, and their metadata are preserved; none is moved to the unassigned list. Score-direction selection (peptides[0].isHigherScoreBetter()), default resolution, and mixed-input matching are deliberately unchanged.

Regression coverage

Extend IDConflictResolverAlgorithm_test with 12 cases covering FeatureMap and ConsensusMap, both score directions, and zero, one, or three hitless identifications. Assert that the identification list remains equal to the input, including metadata, and that the pre-existing unassigned list is preserved (accounting for the existing feature_id = "not mapped" annotation).

Validation

  • Locally compiled an isolated C++23 harness using the resolver/comparator bodies extracted from the changed source, with lightweight stand-in data types. This is not an OpenMS library build.
  • GCC 14.2, -Wall -Wextra -Werror -pedantic, libstdc++ bounds assertions, AddressSanitizer and UndefinedBehaviorSanitizer: 112 cases / 716 assertions passed (12 new empty/all-hitless cases, the 4 existing mixed-input cases, and 96 matching/permutation cases).
  • Without the guard, one and three hitless identifications abort at the vector bounds assertion in both score directions; with the guard those reproductions pass.
  • Checked the upstream source/test blob hashes before editing and verified that the published diff contains only the guard and the regression section. The standalone harness is not committed.

Draft pending a real OpenMS build and class-test run. This sandbox cannot resolve github.com for a clone and has no existing OpenMS build/SDK, so I could not run the actual project test locally. Required integration validation:

cmake --build OpenMS-build --target IDConflictResolverAlgorithm_test -j2
ctest --test-dir OpenMS-build -R '^IDConflictResolverAlgorithm_test$' --output-on-failure

Release note: IDConflictResolverAlgorithm::resolve(..., true) no longer accesses a missing first hit when all identifications attached to a feature are hitless.

Summary by CodeRabbit

  • Bug Fixes
    • When matching identifications are retained, features whose attached identifications have no hits now keep those identifications and their metadata unchanged. This applies across score directions and preserves any existing unassigned identifications.
  • Documentation
    • Clarified that an identification without hits does not necessarily represent an identified peptide, and documented how these identifications are handled.

Return before accessing the winning hit when every identification is
hitless. Preserve those identifications and their metadata without
moving them to the unassigned list. Leave score-direction selection
and default resolution unchanged.

Add regression coverage for FeatureMap and ConsensusMap, both score
directions, and zero, one or several hitless identifications.

Follow-up to #10444.
@timosachsenberg
timosachsenberg marked this pull request as ready for review October 8, 2026 12:40
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0e74ed5b-8ed0-4d2a-bc30-18c2055cb63f
📥 Commits

Reviewing files that changed from the base of the PR and between 50f4b61 and ad62524.

📒 Files selected for processing (3)
  • src/openms/include/OpenMS/ANALYSIS/ID/IDConflictResolverAlgorithm.h
  • src/openms/source/ANALYSIS/ID/IDConflictResolverAlgorithm.cpp
  • src/tests/class_tests/openms/source/IDConflictResolverAlgorithm_test.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

When the selected winner has no hits, the resolver now preserves the feature’s identifications instead of filtering them. The API documentation describes this behavior, and tests cover both map types and score directions.

Changes

Hitless Identification Handling

Layer / File(s) Summary
Preserve hitless identifications
src/openms/include/OpenMS/ANALYSIS/ID/IDConflictResolverAlgorithm.h, src/openms/source/ANALYSIS/ID/IDConflictResolverAlgorithm.cpp, src/tests/class_tests/openms/source/IDConflictResolverAlgorithm_test.cpp
The resolver returns before filtering when the selected winner has no hits. Documentation describes the behavior. Tests check identification lists and pre-existing unassigned identifications for both map types and score directions.

Priority: ⬇️ Low

Change: Bug fix

Merge Risk: ⚪ Minimal · up to ad625

No actionable issue is identified. Complete the OpenMS build and class test as normal validation before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. 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 and concisely describes the main change: guarding all-hitless identifications during keep_matching resolution.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the hits with care,
No hits? The IDs stay right there.
In order, metadata too,
For each map and score view.
Unassigned IDs remain in place,
The test confirms the case.

Comment @coderabbitai help to get the list of available commands.

@timosachsenberg
timosachsenberg merged commit 03703a7 into develop Oct 8, 2026
40 of 41 checks passed
@timosachsenberg
timosachsenberg deleted the fix/idconflictresolver-keep-matching-all-hitless branch October 8, 2026 13:59
timosachsenberg pushed a commit that referenced this pull request Oct 13, 2026
…ow) into the branch

Brings in refactor/identificationdata-value-model at 102fa59: develop up to
dac9590 and the cherry-picked model commits, which this branch already had.
Conflicts keep this branch's later edits (adapter helpers, query order, molecule
key, model functions and their tests) together with the PR's own changes (the
missing-run message of ProteinRunReferences, DigestedOligo::addEvidence). The
format writers run develop's run check on their peptide-identification view.

Ports of develop changes to code that this branch moved to identification data:
- #10445 (keep_matching with only hitless identifications): the resolution on
  identification data keeps all identifications of a feature when none has a
  match, instead of keeping one and making the others unassigned. Develop's
  test gets the protein run that every identification needs here.
- #10453 (FeatureOverlapFilter::mergeCoincidentFeatures, used by ProteomicsLFQ
  on maps with identification data): the links of merged features move to the
  kept feature, so their identifications do not become unassigned; removal
  goes through FeatureMap::eraseFeatures(). New test section.
- PeptideAndProteinQuant_test: develop's dotted-file-name section adds the
  search run, as the other sections do.
- IDConflictResolver_3_output.consensusXML: develop's file with this branch's
  order of the unassigned identifications (the same 17-line move as before; a
  permutation of develop's file, checked line by line).

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