Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Determine the task type and apply the corresponding format:

- [Critical defaults](guides/critical-defaults.md) - mandatory rules for every
repository task.
- [Git workflow](guides/git-workflow.md) - branch policy, PR-only workflow,
branch naming, and rules for AI agents before editing.
- [Coding agent workflow](.claude/rules/delegation.md) - default workflow for
all file-editing tasks (delegation, model routing, verification).
- [Project overview](guides/project-overview.md) - domain model, public API
Expand All @@ -73,6 +75,7 @@ Determine the task type and apply the corresponding format:

See [guides/critical-defaults.md](guides/critical-defaults.md) for the full
list of mandatory pre-edit, compatibility, testing, and git rules.
For branch and PR policy, also see [guides/git-workflow.md](guides/git-workflow.md).

## Provenance and Honesty

Expand Down
2 changes: 1 addition & 1 deletion guides/critical-defaults.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ Mandatory rules for every repository task.

## Git

- All changes reach `main` through PRs; do not push directly to `main` unless the user explicitly overrides this rule.
See [Git workflow](git-workflow.md) for the full branch and PR policy.
15 changes: 15 additions & 0 deletions include/kurlyk/http/HttpClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,21 @@ namespace kurlyk {
void set_auth_provider(std::shared_ptr<http::auth::IAuthProvider> provider) {
m_auth_provider = provider;
}

/// \brief Removes the current authentication provider from this client.
void clear_auth_provider() {
m_auth_provider.reset();
}

/// \brief Returns whether this client has an active authentication provider.
bool has_auth_provider() const {
return m_auth_provider != nullptr;
}

/// \brief Returns the current authentication provider, or nullptr if none is set.
std::shared_ptr<http::auth::IAuthProvider> auth_provider() const {
return m_auth_provider;
}
#endif

/// \brief Assigns an existing rate limit to future requests by ID.
Expand Down
14 changes: 12 additions & 2 deletions include/kurlyk/http/HttpRequestManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,18 @@ namespace kurlyk {
if (callback) callback();
return;
}
std::lock_guard<std::mutex> lock(m_mutex);
m_groups_to_cancel[group_id].push_back(std::move(callback));
bool invoke_now = false;
{
std::lock_guard<std::mutex> lock(m_mutex);
if (group_request_count_unlocked(group_id) == 0) {
invoke_now = true;
} else {
m_groups_to_cancel[group_id].push_back(std::move(callback));
}
}
if (invoke_now && callback) {
callback();
}
}

/// \brief Processes all requests in the manager.
Expand Down
20 changes: 20 additions & 0 deletions tests/integration/http_client_wait_requests_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,26 @@ int main() {
client.reset();
}

// --- Test 9: wait_requests() on empty group returns immediately ---
{
ProcessorGuard pg;
auto client = std::make_unique<kurlyk::HttpClient>(base_url);
auto t0 = std::chrono::steady_clock::now();
client->wait_requests();
auto dt = std::chrono::steady_clock::now() - t0;
require(dt < std::chrono::milliseconds(50),
"wait_requests() on empty group must return immediately");
client.reset();
}

// --- Test 10: wait_requests_for() on empty group returns true immediately ---
{
auto client = std::make_unique<kurlyk::HttpClient>(base_url);
bool done = client->wait_requests_for(std::chrono::milliseconds(10));
require(done, "wait_requests_for() on empty group must return true immediately");
client.reset();
}

server.stop();
server_thread.join();

Expand Down
Loading