Skip to content

Improve error messages for missing OpenMS data files - #9650

Merged
timosachsenberg merged 2 commits into
developfrom
claude/kind-bohr-yy86vq
Jun 23, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
claude/kind-bohr-yy86vq

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Enhances error reporting when OpenMS shared-data files cannot be found by including diagnostic information about the resolved data path and its source. This addresses issue #9636 where users with stale or misconfigured OPENMS_DATA_PATH environment variables receive unclear error messages.

Changes

  1. Enhanced FileNotFound exception: Added optional additional_message parameter to Exception::FileNotFound to allow context-specific error details.

  2. Refactored data path resolution:

    • Introduced OpenMSDataPath_ struct to bundle the resolved path with a human-readable source description
    • Created resolveOpenMSDataPath_() to centralize thread-safe resolution logic
    • Added getOpenMSDataPathSource_() to expose where the data path was resolved from
  3. Improved File::find() error messages: When a file is not found, the exception now includes:

    • The resolved OpenMS data directory path
    • Where it was resolved from (environment variable, compiled-in path, executable-relative, or bundle path)
    • Guidance on setting/unsetting OPENMS_DATA_PATH
  4. Better source descriptions: Updated all data path source labels to be more user-friendly and descriptive (e.g., "the OPENMS_DATA_PATH environment variable" instead of "OPENMS_DATA_PATH (environment)").

  5. Added test coverage: New test case verifies that missing file errors include both the resolved data path and mention of OPENMS_DATA_PATH.

Motivation

Users encountering missing standard data files (e.g., CHEMISTRY/custom_mods.xml) now receive actionable diagnostic information instead of a generic "file not found" error, making it easier to troubleshoot installation or configuration issues.

Checklist

  • Changes documented in CHANGELOG
  • Unit tests added and pass locally
  • No python bindings changes needed (internal utility functions)

https://claude.ai/code/session_01FsXevqRdFSsxxvMtvWPftZ

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error diagnostics for missing shared-data files. When files cannot be found, error messages now include the resolved OpenMS data directory path and a description of where it was sourced from, helping diagnose stale configuration or leftover installations.
    • Updated File::find to provide more targeted hints when standard shared-data files are missing.
  • Tests
    • Added coverage to verify the improved exception message includes OPENMS_DATA_PATH details.

When a standard share/OpenMS file (e.g. CHEMISTRY/custom_mods.xml) cannot be
located, File::find now throws a FileNotFound whose message also names the
resolved OpenMS data directory and where it was resolved from (the
OPENMS_DATA_PATH environment variable vs. a compiled-in / executable-relative
path). This makes the common root cause -- a stale OPENMS_DATA_PATH or a
leftover older OpenMS installation that contains unimod.xml but not the
requested file -- immediately diagnosable instead of a bare "could not be
found" abort.

- FileNotFound gains an optional additional_message argument (defaulted, so all
  existing 4-arg call sites and their exact-message tests are unaffected).
- getOpenMSDataPath() resolution is refactored to also cache a human-readable
  source description, exposed via the private getOpenMSDataPathSource_().
- Adds a File_test assertion that a missing data file's message mentions the
  data path and OPENMS_DATA_PATH.

Refs #9636

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FsXevqRdFSsxxvMtvWPftZ
@github-actions

Copy link
Copy Markdown
Contributor

@timosachsenberg The following names might be missing from the AUTHORS file:

  • Claude

Please consider applying the following patch:

--- AUTHORS	2026-06-23 08:10:36.040385172 +0000
+++ AUTHORS.new	2026-06-23 08:10:41.306368078 +0000
@@ -25,6 +25,7 @@
  - Chris Bielow
  - Christian Ehrlich
  - Christie Mathews
+ - Claude
  - Clemens Groepl
  - Cornelia Friedle
  - Daniel Jameson

@coderabbitai

coderabbitai Bot commented Jun 23, 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: 686e6e9d-4cce-42f9-9dac-f23b30c3eb42

📥 Commits

Reviewing files that changed from the base of the PR and between 9851ac4 and fc0ee13.

📒 Files selected for processing (1)
  • src/openms/include/OpenMS/CONCEPT/Exception.h
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/openms/include/OpenMS/CONCEPT/Exception.h

📝 Walkthrough

Walkthrough

FileNotFound gains an optional additional_message constructor parameter. File introduces an OpenMSDataPath_ struct and a resolveOpenMSDataPath_() helper that returns both the resolved data path and its source label. File::find now passes a diagnostic hint—reporting the resolved OPENMS_DATA_PATH and its source—when a shared-data file cannot be located.

Changes

File::find diagnostic hints for missing shared-data files

Layer / File(s) Summary
FileNotFound optional additional_message
src/openms/include/OpenMS/CONCEPT/Exception.h, src/openms/source/CONCEPT/Exception.cpp
FileNotFound constructor adds an optional additional_message parameter; when non-empty it is appended to the stored message with a ". " separator.
OpenMSDataPath_ struct and resolver refactoring
src/openms/include/OpenMS/SYSTEM/File.h, src/openms/source/SYSTEM/File.cpp
A new private OpenMSDataPath_ struct bundles a resolved path and source label. resolveOpenMSDataPath_() replaces the previous inline logic and is called by getOpenMSDataPath() and getOpenMSDataPathSource_(). Source labels are updated for each probe (env var, compiled-in install, macro, app bundle, executable-relative).
File::find hint, tests, and changelog
src/openms/source/SYSTEM/File.cpp, src/tests/class_tests/openms/source/File_test.cpp, CHANGELOG
File::find passes a hint string (containing getOpenMSDataPath() and getOpenMSDataPathSource_()) as additional_message when throwing FileNotFound. A new test verifies the exception message contains both OPENMS_DATA_PATH and the resolved path. The changelog documents the improvement.

🐇 When the data file hides away,
now the error has something to say—
"Look here, dear dev,
the path is resolved,
no more guessing to ruin your day!" 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% 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 'Improve error messages for missing OpenMS data files' accurately captures the main objective of the PR—enhancing error reporting when shared-data files cannot be found.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/kind-bohr-yy86vq

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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 added '@PARAM additional_message' made Doxygen require docs for ALL
parameters of the FileNotFound constructor (file/line/function/filename),
emitting a warning that Doxygen_Warning_test treats as a failure. The sibling
exception constructors here document none of their (boilerplate) parameters,
so demote the note to a plain // comment for consistency.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FsXevqRdFSsxxvMtvWPftZ
@timosachsenberg
timosachsenberg merged commit f739175 into develop Jun 23, 2026
41 checks passed
@timosachsenberg
timosachsenberg deleted the claude/kind-bohr-yy86vq branch June 23, 2026 11:04
timosachsenberg added a commit that referenced this pull request Jun 24, 2026
…9650, #9651 (#9652)

- Add PR reference (#9650) to the error-message improvement entry (was issue #9636 only)
- Add PR reference (#9642) to ProSE end-of-search report entry
- Add PR reference (#9643) to PSMFeatureExtractor andes support entry
- Add PR reference (#9649) to UniPEFF new-tool entry
- Add Build System entry for #9648: Boost.Spirit → charconv, 30-40% faster build
- Add Build System entry for #9651: missing <thread> header fix for clang 21+


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

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.

2 participants