refactor(core): move provider config and matchers to core#16
Open
sammiee5311 wants to merge 2 commits into
Open
refactor(core): move provider config and matchers to core#16sammiee5311 wants to merge 2 commits into
sammiee5311 wants to merge 2 commits into
Conversation
Move the provider system as a self-contained subsystem into
honeybeepf-llm-core:
honeybeepf-llm/src/probes/builtin/llm/http/providers/{config,usage,request,mod}.rs
-> honeybeepf-llm-core/src/providers/{config,usage,request,mod}.rs
The whole subsystem is pure logic — config structs, JSON-driven matchers,
and request text extractors — with no external dependencies beyond serde
and serde_json (already in workspace.dependencies).
Tests are moved out of the source files into core/tests/:
- tests/providers_config.rs (3 tests)
- tests/providers_usage.rs (4 tests)
- tests/providers_request.rs (4 tests, refactored to use the public
get_extractor() factory rather than constructing private extractor
structs directly — keeps API surface clean)
Update http/protocol.rs to import ConfigurableProvider and
ProviderRegistry from honeybeepf-llm-core::providers, and remove the
local providers module wiring from http/mod.rs.
After this PR, core has 12 tests (1 byte_utils + 11 providers) and the
main agent's lib tests drop to 6 (settings + telemetry only, both of
which depend on infrastructure and stay in the main crate).
Refs #12
Add a module-level doc comment to tests/providers_request.rs explaining why the tests dispatch through get_extractor() instead of the private extractor structs. Add a test for RequestExtractorType::None — both the original inline tests and the integration tests so far skipped this branch, leaving the factory's None match arm uncovered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 Pull Request
Summary
PR 2 of 4 toward #12. Moves the provider subsystem into
honeybeepf-llm-core.http/providers/{config,usage,request,mod}.rs→core/src/providers/http/protocol.rsto importConfigurableProvider/ProviderRegistryfromhoneybeepf_llm_core::providers; drop the now-emptypub mod providers;fromhttp/mod.rs#[cfg(test)]blocks out of source intocore/tests/providers_{config,usage,request}.rsrequest.rstests to dispatch through the existingget_extractor(&type)factory instead of the privateMessagesExtractor/ContentsExtractor/PromptExtractor/NoOpExtractorstructs — keeps those four structs private and only exposes one factoryRequestExtractorType::NonearmAdditional Notes
The factory-based test rewrite costs one small API surface bump:
get_extractoris now re-exported throughproviders::*(it was alreadypub fninrequest.rs, just not surfaced at the parent module). The alternative was to promote four private structs topub. The factory is also genuinely useful as a public API for downstream code that wants dynamic dispatch from aRequestExtractorTypevalue. A module-level doc comment intests/providers_request.rsrecords this reasoning.Test count:
core1 → 13 (+12),honeybeepf-llmlib 17 → 6 (-11). Net +1 from the newNoOptest.AI Assistance Disclosure
Used an AI assistant for navigating the existing module structure, drafting the new test files, and proofreading the PR description. All code was reviewed line-by-line and rebuilt/retested locally before pushing.
By submitting this PR, I confirm that:
Assisted-by:/Co-developed-by:or similar commit trailers credit an AI.Tests
cargo build -p honeybeepf-llm-corecleancargo build -p honeybeepf-llmclean (full agent + eBPF build)cargo test -p honeybeepf-llm-core— 13/13 passcargo test -p honeybeepf-llm --lib— 6/6 passcargo clippy -p honeybeepf-llm-core --all-targets -- -D warningscleancargo fmt --all -- --checkcleansuper::providers/http::providersimportsUp next: PR 3 (HTTP protocol parser) and PR 4 (stream processor + closes #12).
Refs #12