Skip to content

[INTERNAL,TEST] Separate filename recognition from file loading - #10088

Merged
timosachsenberg merged 4 commits into
OpenMS:developfrom
timosachsenberg:architecture/batch-04-filename-utils
Sep 9, 2026
Merged

timosachsenberg merged 4 commits into
OpenMS:developfrom
timosachsenberg:architecture/batch-04-filename-utils

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Implements step 4 of #10083.

File and ProteinIdentification currently depend on the general format dispatcher for filename-only operations. FileNameUtils now owns the four existing filename methods; FileHandler keeps forwarding entry points. File::basename and FileNameUtils share the separator operation in the existing SYSTEM/PathUtils.h.

The moved method bodies retain their existing rules, including compound/compressed suffixes, fid, unknown extensions, and both slash styles. No content detection is changed. The new class test pins representative outputs, including the existing .pep.xml/.prot.xml stripping behavior, and checks the legacy entry points.

The new helper joins the core file set and this resolves the File.cpp -> FileHandler.h edge recorded in #10083. The helper is independent of step 2's dead-include removals.

Validation: exact method-body comparison after qualifier substitutions; standalone compilation and execution of the actual PathUtils header over 4,096 mixed-separator path cases; the #10083 include check reports nine remaining edges; git diff --check passes. FileNameUtils_test, FileHandler_test and File_test are submitted to CI. No local OpenMS build was run. Kept draft pending C++ CI.

Summary by CodeRabbit

  • New Features

    • Added filename utilities for recognizing file formats and managing extensions, including compressed and specialized formats.
    • Added platform-independent path basename handling across slash styles.
    • Preserved existing filename behavior through the established file-handling interfaces.
  • Bug Fixes

    • Improved consistency of filename and extension handling across filesystem and protein-metadata workflows.
  • Tests

    • Added coverage for filename recognition, extension conversion, validation, and cross-platform path handling.

Keep the established filename rules in FileNameUtils and preserve the
FileHandler API as forwarding methods. Share basename handling via PathUtils
and remove format-dispatch dependencies from File and ProteinIdentification.

Part of OpenMS#10083, step 4.
timosachsenberg and others added 2 commits September 8, 2026 22:07
The baseline is recorded in OpenMS#10083; no scanner or CI check is added.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

Maybe worth to consider a registry… but refactoring is fine

@timosachsenberg
timosachsenberg marked this pull request as ready for review September 9, 2026 10:24
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview 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: 66adddbc-2764-49b6-ac55-7b639d204bb0

📥 Commits

Reviewing files that changed from the base of the PR and between d280944 and 506eef9.

📒 Files selected for processing (11)
  • CHANGELOG
  • src/openms/include/OpenMS/FORMAT/FileNameUtils.h
  • src/openms/include/OpenMS/FORMAT/sources.cmake
  • src/openms/include/OpenMS/SYSTEM/PathUtils.h
  • src/openms/source/FORMAT/FileHandler.cpp
  • src/openms/source/FORMAT/FileNameUtils.cpp
  • src/openms/source/FORMAT/sources.cmake
  • src/openms/source/METADATA/ProteinIdentification.cpp
  • src/openms/source/SYSTEM/File.cpp
  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/FileNameUtils_test.cpp

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


📝 Walkthrough

Walkthrough

Changes

Filename utility extraction

Layer / File(s) Summary
Utility contract and implementation
src/openms/include/OpenMS/FORMAT/FileNameUtils.h, src/openms/source/FORMAT/FileNameUtils.cpp, src/openms/include/OpenMS/SYSTEM/PathUtils.h, src/openms/*/FORMAT/sources.cmake
Added filename recognition and extension utilities. Added platform-independent basename handling and build registration.
Caller migration
src/openms/source/FORMAT/FileHandler.cpp, src/openms/source/METADATA/ProteinIdentification.cpp, src/openms/source/SYSTEM/File.cpp
FileHandler delegates to FileNameUtils. Protein metadata and filesystem code use the extracted utilities directly.
Behavior validation and documentation
src/tests/class_tests/openms/source/FileNameUtils_test.cpp, src/tests/class_tests/openms/executables.cmake, CHANGELOG
Added filename and path behavior tests, registered the test executable, and documented the extraction.

Suggested reviewers: cbielow, copilot

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 506ee

Filename handling remains behaviorally consistent while the dependency extraction is covered by targeted tests. No merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 7 files. (4 skipped: 4… 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 summarizes the main change: separating filename recognition from file loading while retaining the relevant scope tags.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 7 files. (4 skipped: 4 unsupported.)

  • Fix all pre-merge checks with AI
✨ 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

A rabbit reads each line,
The patch grows clear beneath the moon,
Small changes hop in place,
Tests guard the garden path,
Reviews bloom before the dawn.

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

@timosachsenberg
timosachsenberg merged commit 37a944e into OpenMS:develop Sep 9, 2026
33 of 34 checks passed
timosachsenberg added a commit that referenced this pull request Sep 9, 2026
…policy (#10098)

Move settings methods into FileConfig.cpp and temporary-directory/registry
implementation into FileTemp.cpp. Keep public definitions and method bodies
unchanged, with core File.cpp free of settings and temp-policy references,
and point File.cpp readers to the sibling sources.

Part of #10083, step 5; follows step 4 (#10088). Supersedes #10089.
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