Conversation
Move `build_gateway_client` out of retriever into a new shared package (dist `evermore-llm`, import `evermore_llm`), so petdata and biowriter can import the one gateway constructor instead of copying it. ADR 0028 consolidated all outbound model traffic onto one gateway and deferred this promotion until `packages/` existed; it does now. Shared code cannot import a service's config, so the package defines a structural `GatewayConfig` Protocol naming the four members the constructor reads. Retriever's `Settings` satisfies it with no change to `Settings`, and mypy strict checks that at the call sites. `GatewayScope` moves to the package and retriever imports it back, leaving one definition rather than two. Zero behavior change: the moved body differs only by the `settings` -> `config` parameter rename. Retriever's gateway and safety tests changed by one import line each, bodies untouched. Closes #93
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.
Extracts
build_gateway_clientout of retriever into a new shared packagepackages/llm(distevermore-llm, importevermore_llm), decoupled from retriever'sSettingsby a structuralGatewayConfigProtocol. ADR 0028 consolidated all outbound model traffic onto one gateway and deferred this promotion untilpackages/existed; it does now.Zero behavior change: the moved body differs from the deleted
services/retriever/src/retriever/infrastructure/llm/gateway_client.pyonly by thesettings->configparameter rename. Theif scope is None:token-resolution branch is byte-identical. Retriever's gateway and safety tests changed by exactly one import line each, bodies untouched (function inventory 9 = 9).GatewayScopemoves to the package and retriever imports it back, leaving one definition rather than two. The scope boundary is documented in ADR 0034 andpackages/llm/README.md: shared model-call infra belongs here; service-specific wiring (provider selection, fallback chains, retry and circuit-breaker policy, DI wiring) stays in the service, and cross-service domain contracts go topackages/schema.On acceptance criterion 3 (petdata and biowriter import the helper): no cross-service copy or cross-import exists to eliminate. petdata makes no gateway calls and carries no
openaidependency; biowriter is not scaffolded as a Python service. Wiring either now would add an unused dependency. Retriever ships as the sole consumer, biowriter wiring is deferred to #64, and the documented boundary is what prevents a future copy.Pipeline phases
base_shaancestral); design pass skipped at complexity score 2Test results
Both commands from
.daedalus/config.json, exit 0.retriever: 385 passed, 10 deselected, coverage 89.44% (floor 80%). stacker: build ✔ done (adapter-cloudflare). TEST_GATE_EXIT=0
retriever: ruff clean, 105 files formatted, mypy strict clean (67 source files). petdata: ruff clean, 56 files formatted, mypy clean (25 source files), bandit clean. stacker: svelte-check 4414 files, 0 errors 0 warnings. LINT_GATE_EXIT=0
Package-local gates (
packages/llm): ruff format clean, ruff check clean,mypy --strict src/clean (2 source files), pytest 10 passed.Mutation testing
Five mutations to
build_gateway_client, each applied then reverted. After strengthening the test fake (review-gate finding), all five are caught by the package suite alone:if scope is None:branchdefault_headersapi_key=token or "unused"placeholderbase_urlValueErrorEval scores
No evals configured in this repo.
Follow-ups
Closes #93