Skip to content

refactor(core): move provider config and matchers to core#16

Open
sammiee5311 wants to merge 2 commits into
mainfrom
refactor/core-providers
Open

refactor(core): move provider config and matchers to core#16
sammiee5311 wants to merge 2 commits into
mainfrom
refactor/core-providers

Conversation

@sammiee5311

@sammiee5311 sammiee5311 commented May 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Pull Request

Summary

PR 2 of 4 toward #12. Moves the provider subsystem into honeybeepf-llm-core.

  • Move http/providers/{config,usage,request,mod}.rscore/src/providers/
  • Update http/protocol.rs to import ConfigurableProvider / ProviderRegistry from honeybeepf_llm_core::providers; drop the now-empty pub mod providers; from http/mod.rs
  • Move inline #[cfg(test)] blocks out of source into core/tests/providers_{config,usage,request}.rs
  • Rewrite request.rs tests to dispatch through the existing get_extractor(&type) factory instead of the private MessagesExtractor / ContentsExtractor / PromptExtractor / NoOpExtractor structs — keeps those four structs private and only exposes one factory
  • Cover the previously-untested RequestExtractorType::None arm

Additional Notes

The factory-based test rewrite costs one small API surface bump: get_extractor is now re-exported through providers::* (it was already pub fn in request.rs, just not surfaced at the parent module). The alternative was to promote four private structs to pub. The factory is also genuinely useful as a public API for downstream code that wants dynamic dispatch from a RequestExtractorType value. A module-level doc comment in tests/providers_request.rs records this reasoning.

Test count: core 1 → 13 (+12), honeybeepf-llm lib 17 → 6 (-11). Net +1 from the new NoOp test.

AI Assistance Disclosure

  • No AI tools were used in preparing this PR.
  • AI tools were used. Briefly describe what was AI-assisted:
    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:

  • I have reviewed and understand every change in this PR.
  • No AI is listed as a co-author, and no Assisted-by: / Co-developed-by: or similar commit trailers credit an AI.
  • I will respond to review comments directly, without relying on AI tools.

Tests

  • cargo build -p honeybeepf-llm-core clean
  • cargo build -p honeybeepf-llm clean (full agent + eBPF build)
  • cargo test -p honeybeepf-llm-core — 13/13 pass
  • cargo test -p honeybeepf-llm --lib — 6/6 pass
  • cargo clippy -p honeybeepf-llm-core --all-targets -- -D warnings clean
  • cargo fmt --all -- --check clean
  • No leftover super::providers / http::providers imports

Up next: PR 3 (HTTP protocol parser) and PR 4 (stream processor + closes #12).

Refs #12

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: extract core analysis logic into separate crate for testability

1 participant