feat(worker-search): per-task search allowlist + fetch chain override (Phase 3 #38)#273
Merged
charlie83Gs merged 2 commits intomainfrom Apr 20, 2026
Merged
Conversation
… (Phase 3 #38) ``ProviderRegistry.search_all`` and ``FetchProviderRegistry.fetch_many`` now accept per-call ``allowlist`` / ``chain`` overrides. ``web_search`` resolves the running graph's ``GraphConfig`` via ``state.services.graph_config(graph_id)`` and threads ``composition.search_providers`` + ``composition.fetch_chain`` through both calls. When the lookup fails or no composition is available the workflow falls back to the registry-wide default — preserving the legacy path for CLI callers and graphs whose plugin isn't registered on this worker. Unknown ids in the allowlist are skipped silently so a graph type can declare providers that haven't rolled to every deployment yet. Empty allowlist → no providers queried (explicit over implicit). Tests: ``test_registry_search_all_allowlist_*`` cover filter / unknown- id tolerance / empty-list / multi-query semantics. ``test_fetch_many_ honors_chain_override`` + default-chain guard cover the fetch side. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…elper Applies PR #273 review: - Remove ``except Exception`` fallback around ``state.services.graph_config``. Silently widening to every registered provider on a resolver hiccup could route search through providers the graph type never authorized — violates the fail-fast rule in ``CLAUDE.md`` and the authorization invariant of composition-based tenancy. Errors propagate; the task fails and operators see the bug. - Extract ``_resolve_composition_selectors(state, graph_id)`` helper so the wire-up is unit-testable without a Hatchet runtime. Four new tests in ``test_composition_selectors.py`` cover composition → allowlist/chain, ``graph_id=None`` fallback, ``services=None`` fallback, and the must-have resolver-raises-propagates assertion. - Tighten ``search_all`` docstring: iteration is registration order, not composition order (dedup by URI keeps the observable ordering stable). - Add ``services/worker-search/tests/conftest.py`` installing the fake Hatchet env so tests can import ``workflows.search`` without a real Hatchet client token. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Review fixes pushed. All priority items applied:
Other notes:
|
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
This was referenced Apr 20, 2026
Merged
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.
Summary
ProviderRegistry.search_all()gains optionalallowlist: Iterable[str] | None— filters the registered providers to the ids named, preserves legacy behaviour when omitted.FetchProviderRegistry.fetch_many()gains optionalchain: list[str] | None— applies the override to every URI in the batch.web_searchtask resolvesstate.services.graph_config(graph_id)and threadscomposition.search_providers+composition.fetch_chaininto both calls. Falls back to registry defaults when no composition is available.Why
First consumer-side wire-up for Phase 3 — proves per-task provider selection driven by
GraphTypeCompositionworks end-to-end before rolling it into every pipeline phase.Unknown ids in the allowlist are skipped silently so a graph type can declare providers that haven't rolled to every deployment yet. Empty allowlist → zero results (explicit over implicit).
Part of #38. Follow-ups will apply the same pattern to
decompose_page_wf,ingest_build_wf, andnode_pipeline_wf.Test plan
uv run --project libs/kt-providers pytest libs/kt-providers/tests/test_providers.py libs/kt-providers/tests/fetch/test_registry.py -x -q— 30/30 green (4 new allowlist tests + 2 new fetch_many chain tests)uv run --project libs/kt-providers pytest libs/kt-providers/tests/ --ignore=tests/integration -x -q— 170/170 greenuv run --project services/worker-search pytest services/worker-search/tests/ -x -q— 4/4 green🤖 Generated with Claude Code