From ceadd2957afcc2719d72b972ba37f7cb2f6996ee Mon Sep 17 00:00:00 2001 From: Dex Date: Wed, 6 May 2026 20:03:21 -0400 Subject: [PATCH] chore: remove dead HuggingFace client scaffolding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Strip queueRequest, processRequestQueue, extractNextPageToken, cancelAll, and cancelRequest — none were connected to live code paths. Also replace the vague CURL destructor TODO with an explanation of the intentional cleanup strategy. --- models/src/models/api/huggingface_client.cpp | 33 ++----------------- models/src/models/api/huggingface_client.h | 10 ------ .../tests/models/test_huggingface_client.cpp | 3 -- 3 files changed, 3 insertions(+), 43 deletions(-) diff --git a/models/src/models/api/huggingface_client.cpp b/models/src/models/api/huggingface_client.cpp index fdeb162..405d248 100644 --- a/models/src/models/api/huggingface_client.cpp +++ b/models/src/models/api/huggingface_client.cpp @@ -53,9 +53,8 @@ class CurlHttpClient : public HttpInterface { } ~CurlHttpClient() { - // Don't call curl_global_cleanup() here as other instances or threads might still be using CURL - // CURL cleanup should happen at program exit - // TODO: Implement proper cleanup strategy + // curl_global_cleanup() is intentionally omitted — other threads may still hold CURL handles. + // CURL global state is cleaned up at process exit by the OS. } void requestAsync( @@ -149,16 +148,6 @@ class CurlHttpClient : public HttpInterface { return response; } - void cancelAll() override { - // TODO: Implement cancellation - } - - bool cancelRequest(const std::string& url) override { - (void)url; - // TODO: Implement specific request cancellation - return false; - } - // C-style callback for CURL write function static size_t curlWriteCallback(void* contents, size_t size, size_t nmemb, void* userp) { size_t realsize = size * nmemb; @@ -896,12 +885,6 @@ std::vector HuggingFaceClient::parseFilesResponse(const std::string& j return files; } -std::string HuggingFaceClient::extractNextPageToken(const std::map& headers) { - (void)headers; - // TODO: Implement next page token extraction from headers - return ""; -} - // Error handling void HuggingFaceClient::handleHttpError(int statusCode, const std::string& error, const std::string& endpoint) { m_lastError = "HTTP " + std::to_string(statusCode) + ": " + error; @@ -910,17 +893,7 @@ void HuggingFaceClient::handleHttpError(int statusCode, const std::string& error } } -// Request management -void HuggingFaceClient::queueRequest(const http::HttpRequest& request) { - m_requestQueue.push(request); - processRequestQueue(); -} - -void HuggingFaceClient::processRequestQueue() { - // TODO: Implement rate limiting and queue processing -} - -// Download management methods (placeholder implementations) +// Download management methods void HuggingFaceClient::sortFilesBySize(std::vector& files) { std::sort(files.begin(), files.end(), [](const FileDownloadRequest& a, const FileDownloadRequest& b) { diff --git a/models/src/models/api/huggingface_client.h b/models/src/models/api/huggingface_client.h index bcfd7e1..70acd2f 100644 --- a/models/src/models/api/huggingface_client.h +++ b/models/src/models/api/huggingface_client.h @@ -69,9 +69,6 @@ namespace http { virtual HttpResponse requestSyncWithProgress(const HttpRequest& request, ProgressCallback progress) = 0; - // Cancel operations - virtual void cancelAll() = 0; - virtual bool cancelRequest(const std::string& url) = 0; }; // Factory functions @@ -203,7 +200,6 @@ class HuggingFaceClient { // HTTP client management std::unique_ptr m_httpClient; - std::queue m_requestQueue; std::unordered_map m_activeRequests; // request_id -> endpoint mapping // Configuration @@ -240,15 +236,9 @@ class HuggingFaceClient { std::vector parseSearchResponse(const std::string& jsonData); ModelInfo parseModelInfo(const std::string& jsonData); std::vector parseFilesResponse(const std::string& jsonData); - std::string extractNextPageToken(const std::map& headers); - // Error handling void handleHttpError(int statusCode, const std::string& error, const std::string& endpoint); - // Request management - void queueRequest(const http::HttpRequest& request); - void processRequestQueue(); - // Download management methods (merged from ModelDownloader) void sortFilesBySize(std::vector& files); void startNextDownloads(const std::string& modelDownloadId); diff --git a/models/tests/models/test_huggingface_client.cpp b/models/tests/models/test_huggingface_client.cpp index ac93571..adb4eda 100644 --- a/models/tests/models/test_huggingface_client.cpp +++ b/models/tests/models/test_huggingface_client.cpp @@ -63,9 +63,6 @@ class MockHttpClient : public http::HttpInterface { return requestSync(request); } - void cancelAll() override {} - bool cancelRequest(const std::string& url) override { (void)url; return false; } - void setNextResponse(int statusCode, const std::string& data, const std::string& error = "") { nextResponse.statusCode = statusCode; nextResponse.data = data;