Repository navigation
refactor: replace Qt Network with libcurl in core library - #8841
Conversation
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/openms/source/CHEMISTRY/RibonucleotideTSVDataProvider.cpp (1)
143-150:⚠️ Potential issue | 🟡 MinorStrip optional UTF-8 BOM before header matching.
If the first line starts with a BOM, the header check at Line 149 can fail even for valid TSV files.
💡 Proposed fix
String line; std::getline(file, line); + static const String utf8_bom("\xEF\xBB\xBF"); + if (line.hasPrefix(utf8_bom)) + { + line.erase(0, utf8_bom.size()); + } while (!line.empty() && line[0] == '#') // skip leading comments🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/CHEMISTRY/RibonucleotideTSVDataProvider.cpp` around lines 143 - 150, The header check can fail if the first line contains a UTF-8 BOM; before calling hasPrefix(header) on the read line (the variable named "line" used in RibonucleotideTSVDataProvider.cpp), detect and remove a leading UTF-8 BOM ("\xEF\xBB\xBF") from line so the header comparison uses the real text; modify the code right after the initial std::getline(file, line) (and after skipping '#' comments) to strip that BOM (or call an equivalent String::removePrefix or erase when line starts with the BOM) so hasPrefix(header) works correctly.
🧹 Nitpick comments (7)
src/openms/source/SYSTEM/CurlInit.cpp (1)
21-24: Consider checkingcurl_global_initreturn value.
curl_global_initreturns aCURLcodeindicating success or failure. While initialization failures are rare, logging a warning on failure would aid debugging in edge cases.♻️ Optional: Add error logging
CurlInit::CurlInit() { - curl_global_init(CURL_GLOBAL_DEFAULT); + CURLcode res = curl_global_init(CURL_GLOBAL_DEFAULT); + if (res != CURLE_OK) + { + // Note: Cannot use OPENMS_LOG_* here as logging may not be initialized + std::cerr << "Warning: curl_global_init failed with code " << res << "\n"; + } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/SYSTEM/CurlInit.cpp` around lines 21 - 24, The constructor CurlInit::CurlInit currently calls curl_global_init(CURL_GLOBAL_DEFAULT) without checking its return; update it to capture the returned CURLcode, check for non-CURLE_OK, and log or handle the failure (e.g., using your project's logging mechanism) so initialization failures are visible; reference curl_global_init, CURLcode, and CURLE_OK when implementing the check and log a warning including the numeric code or text from curl_easy_strerror for diagnostic context.src/openms/source/SYSTEM/File.cpp (2)
945-946: Consider validating download folder exists.If
download_folderis non-empty but doesn't exist, theofstreamwill fail. Adding an early validation would provide a clearer error message.♻️ Optional: Validate folder
+ namespace fs = std::filesystem; std::string folder = download_folder.empty() ? "./" : download_folder; + if (!fs::exists(folder) || !fs::is_directory(folder)) + { + throw Exception::FileNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, + "Download folder does not exist: " + folder); + } std::string filename = folder + "/" + saveFileName_(url);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/SYSTEM/File.cpp` around lines 945 - 946, The code builds a path using download_folder and saveFileName_(url) but does not check that the provided download_folder exists; if it doesn't, ofstream will fail silently. Update the block that sets folder/filename to first validate download_folder when non-empty by using std::filesystem::exists() and, if missing, create it with std::filesystem::create_directories() (or return a clear error), normalize trailing slash before concatenating, and ensure any error is propagated/logged so callers of saveFileName_ and the surrounding file-write logic get a clear message.
912-933: Consider adding a loop limit insaveFileName_.The
whileloop (lines 930-931) could theoretically run indefinitely if something prevents file existence checks from working correctly (e.g., filesystem errors returning false positives). Adding a reasonable limit would make this more robust.♻️ Optional: Add iteration limit
// already exists, don't overwrite int i = 0; - while (fs::exists(basename + "." + std::to_string(i))) + constexpr int max_attempts = 10000; + while (fs::exists(basename + "." + std::to_string(i)) && i < max_attempts) ++i; + if (i >= max_attempts) + { + throw Exception::IOException(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, + "Could not find unique filename for: " + basename); + } return basename + "." + std::to_string(i);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/SYSTEM/File.cpp` around lines 912 - 933, The while loop in saveFileName_ that increments i until a non-existent filename is found can loop indefinitely; add a reasonable iteration cap (e.g., MAX_ATTEMPTS constant) and change the loop to stop when i reaches the cap. If the cap is reached, return a safe fallback (e.g., append a timestamp or throw a clear exception) so callers of saveFileName_ won't hang; update the loop that checks fs::exists(basename + "." + std::to_string(i)) and the return-path accordingly to use MAX_ATTEMPTS and the fallback behavior.src/openms/include/OpenMS/SYSTEM/CurlInit.h (1)
15-17: Add proper Doxygen documentation block.Per coding guidelines, classes should have a
/**@brief... */comment block with required tags. The current///comments are brief but lack the standard format.📝 Suggested Doxygen documentation
- /// Thread-safe RAII guard for curl_global_init / curl_global_cleanup. - /// Call CurlInit::ensure() before using any curl API. + /** + * `@brief` Thread-safe RAII guard for curl_global_init / curl_global_cleanup. + * + * Call CurlInit::ensure() before using any curl API. This uses a static + * local variable to ensure thread-safe, one-time initialization. + * + * `@ingroup` System + */ class CurlInitAs per coding guidelines: "Every class must begin with a Doxygen
/**@brief... */comment block with required tags (@brief,@ingroup, optional@note/@warning)".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/SYSTEM/CurlInit.h` around lines 15 - 17, Add a proper Doxygen comment block for the CurlInit class: replace the current triple-slash lines with a /** `@brief` ... */ block that describes the class as a thread-safe RAII guard for curl_global_init / curl_global_cleanup, include the required `@ingroup` tag (e.g. `@ingroup` SYSTEM or appropriate module group), and optionally add `@note` or `@warning` describing that CurlInit::ensure() must be called before any curl API usage; ensure the block sits immediately above the class CurlInit declaration.src/topp/MascotAdapterOnline.cpp (1)
296-296: Consider usingstd::unique_ptrfor automatic cleanup.The code uses raw
new/deletewith an early return path (line 321) that correctly deletes before returning. However,std::unique_ptrwould provide safer, exception-safe resource management.♻️ Optional: Use smart pointer
- MascotRemoteQuery* mascot_query = new MascotRemoteQuery(); + auto mascot_query = std::make_unique<MascotRemoteQuery>(); // ... usage with mascot_query-> remains the same ... - delete mascot_query; + // No explicit delete needed🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/topp/MascotAdapterOnline.cpp` at line 296, Replace the raw pointer creation of MascotRemoteQuery with a smart pointer: use std::unique_ptr<MascotRemoteQuery> mascot_query = std::make_unique<MascotRemoteQuery>() (and add `#include` <memory>) so ownership is automatic; then remove any explicit delete of mascot_query and let unique_ptr handle cleanup across the normal and early-return paths (including the early-return currently deleting mascot_query), ensuring all uses of mascot_query access the object via the unique_ptr.src/openms/include/OpenMS/SYSTEM/NetworkGetRequest.h (1)
47-48: Make move special members explicit.Copy members are deleted, but move constructor/assignment are not explicitly declared. Please explicitly
= deleteor= defaultthem to align with the Rule-of-0/6 requirement and avoid ambiguity.Proposed change
NetworkGetRequest(const NetworkGetRequest&) = delete; NetworkGetRequest& operator=(const NetworkGetRequest&) = delete; + NetworkGetRequest(NetworkGetRequest&&) = delete; + NetworkGetRequest& operator=(NetworkGetRequest&&) = delete;As per coding guidelines: “Follow the Rule-of-0 (no user-defined special members) or Rule-of-6 (define all of destructor, copy constructor, copy assignment, move constructor, move assignment, or default constructor) for classes”.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/SYSTEM/NetworkGetRequest.h` around lines 47 - 48, The class NetworkGetRequest currently deletes the copy constructor and copy assignment but leaves move constructor and move assignment implicit; explicitly declare the move constructor and move assignment (either = delete or = default) in the NetworkGetRequest declaration to remove ambiguity and follow Rule-of-0/6—for consistency with the deleted copy members, add NetworkGetRequest(NetworkGetRequest&&) = delete; and NetworkGetRequest& operator=(NetworkGetRequest&&) = delete; (or = default if moves are intended).src/openms/source/CHEMISTRY/ModomicsJSONDataProvider.cpp (1)
245-247: Parse directly from stream to avoid an extra full-buffer copy.Line [245]-[247] materializes the whole JSON into a temporary string before parsing. Parsing directly from the file stream is simpler and avoids the extra allocation/copy path.
♻️ Proposed refactor
- std::ostringstream content; - content << file.rdbuf(); - mod_obj = json::parse(content.str()); + mod_obj = json::parse(file);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/CHEMISTRY/ModomicsJSONDataProvider.cpp` around lines 245 - 247, The code currently reads the entire file into a temporary std::ostringstream (content) then calls json::parse(content.str()), causing an extra full-buffer copy; instead parse directly from the file stream into mod_obj to avoid the allocation and copy. Replace the content/parse pattern by using the stream-based parse (e.g., use the JSON library's stream input or operator>> to read directly from the std::ifstream named file into mod_obj), removing the temporary std::ostringstream and references to file.rdbuf().
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@dockerfiles/Dockerfile`:
- Line 38: The library stage is missing the libcurl4 runtime package while
libOpenMS.so is unconditionally linked against CURL::libcurl; update the apt-get
install list in the library stage to include libcurl4 (the runtime package) so
runtime images (library, tools, tools-thirdparty) have the shared library
available for libOpenMS.so; locate the apt-get install block in the Dockerfile's
library stage and add libcurl4 alongside libcurl4-openssl-dev.
In `@src/openms/include/OpenMS/SYSTEM/NetworkGetRequest.h`:
- Around line 19-23: Add the OPENMS_DLLAPI macro to the class declaration for
NetworkGetRequest by placing it before "class NetworkGetRequest" so the entire
class (RTTI/vtable/typeinfo) is exported; update/remove redundant OPENMS_DLLAPI
on the constructor/destructor if desired to avoid duplication, but ensure the
class declaration itself uses OPENMS_DLLAPI to satisfy exported-symbol
visibility requirements.
- Around line 18-45: Add full Doxygen comment blocks for the class
NetworkGetRequest and all its public methods (NetworkGetRequest(),
~NetworkGetRequest(), setUrl, setTimeout, run, getResponse, getResponseBinary,
hasError, getErrorString) using /** `@brief` ... */ for the class and for each
method include `@brief` plus `@param`[in] or `@param`[out] for parameters (e.g.,
setUrl: `@param`[in] url, setTimeout: `@param`[in] seconds), `@return` describing
return values (e.g., getResponse, getResponseBinary, hasError, getErrorString)
and `@throws` where the method may throw; ensure constructors/destructor have
`@brief` and any side effects noted, and follow the project's Doxygen tag
requirements for every public API entry.
In `@src/openms/source/CHEMISTRY/ModomicsJSONDataProvider.cpp`:
- Around line 234-237: The code opens files with std::ifstream using an
OpenMS::String (full_path) which on Windows narrows to the ANSI code page and
breaks non-ASCII paths; replace the direct std::ifstream(file(full_path)) usage
with a filesystem-aware open using std::filesystem::path constructed from a
wide/unicode QString (e.g.
std::filesystem::path(full_path.toQString().toStdWString())) or restore
QFile(full_path.toQString()) to preserve Unicode paths; update the open call in
ModomicsJSONDataProvider (and the analogous places in OBODataProvider and
RibonucleotideTSVDataProvider) to use std::filesystem::path (or QFile) and
remove or correct the misleading comment about std::ifstream reading UTF‑8
paths.
In `@src/openms/source/FORMAT/MascotRemoteQuery.cpp`:
- Around line 293-309: In execQuery(), the multipart body built using boundary_
and query_spectra_ omits the required CRLF before the closing boundary; update
the construction of body (in MascotRemoteQuery::execQuery) to append a "\r\n"
after the query_spectra_ content before adding the final "--" + boundary +
"--\r\n" delimiter so the multipart format matches the login() implementation
and complies with RFC 2046.
In `@src/openms/source/SYSTEM/NetworkGetRequest.cpp`:
- Around line 37-40: Normalize negative timeout values in
NetworkGetRequest::setTimeout by clamping seconds to a non‑negative value (e.g.
if seconds < 0 then timeout_ = 0) instead of accepting negatives; also update
any checks that currently treat negative timeout_ as “no timeout” to treat
timeout_ == 0 as the “no timeout” sentinel (adjust the code that reads timeout_
during request setup/dispatch accordingly) so callers cannot accidentally
disable timeouts by passing negative values.
In `@src/topp/MascotAdapterOnline.cpp`:
- Around line 141-145: The write to mascot_tmp_file_name using data from
mascot_query (via getMascotXMLResponse()/getMascotXMLDecoyResponse()) lacks
error checking; modify the block that opens std::ofstream ofs and writes data to
verify the stream succeeded and the full byte count was written (check
ofs.is_open(), ofs.fail()/ofs.bad() or use ofs.write then test ofs.good() and/or
ofs.gcount against data.size()), and handle failures by closing the stream and
returning/throwing/logging an appropriate error that includes
mascot_tmp_file_name and the failure reason so upstream parsing won't receive
partial files.
---
Outside diff comments:
In `@src/openms/source/CHEMISTRY/RibonucleotideTSVDataProvider.cpp`:
- Around line 143-150: The header check can fail if the first line contains a
UTF-8 BOM; before calling hasPrefix(header) on the read line (the variable named
"line" used in RibonucleotideTSVDataProvider.cpp), detect and remove a leading
UTF-8 BOM ("\xEF\xBB\xBF") from line so the header comparison uses the real
text; modify the code right after the initial std::getline(file, line) (and
after skipping '#' comments) to strip that BOM (or call an equivalent
String::removePrefix or erase when line starts with the BOM) so
hasPrefix(header) works correctly.
---
Nitpick comments:
In `@src/openms/include/OpenMS/SYSTEM/CurlInit.h`:
- Around line 15-17: Add a proper Doxygen comment block for the CurlInit class:
replace the current triple-slash lines with a /** `@brief` ... */ block that
describes the class as a thread-safe RAII guard for curl_global_init /
curl_global_cleanup, include the required `@ingroup` tag (e.g. `@ingroup` SYSTEM or
appropriate module group), and optionally add `@note` or `@warning` describing that
CurlInit::ensure() must be called before any curl API usage; ensure the block
sits immediately above the class CurlInit declaration.
In `@src/openms/include/OpenMS/SYSTEM/NetworkGetRequest.h`:
- Around line 47-48: The class NetworkGetRequest currently deletes the copy
constructor and copy assignment but leaves move constructor and move assignment
implicit; explicitly declare the move constructor and move assignment (either =
delete or = default) in the NetworkGetRequest declaration to remove ambiguity
and follow Rule-of-0/6—for consistency with the deleted copy members, add
NetworkGetRequest(NetworkGetRequest&&) = delete; and NetworkGetRequest&
operator=(NetworkGetRequest&&) = delete; (or = default if moves are intended).
In `@src/openms/source/CHEMISTRY/ModomicsJSONDataProvider.cpp`:
- Around line 245-247: The code currently reads the entire file into a temporary
std::ostringstream (content) then calls json::parse(content.str()), causing an
extra full-buffer copy; instead parse directly from the file stream into mod_obj
to avoid the allocation and copy. Replace the content/parse pattern by using the
stream-based parse (e.g., use the JSON library's stream input or operator>> to
read directly from the std::ifstream named file into mod_obj), removing the
temporary std::ostringstream and references to file.rdbuf().
In `@src/openms/source/SYSTEM/CurlInit.cpp`:
- Around line 21-24: The constructor CurlInit::CurlInit currently calls
curl_global_init(CURL_GLOBAL_DEFAULT) without checking its return; update it to
capture the returned CURLcode, check for non-CURLE_OK, and log or handle the
failure (e.g., using your project's logging mechanism) so initialization
failures are visible; reference curl_global_init, CURLcode, and CURLE_OK when
implementing the check and log a warning including the numeric code or text from
curl_easy_strerror for diagnostic context.
In `@src/openms/source/SYSTEM/File.cpp`:
- Around line 945-946: The code builds a path using download_folder and
saveFileName_(url) but does not check that the provided download_folder exists;
if it doesn't, ofstream will fail silently. Update the block that sets
folder/filename to first validate download_folder when non-empty by using
std::filesystem::exists() and, if missing, create it with
std::filesystem::create_directories() (or return a clear error), normalize
trailing slash before concatenating, and ensure any error is propagated/logged
so callers of saveFileName_ and the surrounding file-write logic get a clear
message.
- Around line 912-933: The while loop in saveFileName_ that increments i until a
non-existent filename is found can loop indefinitely; add a reasonable iteration
cap (e.g., MAX_ATTEMPTS constant) and change the loop to stop when i reaches the
cap. If the cap is reached, return a safe fallback (e.g., append a timestamp or
throw a clear exception) so callers of saveFileName_ won't hang; update the loop
that checks fs::exists(basename + "." + std::to_string(i)) and the return-path
accordingly to use MAX_ATTEMPTS and the fallback behavior.
In `@src/topp/MascotAdapterOnline.cpp`:
- Line 296: Replace the raw pointer creation of MascotRemoteQuery with a smart
pointer: use std::unique_ptr<MascotRemoteQuery> mascot_query =
std::make_unique<MascotRemoteQuery>() (and add `#include` <memory>) so ownership
is automatic; then remove any explicit delete of mascot_query and let unique_ptr
handle cleanup across the normal and early-return paths (including the
early-return currently deleting mascot_query), ensuring all uses of mascot_query
access the object via the unique_ptr.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 093b2ce3-2249-4dc4-ae40-d58413ad38b9
📒 Files selected for processing (25)
cmake/OpenMSConfig.cmake.incmake/cmake_findExternalLibs.cmakedockerfiles/Dockerfilesrc/openms/CMakeLists.txtsrc/openms/include/OpenMS/FORMAT/MascotRemoteQuery.hsrc/openms/include/OpenMS/FORMAT/sources.cmakesrc/openms/include/OpenMS/SYSTEM/CurlInit.hsrc/openms/include/OpenMS/SYSTEM/NetworkGetRequest.hsrc/openms/include/OpenMS/SYSTEM/sources.cmakesrc/openms/source/CHEMISTRY/ModomicsJSONDataProvider.cppsrc/openms/source/CHEMISTRY/MonosaccharideDB.cppsrc/openms/source/CHEMISTRY/RibonucleotideTSVDataProvider.cppsrc/openms/source/FEATUREFINDER/MultiplexClustering.cppsrc/openms/source/FORMAT/FileHandler.cppsrc/openms/source/FORMAT/InspectOutfile.cppsrc/openms/source/FORMAT/MascotGenericFile.cppsrc/openms/source/FORMAT/MascotRemoteQuery.cppsrc/openms/source/SYSTEM/CurlInit.cppsrc/openms/source/SYSTEM/File.cppsrc/openms/source/SYSTEM/NetworkGetRequest.cppsrc/openms/source/SYSTEM/UpdateCheck.cppsrc/openms/source/SYSTEM/sources.cmakesrc/tests/class_tests/openms/source/MascotRemoteQuery_test.cppsrc/topp/MascotAdapterOnline.cppvcpkg.json
💤 Files with no reviewable changes (2)
- src/openms/source/FEATUREFINDER/MultiplexClustering.cpp
- src/openms/include/OpenMS/FORMAT/sources.cmake
Remove Qt6::Network dependency from the OpenMS core library (libOpenMS), replacing all HTTP operations with synchronous libcurl calls. The GUI library retains Qt6::Network for TOPPASBase and wizard classes. Key changes: - NetworkGetRequest: rewritten as plain C++ class using curl_easy_* - MascotRemoteQuery: async Qt state machine → sequential libcurl flow with automatic cookie management (CURLOPT_COOKIEFILE) and redirect following (CURLOPT_FOLLOWLOCATION) - File::download(), UpdateCheck::run(): removed fake QCoreApplication event loops, now direct synchronous calls - New CurlInit RAII helper for curl_global_init/cleanup - CMake: find_package(CURL REQUIRED) unconditionally, Network moved to GUI-only QT components - Updated Dockerfiles, vcpkg.json, and OpenMSConfig.cmake.in for the new libcurl dependency Co-Authored-By: Claude Opus 4.6 <[email protected]>
Remove all Qt Network usage from the GUI library: - TOPPASBase: remove dead online pipeline repository code (toppasFileDownloaded_, TOPPASreadyRead, downloadTOPPASfromHomepage_, openOnlinePipelineRepository — all were commented out / non-functional since the Qt5→Qt6 migration) - SwathWizardBase.h, FLASHDeconvWizardBase.h: remove unused QtNetwork includes and QNetworkAccessManager forward declarations - Remove Network from GUI Qt components in CMake Qt6::Network is now completely eliminated from the entire codebase. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Points to contrib feature/add-libcurl-dependency branch which adds libcurl-dev packages to the build Dockerfiles. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Separates network I/O (HTTP downloads) from filesystem utilities so code that only needs File doesn't transitively pull in curl headers/symbols. Co-Authored-By: Claude Opus 4.6 <[email protected]>
f15e339 to
cbbb5ab
Compare
- Add libcurl4 runtime package to Dockerfile library stage - Add OPENMS_DLLAPI to NetworkGetRequest class declaration - Add missing CRLF before final boundary in MascotRemoteQuery::execQuery - Add error checking for file write in MascotAdapterOnline Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/topp/MascotAdapterOnline.cpp (1)
305-330:⚠️ Potential issue | 🟠 Major
MascotRemoteQueryleaks on an early return path.If Line 400 returns
PARSE_ERROR, cleanup at Line 409 is skipped. This leavesmascot_queryleaked.💡 Suggested fix (RAII ownership)
+#include <memory> @@ - MascotRemoteQuery* mascot_query = new MascotRemoteQuery(); + auto mascot_query = std::make_unique<MascotRemoteQuery>(); @@ - mascot_query->setParameters(mascot_query_param); + mascot_query->setParameters(mascot_query_param); @@ - parseMascotResponse_(current_batch, false, mascot_query, prot_id, pep_ids); // targets + parseMascotResponse_(current_batch, false, mascot_query.get(), prot_id, pep_ids); // targets @@ - parseMascotResponse_(current_batch, true, mascot_query, decoy_prot_id, decoy_pep_ids); // decoys + parseMascotResponse_(current_batch, true, mascot_query.get(), decoy_prot_id, decoy_pep_ids); // decoys @@ - // clean up - delete mascot_query;Also applies to: 393-410
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/topp/MascotAdapterOnline.cpp` around lines 305 - 330, The code allocates MascotRemoteQuery with a raw pointer (mascot_query = new MascotRemoteQuery()) but returns early on error paths (e.g., returning PARSE_ERROR or EXTERNAL_PROGRAM_ERROR) without deleting it; replace the raw pointer with RAII ownership (e.g., use a std::unique_ptr<MascotRemoteQuery> mascot_query) or otherwise ensure mascot_query is deleted on every early return; update usages of mascot_query (setParameters, setExportDecoys, setQuerySpectra, run, hasError, getErrorMessage) to work with the smart pointer and remove manual delete calls so no leak remains on any return path.
♻️ Duplicate comments (2)
src/openms/include/OpenMS/SYSTEM/NetworkGetRequest.h (1)
18-45:⚠️ Potential issue | 🟠 MajorPublic API docs still miss required Doxygen blocks.
These
///comments are still incomplete for exported header API. Please use full/** ... */docs with@brief,@param,@return, and@throwson each public method.As per coding guidelines: “Every class must begin with a Doxygen
/**@brief... */comment block...” and “Every public method must include a Doxygen comment with@brief,@param[in/out/in,out] for all parameters,@returnfor return values, and@throwsfor exceptions”.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/SYSTEM/NetworkGetRequest.h` around lines 18 - 45, Add proper Doxygen blocks for the exported class and each public method in NetworkGetRequest: replace the short triple-slash comments with full /** ... */ blocks. For the class (NetworkGetRequest) add a /** `@brief` ... */ class description; for the constructor and destructor add brief blocks; for setUrl(const std::string& url) document `@brief` and `@param`[in] url; for setTimeout(int seconds) document `@brief` and `@param`[in] seconds; for run() document `@brief` and `@throws` for any exceptions or curl errors; for getResponse() document `@brief` and `@return` std::string; for getResponseBinary() document `@brief` and `@return` const std::vector<char>&; for hasError() document `@brief` and `@return` bool; for getErrorString() document `@brief` and `@return` std::string; ensure `@throws` entries mention possible exceptions/errors thrown by underlying libcurl or internal logic, and follow the project’s `@param`[in/out] convention.src/openms/source/SYSTEM/NetworkGetRequest.cpp (1)
37-40:⚠️ Potential issue | 🟡 MinorClamp negative timeout values in
setTimeout.Negative
secondscurrently become “no timeout” due thetimeout_ > 0check, which can mask caller mistakes.Proposed fix
void NetworkGetRequest::setTimeout(int seconds) { - timeout_ = seconds; + timeout_ = (seconds < 0) ? 0 : seconds; }Also applies to: 63-66
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/SYSTEM/NetworkGetRequest.cpp` around lines 37 - 40, The setter NetworkGetRequest::setTimeout currently assigns negative seconds directly to timeout_, which makes negatives behave like "no timeout" due to the later timeout_ > 0 check; change setTimeout to clamp the incoming seconds to a non-negative value (e.g., timeout_ = seconds < 0 ? 0 : seconds or using std::max(0, seconds)) so negative inputs are normalized to 0, and apply the same change to the other setTimeout implementation in this file that uses the same timeout_ member.
🧹 Nitpick comments (5)
src/openms/source/SYSTEM/File.cpp (1)
484-486: Edge case: empty hostname produces double underscore.If the hostname buffer remains empty (on retrieval failure),
hostname_strbecomes"_", resulting in a unique name like"20260305_123456__12345_1"with a double underscore. While the test expects>= 4parts (so it won't fail), code that parses these names by splitting on_might produce unexpected empty segments.The error handling suggested above would allow setting
hostname_str = ""on failure to avoid this.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/SYSTEM/File.cpp` around lines 484 - 486, The hostname handling produces a lone "_" when lookup fails, creating double underscores in the generated name; update the unique-name construction (the code that sets hostname_str and returns now.getDate().remove('-') + "_" + now.getTime().remove(':') + "_" + hostname_str + pid + "_" + (++number)) so that on hostname retrieval failure hostname_str is set to an empty string (""), and ensure any joining logic omits or avoids adding extra "_" when hostname_str is empty so the returned string does not contain consecutive underscores.src/openms/include/OpenMS/SYSTEM/Network.h (1)
16-27: Complete the Doxygen contract for the new public API.The new
Networkclass/method docs are missing the required structured tags (class-level@briefblock and method@param/@throwstags).As per coding guidelines, “Every class must begin with a Doxygen
/**@brief... */comment block...” and “Every public method must include ...@param...@throws...”.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/SYSTEM/Network.h` around lines 16 - 27, Add a Doxygen class-level comment block for Network (/** `@brief` ... */) that succinctly describes its purpose (utility for HTTP/network operations and downloads), and update the downloadFile method's Doxygen to include `@param` url, `@param` download_folder and a `@throws` (or `@throw`) IOException tag describing when/why an exception is thrown; target the class named Network and the static method downloadFile(const std::string& url, const std::string& download_folder) so the new comments satisfy the required structured tags.src/openms/include/OpenMS/SYSTEM/CurlInit.h (1)
15-21: Please add full Doxygen tags forCurlInitandensure().For this new public header API, use a class-level
/**@brief... */block and method tags (@brief, and@throwsif applicable) to meet doc-generation requirements.As per coding guidelines, “Add Doxygen comments for new public methods and classes...” and “Every class must begin with a Doxygen
/**@brief... */comment block...”.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/SYSTEM/CurlInit.h` around lines 15 - 21, Add a Doxygen class comment for CurlInit (/** `@brief` ... */) explaining it is a thread-safe RAII guard for curl_global_init / curl_global_cleanup and that callers should call CurlInit::ensure() before using any curl API; also add a Doxygen comment for the static method ensure() including `@brief` that it initializes libcurl on first use and an `@throws` tag describing the exception type and conditions (e.g., throws std::runtime_error or similar on initialization failure) so the public API is fully documented. Ensure the comments appear in the header adjacent to class CurlInit and method ensure() and follow the existing Doxygen style used in the project.src/openms/source/SYSTEM/Network.cpp (1)
74-75: Prefer'\n'overstd::endlin log streams.
std::endlforces a flush on each call; use newline literals unless immediate flushing is required.As per coding guidelines, “Avoid
std::endl; prefer\nfor better performance (endl flushes the buffer)”.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/SYSTEM/Network.cpp` around lines 74 - 75, Replace the uses of std::endl in the two logging statements that write "Download of 'url' successful." and "Stored as 'filename'." with '\n' to avoid unnecessary flushes; locate the OPENMS_LOG_INFO << "Download of '" << url << "' successful." << endl; and OPENMS_LOG_INFO << "Stored as '" << filename << "'." << endl; calls in Network.cpp (within the download completion path) and change them to use '\n' at the end of each stream insertion.src/openms/include/OpenMS/FORMAT/MascotRemoteQuery.h (1)
54-57: Update Doxygen for the changed public API signatures.
getMascotXMLResponse(),getMascotXMLDecoyResponse(), andrun()changed behavior/signatures in this PR; please add full structured Doxygen tags (@brief,@return,@throwswhere relevant).As per coding guidelines, “Add Doxygen comments for new public methods and classes, and update relevant documentation when modifying existing functionality.”
Also applies to: 71-72
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/FORMAT/MascotRemoteQuery.h` around lines 54 - 57, Update the Doxygen for the changed public API: add structured tags for getMascotXMLResponse(), getMascotXMLDecoyResponse(), and run() — include an `@brief` describing what each method returns/does, an `@return` describing the returned const std::string& (and when it may be empty), and add `@throws` (or `@exception`) entries for any exceptions the methods can raise (e.g., network or parsing errors) and note preconditions like setExportDecoys for getMascotXMLDecoyResponse(); apply these updates to the declarations for getMascotXMLResponse() and getMascotXMLDecoyResponse() (currently shown) and the run() declaration referenced later so the public API docs are complete and consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/openms/source/FORMAT/MascotRemoteQuery.cpp`:
- Around line 521-527: updateMembers_() currently clears mascot_xml_,
mascot_decoy_xml_, and error_message_ but leaves search_identifier_ set; modify
updateMembers_() to also reset search_identifier_ (e.g., clear or set to an
empty/invalid value) when preparing for a new run so stale identifiers aren't
observable if a later run fails before assigning a new value; updateMembers_()
is the function to change and search_identifier_ is the member to reset.
- Around line 264-265: The Content-Type header string in MascotRemoteQuery.cpp
is using a comma before the boundary ("multipart/form-data, boundary=" +
boundary) which is invalid; update the construction of content_type used in the
httpPost calls (the instance where content_type is set and passed to httpPost
for server_path_ + "/cgi/login.pl" and the similar occurrence around the later
httpPost at lines ~308-309) to use a semicolon separator ("multipart/form-data;
boundary=" + boundary) so the header conforms to RFC MIME parameter syntax.
In `@src/openms/source/SYSTEM/File.cpp`:
- Around line 477-484: The hostname retrieval ignores failures from
GetComputerNameA/gethostname and always uses the zeroed hbuf; update the block
that calls GetComputerNameA (on OPENMS_WINDOWSPLATFORM) and gethostname
(otherwise) to check their return values, log an error or warning when they fail
(including the errno/GetLastError where available), and only append the
underscore to hostname_str when a non-empty hostname was successfully obtained;
locate and modify the code around hbuf, GetComputerNameA/gethostname and
hostname_str to implement the checks and logging (use existing logging facility
or a minimal error message) so failures are visible while preserving the
empty-buffer fallback.
In `@src/openms/source/SYSTEM/Network.cpp`:
- Around line 26-45: saveFileName_ currently checks file existence in the
process CWD which can miss collisions in the actual destination
(download_folder) used when writing; update saveFileName_ to accept the
destination folder (or use the existing download_folder) and perform existence
checks and collision suffixing against fs::path(download_folder) / basename (use
fs::path::operator/ to join), generating unique filenames by testing that full
destination path (not just basename) with suffixes before returning the basename
to be used for writing into download_folder.
In `@src/openms/source/SYSTEM/UpdateCheck.cpp`:
- Around line 110-115: The calls to stat and utime use old_stat unguarded;
update the UpdateCheck.cpp logic around stat(version_file_name.c_str(),
&old_stat) to check its return value and handle failure (e.g., log error via the
existing logger and skip touching timestamps or return early) before reading
old_stat.st_atime, and likewise check utime(...)'s return code and log/handle
errors; reference the symbols stat, old_stat, new_times, utime and
version_file_name when making the guard and error-handling changes so you never
read uninitialized old_stat or ignore utime failures.
In `@src/tests/class_tests/openms/source/Network_test.cpp`:
- Around line 30-39: Replace the external GitHub download with a local
deterministic fixture: add a test data file named with the class prefix (e.g.,
Network_README.md) into src/tests/class_tests/libs/data/, construct a file://
URL to that fixture and call Network::downloadFile with it instead of the HTTP
URL, and use the NEW_TMP_FILE("README.md") macro for the output path instead of
File::getTempDirectory(); after download assert File::exists(output_path) and
clean up via the tmp file helper rather than manually removing files. Ensure
references in the test to Network::downloadFile, NEW_TMP_FILE, File::exists (and
the new fixture path) are updated accordingly.
In `@src/topp/MascotAdapterOnline.cpp`:
- Line 173: Replace the throwing call to
std::filesystem::remove(std::string(mascot_tmp_file_name)) with the non-throwing
overload that accepts a std::error_code: build a std::filesystem::path from
mascot_tmp_file_name (or pass it as-is), call std::filesystem::remove(path, ec),
and if ec is set log a warning (do not rethrow) so cleanup failures don't abort
successful parsing; update the cleanup site in MascotAdapterOnline.cpp where
mascot_tmp_file_name is used and ensure the warning includes ec.message() for
diagnostics.
---
Outside diff comments:
In `@src/topp/MascotAdapterOnline.cpp`:
- Around line 305-330: The code allocates MascotRemoteQuery with a raw pointer
(mascot_query = new MascotRemoteQuery()) but returns early on error paths (e.g.,
returning PARSE_ERROR or EXTERNAL_PROGRAM_ERROR) without deleting it; replace
the raw pointer with RAII ownership (e.g., use a
std::unique_ptr<MascotRemoteQuery> mascot_query) or otherwise ensure
mascot_query is deleted on every early return; update usages of mascot_query
(setParameters, setExportDecoys, setQuerySpectra, run, hasError,
getErrorMessage) to work with the smart pointer and remove manual delete calls
so no leak remains on any return path.
---
Duplicate comments:
In `@src/openms/include/OpenMS/SYSTEM/NetworkGetRequest.h`:
- Around line 18-45: Add proper Doxygen blocks for the exported class and each
public method in NetworkGetRequest: replace the short triple-slash comments with
full /** ... */ blocks. For the class (NetworkGetRequest) add a /** `@brief` ...
*/ class description; for the constructor and destructor add brief blocks; for
setUrl(const std::string& url) document `@brief` and `@param`[in] url; for
setTimeout(int seconds) document `@brief` and `@param`[in] seconds; for run()
document `@brief` and `@throws` for any exceptions or curl errors; for getResponse()
document `@brief` and `@return` std::string; for getResponseBinary() document `@brief`
and `@return` const std::vector<char>&; for hasError() document `@brief` and `@return`
bool; for getErrorString() document `@brief` and `@return` std::string; ensure
`@throws` entries mention possible exceptions/errors thrown by underlying libcurl
or internal logic, and follow the project’s `@param`[in/out] convention.
In `@src/openms/source/SYSTEM/NetworkGetRequest.cpp`:
- Around line 37-40: The setter NetworkGetRequest::setTimeout currently assigns
negative seconds directly to timeout_, which makes negatives behave like "no
timeout" due to the later timeout_ > 0 check; change setTimeout to clamp the
incoming seconds to a non-negative value (e.g., timeout_ = seconds < 0 ? 0 :
seconds or using std::max(0, seconds)) so negative inputs are normalized to 0,
and apply the same change to the other setTimeout implementation in this file
that uses the same timeout_ member.
---
Nitpick comments:
In `@src/openms/include/OpenMS/FORMAT/MascotRemoteQuery.h`:
- Around line 54-57: Update the Doxygen for the changed public API: add
structured tags for getMascotXMLResponse(), getMascotXMLDecoyResponse(), and
run() — include an `@brief` describing what each method returns/does, an `@return`
describing the returned const std::string& (and when it may be empty), and add
`@throws` (or `@exception`) entries for any exceptions the methods can raise (e.g.,
network or parsing errors) and note preconditions like setExportDecoys for
getMascotXMLDecoyResponse(); apply these updates to the declarations for
getMascotXMLResponse() and getMascotXMLDecoyResponse() (currently shown) and the
run() declaration referenced later so the public API docs are complete and
consistent.
In `@src/openms/include/OpenMS/SYSTEM/CurlInit.h`:
- Around line 15-21: Add a Doxygen class comment for CurlInit (/** `@brief` ...
*/) explaining it is a thread-safe RAII guard for curl_global_init /
curl_global_cleanup and that callers should call CurlInit::ensure() before using
any curl API; also add a Doxygen comment for the static method ensure()
including `@brief` that it initializes libcurl on first use and an `@throws` tag
describing the exception type and conditions (e.g., throws std::runtime_error or
similar on initialization failure) so the public API is fully documented. Ensure
the comments appear in the header adjacent to class CurlInit and method ensure()
and follow the existing Doxygen style used in the project.
In `@src/openms/include/OpenMS/SYSTEM/Network.h`:
- Around line 16-27: Add a Doxygen class-level comment block for Network (/**
`@brief` ... */) that succinctly describes its purpose (utility for HTTP/network
operations and downloads), and update the downloadFile method's Doxygen to
include `@param` url, `@param` download_folder and a `@throws` (or `@throw`) IOException
tag describing when/why an exception is thrown; target the class named Network
and the static method downloadFile(const std::string& url, const std::string&
download_folder) so the new comments satisfy the required structured tags.
In `@src/openms/source/SYSTEM/File.cpp`:
- Around line 484-486: The hostname handling produces a lone "_" when lookup
fails, creating double underscores in the generated name; update the unique-name
construction (the code that sets hostname_str and returns
now.getDate().remove('-') + "_" + now.getTime().remove(':') + "_" + hostname_str
+ pid + "_" + (++number)) so that on hostname retrieval failure hostname_str is
set to an empty string (""), and ensure any joining logic omits or avoids adding
extra "_" when hostname_str is empty so the returned string does not contain
consecutive underscores.
In `@src/openms/source/SYSTEM/Network.cpp`:
- Around line 74-75: Replace the uses of std::endl in the two logging statements
that write "Download of 'url' successful." and "Stored as 'filename'." with '\n'
to avoid unnecessary flushes; locate the OPENMS_LOG_INFO << "Download of '" <<
url << "' successful." << endl; and OPENMS_LOG_INFO << "Stored as '" << filename
<< "'." << endl; calls in Network.cpp (within the download completion path) and
change them to use '\n' at the end of each stream insertion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bf2c726b-18f4-403a-b37d-fde2c72eac17
📒 Files selected for processing (29)
cmake/OpenMSConfig.cmake.incmake/cmake_findExternalLibs.cmakecontribdockerfiles/Dockerfilesrc/openms/CMakeLists.txtsrc/openms/include/OpenMS/FORMAT/MascotRemoteQuery.hsrc/openms/include/OpenMS/FORMAT/sources.cmakesrc/openms/include/OpenMS/SYSTEM/CurlInit.hsrc/openms/include/OpenMS/SYSTEM/File.hsrc/openms/include/OpenMS/SYSTEM/Network.hsrc/openms/include/OpenMS/SYSTEM/NetworkGetRequest.hsrc/openms/include/OpenMS/SYSTEM/sources.cmakesrc/openms/source/FORMAT/MascotRemoteQuery.cppsrc/openms/source/SYSTEM/CurlInit.cppsrc/openms/source/SYSTEM/File.cppsrc/openms/source/SYSTEM/Network.cppsrc/openms/source/SYSTEM/NetworkGetRequest.cppsrc/openms/source/SYSTEM/UpdateCheck.cppsrc/openms/source/SYSTEM/sources.cmakesrc/openms_gui/include/OpenMS/VISUAL/APPLICATIONS/FLASHDeconvWizardBase.hsrc/openms_gui/include/OpenMS/VISUAL/APPLICATIONS/SwathWizardBase.hsrc/openms_gui/include/OpenMS/VISUAL/APPLICATIONS/TOPPASBase.hsrc/openms_gui/source/VISUAL/APPLICATIONS/TOPPASBase.cppsrc/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/File_test.cppsrc/tests/class_tests/openms/source/MascotRemoteQuery_test.cppsrc/tests/class_tests/openms/source/Network_test.cppsrc/topp/MascotAdapterOnline.cppvcpkg.json
💤 Files with no reviewable changes (7)
- src/openms/include/OpenMS/SYSTEM/File.h
- src/openms_gui/include/OpenMS/VISUAL/APPLICATIONS/TOPPASBase.h
- src/openms_gui/source/VISUAL/APPLICATIONS/TOPPASBase.cpp
- src/tests/class_tests/openms/source/File_test.cpp
- src/openms/include/OpenMS/FORMAT/sources.cmake
- src/openms_gui/include/OpenMS/VISUAL/APPLICATIONS/SwathWizardBase.h
- src/openms_gui/include/OpenMS/VISUAL/APPLICATIONS/FLASHDeconvWizardBase.h
✅ Files skipped from review due to trivial changes (1)
- contrib
🚧 Files skipped from review as they are similar to previous changes (4)
- src/openms/include/OpenMS/SYSTEM/sources.cmake
- dockerfiles/Dockerfile
- vcpkg.json
- src/openms/source/SYSTEM/CurlInit.cpp
- Linux manylinux: add libcurl-devel to yum install (image is stale) - Windows: build libcurl from source with MSVC/Schannel into contrib dir - macOS: no change needed (curl ships with macOS SDK) Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/pyopenms-wheels-cibuildwheel.yml:
- Around line 354-369: The workflow step "Build libcurl from source" currently
downloads curl-8.12.1.tar.gz without verification; update this step to also
download the corresponding .asc PGP signature and verify it with Daniel
Stenberg's release key (fingerprint 27EDEAF22F3ABCEB50DB9A125CC908FDB71E12C2)
before proceeding; import the key into GPG, verify the detached signature (gpg
--verify) against the tarball, fail the job on verification error, and
optionally calculate and compare a pinned SHA256 after successful verification
for CI consistency.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: addb292f-fd5f-457c-8cb9-d062dab15ccf
📒 Files selected for processing (3)
.github/workflows/openms_ci_matrix_full.yml.github/workflows/pyopenms-wheels-cibuildwheel.ymlcontrib
- Add #include <QUrl> to FLASHDeconvWizardBase.cpp and SwathWizardBase.cpp (was previously included transitively via removed Qt Network headers) - Add -DCURL_USE_LIBPSL=OFF to CI curl build steps to avoid missing dep - Update contrib submodule with same libpsl fix Co-Authored-By: Claude Opus 4.6 <[email protected]>
The yum install in CIBW_BEFORE_ALL runs inside the manylinux container, not just the OpenMS build container. pyOpenMS cmake needs curl headers to satisfy find_dependency(CURL) from OpenMSConfig.cmake. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Rebased feature/add-curl-to-contrib onto current contrib master to resolve conflicts with Arrow, libzip, and other recent additions. Co-Authored-By: Claude Opus 4.6 <[email protected]>
- MascotRemoteQuery: fix Content-Type separator comma→semicolon (RFC), reset search_identifier_ in updateMembers_() - File.cpp: check GetComputerNameA/gethostname return values, log on failure, avoid lone underscore in generated names - Network.cpp: saveFileName_ checks file existence in destination folder instead of CWD - UpdateCheck.cpp: guard stat()/utime() return values, log errors - MascotAdapterOnline: non-throwing fs::remove for temp cleanup, replace raw new with unique_ptr to fix memory leak on early returns - Network_test: replace external GitHub URL with local file:// fixture Co-Authored-By: Claude Opus 4.6 <[email protected]>
NEW_TMP_FILE returns just a filename without directory path, so parent_path() returned empty string causing the test to look for the downloaded file in the wrong location. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…s on Windows std::ifstream(std::string) uses the ANSI code page on Windows, which breaks for non-ASCII paths. Using std::filesystem::path enables the wide-string overload on MSVC. Added regression test with UTF-8 path. Co-Authored-By: Claude Opus 4.6 <[email protected]>
📝 WalkthroughWalkthroughReplaces Qt networking with libcurl across core and GUI, adds libcurl as a build dependency (CMake, CI, Docker, vcpkg), introduces CurlInit and Network::downloadFile, converts async Qt requests to synchronous curl calls, updates file I/O to std::filesystem for Windows Unicode paths, and adapts tests. Changes
Sequence Diagram(s)sequenceDiagram
participant App as Application
participant Mascot as MascotRemoteQuery
participant CurlInit as CurlInit
participant Curl as libcurl
participant FS as Filesystem
rect rgba(200,200,255,0.5)
App->>Mascot: instantiate MascotRemoteQuery()
Mascot->>CurlInit: CurlInit::ensure()
end
rect rgba(200,255,200,0.5)
Mascot->>Curl: httpGet/httpPost (set timeout, cookies, SSL, proxy)
Curl-->>Mascot: response bytes / HTTP status
Mascot->>FS: read/write temp files (std::filesystem, std::ofstream)
Mascot-->>App: return results (std::string)
end
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 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: 9
♻️ Duplicate comments (1)
src/tests/class_tests/openms/source/Network_test.cpp (1)
34-43:⚠️ Potential issue | 🟡 MinorUse an isolated temp target and validate the downloaded bytes.
downloadFile()auto-renames on collisions, so writing into the shared temp directory plus an existence-only assertion can pass against a staleNetwork_test_fixture.txtinstead of the file produced by this run. Please use a dedicated temp path here and compare the downloaded content to the fixture.Based on learnings: “Applies to src/tests/class_tests/**/*_test.cpp : Use
NEW_TMP_FILE(filename)macro to create temporary output files in tests; avoid side effects in comparison macros”.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/tests/class_tests/openms/source/Network_test.cpp` around lines 34 - 43, The test uses File::getTempDirectory() and a shared filename ("Network_test_fixture.txt") so stale files can mask failures; replace this with the NEW_TMP_FILE("Network_test_fixture.txt") macro to create an isolated temp path, call Network::downloadFile(url, <NEW_TMP_FILE path>) and then assert the downloaded file exists and validate its bytes by reading the downloaded file and comparing its contents to the expected fixture bytes (instead of only checking File::exists). Update references in the test to use the temp file variable (previously output_file_path) and remove any shared-temp cleanup; keep Network::downloadFile and File::exists calls but add explicit byte-wise content comparison to ensure the downloaded file is from this run.
🧹 Nitpick comments (6)
src/tests/class_tests/openms/source/FileHandler_test.cpp (1)
234-260: Make the UTF-8 temp path unique.This regression test writes to a fixed
openms_täst_テスト/test.txtunder the shared temp directory. Parallel runs, retries after failed cleanup, or stale leftovers can interfere with each other and make the test flaky. Please derive the base path from a unique temp file/dir first, then append the non-ASCII segment you want to exercise.As per coding guidelines, "Use
NEW_TMP_FILE(filename)macro to create temporary output files in tests; avoid side effects in comparison macros."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/tests/class_tests/openms/source/FileHandler_test.cpp` around lines 234 - 260, The test currently creates a fixed UTF-8 directory under File::getTempDirectory() which can clash across parallel runs; change it to derive a unique base temp path (use the NEW_TMP_FILE/NEW_TMP_DIR helper or create a unique tmp path first) and then append the non-ASCII segment (u8"openms_t\u00e4st_\u30c6\u30b9\u30c8") before creating directories and writing the file that is passed to FileHandler::computeFileHash; ensure cleanup targets the unique path and keep the TEST_EQUAL assertion as-is.src/openms/source/SYSTEM/CurlInit.cpp (1)
21-24: Consider checking the return value ofcurl_global_init.
curl_global_init()returns aCURLcodethat indicates success or failure. While failures are rare, ignoring the return value could lead to silent issues if initialization fails (e.g., due to memory allocation failures or SSL initialization problems).🛡️ Proposed defensive check
CurlInit::CurlInit() { - curl_global_init(CURL_GLOBAL_DEFAULT); + CURLcode res = curl_global_init(CURL_GLOBAL_DEFAULT); + if (res != CURLE_OK) + { + // Log but don't throw - curl operations will fail later with clearer errors + std::cerr << "Warning: curl_global_init failed: " << curl_easy_strerror(res) << "\n"; + } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/SYSTEM/CurlInit.cpp` around lines 21 - 24, CurlInit::CurlInit currently ignores the CURLcode returned by curl_global_init; modify the constructor to capture the return value from curl_global_init(CURL_GLOBAL_DEFAULT) and handle non-CURLE_OK results (e.g., log an error via your logging facility and throw a std::runtime_error or set a failure flag) so initialization failures are not silently ignored—ensure the message includes the numeric CURLcode and clear context ("curl_global_init failed") to aid debugging.src/openms/source/SYSTEM/File.cpp (1)
475-498: Well-implemented hostname retrieval with proper error handling.The cross-platform hostname resolution logic is correctly implemented with appropriate error handling and logging. One minor style note: prefer
\noverstd::endlper coding guidelines for performance.📝 Minor style fix
- OPENMS_LOG_WARN << "Warning: GetComputerNameA failed (error " << GetLastError() << ")" << std::endl; + OPENMS_LOG_WARN << "Warning: GetComputerNameA failed (error " << GetLastError() << ")\n"; ... - OPENMS_LOG_WARN << "Warning: gethostname failed (errno " << errno << ")" << std::endl; + OPENMS_LOG_WARN << "Warning: gethostname failed (errno " << errno << ")\n";As per coding guidelines: "Avoid
std::endl; prefer\nfor better performance (endl flushes the buffer)".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/SYSTEM/File.cpp` around lines 475 - 498, Replace the use of std::endl in the warning logs with '\n' to avoid unnecessary flushing; locate the OPENMS_LOG_WARN calls in File.cpp around the hostname retrieval (the branches using GetComputerNameA and gethostname that log "Warning: GetComputerNameA failed (error ...)" and "Warning: gethostname failed (errno ...)") and change their stream terminator from std::endl to '\n' while leaving the rest of the messages intact.src/openms/include/OpenMS/SYSTEM/CurlInit.h (1)
15-27: AddOPENMS_DLLAPIto the class declaration and complete Doxygen documentation.The class-level
OPENMS_DLLAPImacro is missing - it should decorate the class, not just theensure()method. Additionally, the class requires a proper Doxygen block with@briefand@ingrouptags rather than///comments.📝 Proposed fix
- /// Thread-safe RAII guard for curl_global_init / curl_global_cleanup. - /// Call CurlInit::ensure() before using any curl API. - class CurlInit + /** + * `@brief` Thread-safe RAII guard for curl_global_init / curl_global_cleanup. + * + * Call CurlInit::ensure() before using any curl API. + * + * `@ingroup` System + */ + class OPENMS_DLLAPI CurlInit { public: - OPENMS_DLLAPI static void ensure(); + /** + * `@brief` Ensures libcurl is globally initialized (thread-safe, idempotent). + */ + static void ensure();As per coding guidelines: "All exported classes, structs, functions, and variables must include the
OPENMS_DLLAPImacro" and "Every class must begin with a Doxygen/**@brief... */comment block with required tags".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/SYSTEM/CurlInit.h` around lines 15 - 27, Add the OPENMS_DLLAPI macro to the class declaration so the class (not just CurlInit::ensure) is exported, and replace the leading triple-slash comments with a proper Doxygen block (/** ... */) including `@brief` describing the RAII guard for curl_global_init / curl_global_cleanup and an appropriate `@ingroup` tag; keep the existing public static void ensure() and private ctor/dtor/disabled copy/assign as-is (refer to class name CurlInit and method ensure).src/openms/CMakeLists.txt (1)
58-63: Consider movingCURL::libcurlto PRIVATE dependencies.
CURL::libcurlis currently inOPENMS_DEP_LIBRARIES(PUBLIC), but the public API (NetworkGetRequest,Network) exposes onlystd::stringandstd::vector<char>—no libcurl types are visible to consumers. Since curl is purely an internal implementation detail with no symbols in public headers,CURL::libcurlcould be moved toOPENMS_DEP_PRIVATE_LIBRARIESto minimize transitive dependencies for downstream users, consistent with hownlohmann_jsonis deliberately kept PRIVATE.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/CMakeLists.txt` around lines 58 - 63, Move CURL::libcurl from the public dependency list to the private dependency list: remove CURL::libcurl from OPENMS_DEP_LIBRARIES and add it to OPENMS_DEP_PRIVATE_LIBRARIES so curl is not propagated transitively; verify that only internal implementation files use libcurl (e.g. NetworkGetRequest, Network) and that no public headers expose libcurl types before making this change to match the existing treatment of nlohmann_json.src/openms/include/OpenMS/FORMAT/MascotRemoteQuery.h (1)
16-17: Keep the libcurl helpers out of the public header.The public API no longer exposes libcurl, but this header now has to declare
CURLand severalCURL*-based private helpers anyway. Moving those helpers behind the.cppfile or an internal implementation object would keepMascotRemoteQuery.hless coupled to libcurl and easier to evolve.Based on learnings, "This is a deliberate design to minimize transitive dependencies."
Also applies to: 80-102
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/FORMAT/MascotRemoteQuery.h` around lines 16 - 17, The header exposes libcurl details (the typedef void CURL; and several private helpers around lines 80-102) which couples the public API to libcurl; move all CURL-related types and helper functions out of MascotRemoteQuery.h into the .cpp (or an internal implementation class), leaving only an opaque pointer or PIMPL in the public class. Concretely: remove the typedef void CURL; and any functions/property declarations that use CURL* from the header, implement them in MascotRemoteQuery.cpp (or a MascotRemoteQuery::Impl) with the real libcurl includes and definitions, and replace uses in the header with an opaque Impl pointer or forward-declared opaque type so the public header no longer exposes libcurl symbols.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/openms/include/OpenMS/SYSTEM/Network.h`:
- Around line 16-27: The class-level Doxygen for Network needs a proper /**
`@brief` ... */ block and the downloadFile method's comment must be corrected and
expanded: change the description for Network::downloadFile to state it creates a
new file with a numeric suffix if a file with the same name exists (instead of
"continues" the download), and add explicit `@brief`, `@param`[in] url, `@param`[in]
download_folder, `@return` void, and `@throws` IOException tags; ensure the comment
references the static method Network::downloadFile so reviewers can locate it
and keep wording concise and accurate about behavior.
In `@src/openms/source/CHEMISTRY/MonosaccharideDB.cpp`:
- Around line 43-44: The file-open uses a std::filesystem::path constructed from
std::string(full_path), which on Windows treats bytes as the ANSI code page and
breaks UTF-8 paths; change the creation of the filesystem path to use the
UTF-8-aware constructor (e.g., std::filesystem::u8path) and pass that path into
the ifstream instead of constructing path from std::string; apply this change to
the three occurrences that match the pattern where an ifstream is constructed
from std::filesystem::path(std::string(full_path)) in MonosaccharideDB.cpp,
FileHandler.cpp and ModomicsJSONDataProvider.cpp so the code opens non-ASCII
paths correctly on Windows.
In `@src/openms/source/CHEMISTRY/RibonucleotideTSVDataProvider.cpp`:
- Around line 135-136: The current construction of the ifstream using
std::filesystem::path from std::string(full_path) treats the input as the
platform ACP on Windows and will not reliably handle UTF-8. Replace the path
construction so the path is created via std::filesystem::u8path(...) (C++17+)
from the UTF-8 input and open the ifstream with that path; specifically, change
the expression that currently constructs std::ifstream with
std::filesystem::path{std::string(full_path)} to create a std::filesystem::path
using std::filesystem::u8path and use that to open the ifstream.
In `@src/openms/source/FORMAT/MascotRemoteQuery.cpp`:
- Around line 399-404: In MascotRemoteQuery::getResults(), do not silently break
when regex_search(response, match, rx) fails to find the continuation link
(rx/smatch); instead treat it as a hard error and fail the request (e.g., throw
an exception or return an error status) with a clear message including the
unexpected response snippet so the caller does not interpret the HTML
continuation page as a successful XML export; update callers if necessary to
propagate the failure.
- Around line 105-109: The code currently sets CURLOPT_TIMEOUT using to_, which
enforces a hard overall operation cap; replace this with inactivity-based
settings by removing CURLOPT_TIMEOUT and instead call curl_easy_setopt(curl,
CURLOPT_LOW_SPEED_TIME, static_cast<long>(to_)) and curl_easy_setopt(curl,
CURLOPT_LOW_SPEED_LIMIT, 1L) when to_ > 0 so only periods of low transfer rate
trigger a timeout; update the block in MascotRemoteQuery.cpp that references to_
and curl_easy_setopt to use CURLOPT_LOW_SPEED_TIME and CURLOPT_LOW_SPEED_LIMIT
(and remove or avoid setting CURLOPT_TIMEOUT).
- Around line 115-118: The code currently builds server and proxy strings using
simple concatenation in buildUrl() and the proxy setup (proxy_host + ":" +
String(proxy_port)) and removeHostName() strips hosts using substring logic,
which breaks for IPv6 addresses; change these to use curl_url_* APIs
(curl_url_set/curl_url_get) to assemble and normalize URLs and proxies (ensuring
IPv6 hosts are bracketed) or implement a single shared URL-parsing helper that
correctly handles bracketed IPv6 hostnames and ports, then update buildUrl(),
the proxy construction site, and removeHostName() to use that helper so both URL
construction and hostname removal handle IPv6 correctly.
In `@src/openms/source/SYSTEM/Network.cpp`:
- Around line 50-61: In Network::downloadFile the code builds a narrow
std::string filename and passes it to std::ofstream which can fail on Windows
with non-ASCII paths; instead, construct a std::filesystem::path from the folder
and filename (use saveFileName_ to get filename_only and combine:
std::filesystem::path(folder) / filename_only) and pass that path to
std::ofstream with std::ios::binary so the file is opened with correct platform
encoding; no public API changes required.
In `@src/openms/source/SYSTEM/UpdateCheck.cpp`:
- Around line 133-145: The update-check is using plain HTTP and flushes logs
with endl: update the NetworkGetRequest URL in the query.setUrl call (the string
built from "http://openms-update.cs.uni-tuebingen.de/check/" +
tool_version_string) to use HTTPS instead of HTTP, and change the logging
invocation that uses OPENMS_LOG_INFO << "Connecting to REST server successful. "
<< endl; to use a newline character instead (e.g., "\n") so it doesn’t force a
flush; keep the rest of the NetworkGetRequest usage (query.run(),
query.hasError(), query.getResponse()) unchanged.
In `@src/topp/MascotAdapterOnline.cpp`:
- Around line 143-145: The code opens the temporary Mascot response using
std::ofstream with the narrow string mascot_tmp_file_name which breaks on
Windows Unicode paths; change the open calls to construct an
std::filesystem::path from mascot_tmp_file_name before passing to std::ofstream
(and likewise ensure calls into MascotXMLFile::load()/XMLFile::parse_ receive a
std::filesystem::path or are fed the wrapped path) so that the file is
created/parsed using std::filesystem::path(std::string(mascot_tmp_file_name))
instead of the raw string.
---
Duplicate comments:
In `@src/tests/class_tests/openms/source/Network_test.cpp`:
- Around line 34-43: The test uses File::getTempDirectory() and a shared
filename ("Network_test_fixture.txt") so stale files can mask failures; replace
this with the NEW_TMP_FILE("Network_test_fixture.txt") macro to create an
isolated temp path, call Network::downloadFile(url, <NEW_TMP_FILE path>) and
then assert the downloaded file exists and validate its bytes by reading the
downloaded file and comparing its contents to the expected fixture bytes
(instead of only checking File::exists). Update references in the test to use
the temp file variable (previously output_file_path) and remove any shared-temp
cleanup; keep Network::downloadFile and File::exists calls but add explicit
byte-wise content comparison to ensure the downloaded file is from this run.
---
Nitpick comments:
In `@src/openms/CMakeLists.txt`:
- Around line 58-63: Move CURL::libcurl from the public dependency list to the
private dependency list: remove CURL::libcurl from OPENMS_DEP_LIBRARIES and add
it to OPENMS_DEP_PRIVATE_LIBRARIES so curl is not propagated transitively;
verify that only internal implementation files use libcurl (e.g.
NetworkGetRequest, Network) and that no public headers expose libcurl types
before making this change to match the existing treatment of nlohmann_json.
In `@src/openms/include/OpenMS/FORMAT/MascotRemoteQuery.h`:
- Around line 16-17: The header exposes libcurl details (the typedef void CURL;
and several private helpers around lines 80-102) which couples the public API to
libcurl; move all CURL-related types and helper functions out of
MascotRemoteQuery.h into the .cpp (or an internal implementation class), leaving
only an opaque pointer or PIMPL in the public class. Concretely: remove the
typedef void CURL; and any functions/property declarations that use CURL* from
the header, implement them in MascotRemoteQuery.cpp (or a
MascotRemoteQuery::Impl) with the real libcurl includes and definitions, and
replace uses in the header with an opaque Impl pointer or forward-declared
opaque type so the public header no longer exposes libcurl symbols.
In `@src/openms/include/OpenMS/SYSTEM/CurlInit.h`:
- Around line 15-27: Add the OPENMS_DLLAPI macro to the class declaration so the
class (not just CurlInit::ensure) is exported, and replace the leading
triple-slash comments with a proper Doxygen block (/** ... */) including `@brief`
describing the RAII guard for curl_global_init / curl_global_cleanup and an
appropriate `@ingroup` tag; keep the existing public static void ensure() and
private ctor/dtor/disabled copy/assign as-is (refer to class name CurlInit and
method ensure).
In `@src/openms/source/SYSTEM/CurlInit.cpp`:
- Around line 21-24: CurlInit::CurlInit currently ignores the CURLcode returned
by curl_global_init; modify the constructor to capture the return value from
curl_global_init(CURL_GLOBAL_DEFAULT) and handle non-CURLE_OK results (e.g., log
an error via your logging facility and throw a std::runtime_error or set a
failure flag) so initialization failures are not silently ignored—ensure the
message includes the numeric CURLcode and clear context ("curl_global_init
failed") to aid debugging.
In `@src/openms/source/SYSTEM/File.cpp`:
- Around line 475-498: Replace the use of std::endl in the warning logs with
'\n' to avoid unnecessary flushing; locate the OPENMS_LOG_WARN calls in File.cpp
around the hostname retrieval (the branches using GetComputerNameA and
gethostname that log "Warning: GetComputerNameA failed (error ...)" and
"Warning: gethostname failed (errno ...)") and change their stream terminator
from std::endl to '\n' while leaving the rest of the messages intact.
In `@src/tests/class_tests/openms/source/FileHandler_test.cpp`:
- Around line 234-260: The test currently creates a fixed UTF-8 directory under
File::getTempDirectory() which can clash across parallel runs; change it to
derive a unique base temp path (use the NEW_TMP_FILE/NEW_TMP_DIR helper or
create a unique tmp path first) and then append the non-ASCII segment
(u8"openms_t\u00e4st_\u30c6\u30b9\u30c8") before creating directories and
writing the file that is passed to FileHandler::computeFileHash; ensure cleanup
targets the unique path and keep the TEST_EQUAL assertion as-is.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 818bacb7-810e-4057-af52-0cc8207df987
📒 Files selected for processing (39)
.github/workflows/openms_ci_matrix_full.yml.github/workflows/pyopenms-wheels-cibuildwheel.ymlcmake/OpenMSConfig.cmake.incmake/cmake_findExternalLibs.cmakecontribdockerfiles/Dockerfilesrc/openms/CMakeLists.txtsrc/openms/include/OpenMS/FORMAT/MascotRemoteQuery.hsrc/openms/include/OpenMS/FORMAT/sources.cmakesrc/openms/include/OpenMS/SYSTEM/CurlInit.hsrc/openms/include/OpenMS/SYSTEM/File.hsrc/openms/include/OpenMS/SYSTEM/Network.hsrc/openms/include/OpenMS/SYSTEM/NetworkGetRequest.hsrc/openms/include/OpenMS/SYSTEM/sources.cmakesrc/openms/source/CHEMISTRY/ModomicsJSONDataProvider.cppsrc/openms/source/CHEMISTRY/MonosaccharideDB.cppsrc/openms/source/CHEMISTRY/RibonucleotideTSVDataProvider.cppsrc/openms/source/FORMAT/FileHandler.cppsrc/openms/source/FORMAT/MascotRemoteQuery.cppsrc/openms/source/SYSTEM/CurlInit.cppsrc/openms/source/SYSTEM/File.cppsrc/openms/source/SYSTEM/Network.cppsrc/openms/source/SYSTEM/NetworkGetRequest.cppsrc/openms/source/SYSTEM/UpdateCheck.cppsrc/openms/source/SYSTEM/sources.cmakesrc/openms_gui/include/OpenMS/VISUAL/APPLICATIONS/FLASHDeconvWizardBase.hsrc/openms_gui/include/OpenMS/VISUAL/APPLICATIONS/SwathWizardBase.hsrc/openms_gui/include/OpenMS/VISUAL/APPLICATIONS/TOPPASBase.hsrc/openms_gui/source/VISUAL/APPLICATIONS/FLASHDeconvWizardBase.cppsrc/openms_gui/source/VISUAL/APPLICATIONS/SwathWizardBase.cppsrc/openms_gui/source/VISUAL/APPLICATIONS/TOPPASBase.cppsrc/tests/class_tests/openms/data/Network_test_fixture.txtsrc/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/FileHandler_test.cppsrc/tests/class_tests/openms/source/File_test.cppsrc/tests/class_tests/openms/source/MascotRemoteQuery_test.cppsrc/tests/class_tests/openms/source/Network_test.cppsrc/topp/MascotAdapterOnline.cppvcpkg.json
💤 Files with no reviewable changes (7)
- src/openms_gui/include/OpenMS/VISUAL/APPLICATIONS/SwathWizardBase.h
- src/openms/include/OpenMS/SYSTEM/File.h
- src/tests/class_tests/openms/source/File_test.cpp
- src/openms_gui/include/OpenMS/VISUAL/APPLICATIONS/TOPPASBase.h
- src/openms_gui/include/OpenMS/VISUAL/APPLICATIONS/FLASHDeconvWizardBase.h
- src/openms/include/OpenMS/FORMAT/sources.cmake
- src/openms_gui/source/VISUAL/APPLICATIONS/TOPPASBase.cpp
Picks up the master merge and Dockerfile libcurl-dev additions. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…path MSVC's stricter overload resolution cannot implicitly convert OpenMS::String to std::filesystem::path. Wrap in std::string(). Co-Authored-By: Claude Opus 4.6 <[email protected]>
The comment incorrectly said "continues download" when a file collision occurs. The actual behavior creates a new file with a numeric suffix. Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/tests/class_tests/openms/source/FileHandler_test.cpp`:
- Around line 234-259: The UTF-8 regression test is non-deterministic because it
uses a fixed path and only asserts a non-empty hash; update the test to create a
unique temp file using the NEW_TMP_FILE(...) macro (instead of manually
constructing utf8_dir/utf8_file from File::getTempDirectory()) and write "hello"
into that file, then call FileHandler::computeFileHash on the created path and
ASSERT/TEST_EQUAL the result against the known SHA1
"aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d"; still keep the non-ASCII directory
name in the temp filename to exercise UTF-8 paths and ensure cleanup uses the
temp-file utilities.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7eafb3e0-8a93-4042-81df-308e7c022ddf
📒 Files selected for processing (2)
src/openms/include/OpenMS/SYSTEM/Network.hsrc/tests/class_tests/openms/source/FileHandler_test.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
- src/openms/include/OpenMS/SYSTEM/Network.h
| // Regression test: computeFileHash must work with non-ASCII (UTF-8) paths | ||
| { | ||
| namespace fs = std::filesystem; | ||
| // Create a subdirectory with non-ASCII characters (German umlauts, Japanese) | ||
| fs::path utf8_dir = fs::path(std::string(File::getTempDirectory())) / u8"openms_t\u00e4st_\u30c6\u30b9\u30c8"; | ||
| std::error_code ec; | ||
| fs::create_directories(utf8_dir, ec); | ||
| if (!ec) | ||
| { | ||
| // Write a small test file | ||
| fs::path utf8_file = utf8_dir / "test.txt"; | ||
| { | ||
| std::ofstream ofs{utf8_file, std::ios::binary}; | ||
| ofs << "hello"; | ||
| } | ||
| String hash = FileHandler::computeFileHash(utf8_file.string()); | ||
| TEST_EQUAL(hash.empty(), false) // must succeed, not return "" | ||
| // Clean up | ||
| fs::remove(utf8_file, ec); | ||
| fs::remove(utf8_dir, ec); | ||
| } | ||
| else | ||
| { | ||
| // If the OS can't create non-ASCII dirs (unlikely), skip silently | ||
| STATUS("Skipping UTF-8 path test: could not create directory with non-ASCII name") | ||
| } |
There was a problem hiding this comment.
Make the UTF-8 regression test deterministic.
Using a fixed openms_täst_テスト/test.txt path and only asserting “non-empty hash” can pass on a stale file from an earlier run, so this may miss the actual regression. Please give the temp artifact a unique suffix and compare against the known SHA1 of "hello" (aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d) instead.
As per coding guidelines, "Use NEW_TMP_FILE(filename) macro to create temporary output files in tests; avoid side effects in comparison macros".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/tests/class_tests/openms/source/FileHandler_test.cpp` around lines 234 -
259, The UTF-8 regression test is non-deterministic because it uses a fixed path
and only asserts a non-empty hash; update the test to create a unique temp file
using the NEW_TMP_FILE(...) macro (instead of manually constructing
utf8_dir/utf8_file from File::getTempDirectory()) and write "hello" into that
file, then call FileHandler::computeFileHash on the created path and
ASSERT/TEST_EQUAL the result against the known SHA1
"aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d"; still keep the non-ASCII directory
name in the temp filename to exercise UTF-8 paths and ensure cleanup uses the
temp-file utilities.
The test used Japanese characters (テスト) which can't be represented in Windows-1252 (the Active Code Page). When path::string() converts to narrow encoding on Windows, these characters are lost, causing computeFileHash to fail. Use ä and ü instead — they exist in Windows-1252 so the narrow-string round-trip works on all platforms. Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/tests/class_tests/openms/source/FileHandler_test.cpp (1)
234-259:⚠️ Potential issue | 🟡 MinorMake this regression test deterministic.
This still uses a fixed temp path and only checks for a non-empty hash, so it can miss the actual regression and race with parallel runs. Please generate a unique temp file via
NEW_TMP_FILE(...)and assert the exact SHA1 for"hello"(aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d) instead ofhash.empty() == false.As per coding guidelines, "Use
NEW_TMP_FILE(filename)macro to create temporary output files in tests; avoid side effects in comparison macros".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/tests/class_tests/openms/source/FileHandler_test.cpp` around lines 234 - 259, Replace the ad-hoc temp path and non-deterministic assertion with the test helper macro: create the unique temp file via NEW_TMP_FILE(filename) (use that filename inside the nonascii_dir / filename), write "hello" into it, call FileHandler::computeFileHash(...) on the file path as before, and assert the returned hash equals the exact SHA1 "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d" instead of checking hash.empty(); keep the nonascii_dir construction (File::getTempDirectory and u8"openms_t\u00e4st_\u00fc") and clean up via filesystem removal as currently done.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/tests/class_tests/openms/source/FileHandler_test.cpp`:
- Around line 234-259: Replace the ad-hoc temp path and non-deterministic
assertion with the test helper macro: create the unique temp file via
NEW_TMP_FILE(filename) (use that filename inside the nonascii_dir / filename),
write "hello" into it, call FileHandler::computeFileHash(...) on the file path
as before, and assert the returned hash equals the exact SHA1
"aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d" instead of checking hash.empty();
keep the nonascii_dir construction (File::getTempDirectory and
u8"openms_t\u00e4st_\u00fc") and clean up via filesystem removal as currently
done.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f9deb120-ead0-4b98-bb7b-772eb7d5460d
📒 Files selected for processing (1)
src/tests/class_tests/openms/source/FileHandler_test.cpp
OpenMS replaced Qt Network with libcurl in the core library (OpenMS/OpenMS#8841). Add libcurl to host deps and run_exports. Co-Authored-By: Claude Opus 4.6 <[email protected]>
- install-win.doxygen: replace Qt6Networkd.dll example with Qt6Cored.dll; Qt::Network was removed from the core library in #8841 (replaced by libcurl), so non-GUI TOPP tools no longer depend on Qt6Network.dll. Qt6Core.dll is still required by all Qt-dependent executables. - MetaboliteAdductDecharger.cpp + TOPP.doxygen: document new multimer detection capability added in #8888. The max_multimer parameter (default 1, backward-compatible) enables detection of dimers, trimers, etc. (e.g. [M+H]+ <-> [2M+2H]2+). Updated brief description, page description, and TOPP tool listing. Co-authored-by: Copilot <[email protected]>
#8895) - install-win.doxygen: replace Qt6Networkd.dll example with Qt6Cored.dll; Qt::Network was removed from the core library in #8841 (replaced by libcurl), so non-GUI TOPP tools no longer depend on Qt6Network.dll. Qt6Core.dll is still required by all Qt-dependent executables. - MetaboliteAdductDecharger.cpp + TOPP.doxygen: document new multimer detection capability added in #8888. The max_multimer parameter (default 1, backward-compatible) enables detection of dimers, trimers, etc. (e.g. [M+H]+ <-> [2M+2H]2+). Updated brief description, page description, and TOPP tool listing. Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]>
Summary
Qt6::Networkdependency from the OpenMS core library (libOpenMS), replacing all HTTP operations with synchronous libcurl callsTOPPASBase, wizard classes) retainsQt6::NetworkQt Network → libcurl changes
curl_easy_*(no moreQObject, signals/slots,QNetworkAccessManager)CURLOPT_COOKIEFILE) and redirect following (CURLOPT_FOLLOWLOCATION)QCoreApplicationevent loops — now direct synchronous callsMascotRemoteQuery::run()curl_global_init/curl_global_cleanupBuild system / packaging
find_package(CURL REQUIRED)unconditionally;Networkmoved to GUI-only Qt componentsOpenMSConfig.cmake.in: addedfind_dependency(CURL)for downstream consumersvcpkg.json: addedcurldependencylibcurl4-openssl-dev/libcurl-develNetworkGetRequest.handMascotRemoteQuery.hfrom MOC listsVerification
libOpenMS.solinkslibcurl.so.4, has zeroQNetworksymbols, does not linkQt6::NetworkMascotRemoteQuery_testpassesFile_testpassesMascotAdapterOnlineTOPP tool builds successfullyWITH_PARQUET=ONandWITH_PARQUET=OFFNotes
contribsubmodule Dockerfiles also needlibcurl*-devadded (changes prepared locally but need separate contrib repo commit)Test plan
MascotRemoteQuery_testpassesFile_testpassesWITH_PARQUET=OFFsucceedsWITH_PARQUET=ONsucceedsQt6::Network(requiresWITH_GUI=ON)libOpenMS.so🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Improvements
Tests