infospace-bench/workplans
tegwick 82468c2165 IB-WP-0020-T02: routing config loader
build_routing_policy_from_config(config, *, workspace=None, env=None,
adapter_factory=None) materialises a parsed RoutingConfig into a live
llm-connect routing policy:

- Static RoutingPolicy when the config has no adaptive signals; one
  RoutingRule per task type, prefer = first candidate, fallback =
  second candidate (when present), max_cost_per_1k pulled from the
  preferred candidate.
- AdaptiveRoutingPolicy when default_quality_floor, any per-task
  quality_floor, or ledger_path is set. ledger_path resolves relative
  to the supplied workspace; parent directory is created so the
  ledger writes never fail on first call.
- API-key resolution from env (default os.environ) using the
  per-provider DEFAULT_API_KEY_ENV map; candidate.api_key_env overrides
  the default. Missing key raises InfospaceError("missing_routing_api_key")
  before any provider constructor runs.
- claude_code candidates need no API key (shells out to the local CLI).
- adapter_factory hook lets tests inject a sentinel-returning factory
  so policy construction stays network- and llm-adapter-free.

Eight new tests cover: static-policy default, adaptive selection via
ledger_path, adaptive selection via quality_floor, multi-candidate
fallback rule, real-factory smoke (OpenRouterAdapter constructed with
env API key), missing-key fast-fail, claude_code zero-key path, and
custom api_key_env override.

168 tests pass, 1 skipped.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 19:58:15 +02:00
..
IB-WP-0001-state-hub-and-repo-bootstrap.md workplan cleanup 2026-05-14 12:46:32 +02:00
IB-WP-0002-infospace-lifecycle-baseline.md Initial implementation 2026-05-14 11:32:25 +02:00
IB-WP-0003-evaluation-and-inspection.md Initial implementation 2026-05-14 11:32:25 +02:00
IB-WP-0004-reference-infospace-pilot.md Initial implementation 2026-05-14 11:32:25 +02:00
IB-WP-0005-orthogonal-successor-architecture.md docs and stuff 2026-05-14 13:47:36 +02:00
IB-WP-0006-markitect-tool-adapter.md markitect-tool integration 2026-05-14 14:53:16 +02:00
IB-WP-0007-entity-relation-model-migration.md entity relationship model 2026-05-14 15:06:17 +02:00
IB-WP-0008-evaluation-history-metrics-parity.md eval history and metrics 2026-05-14 15:35:04 +02:00
IB-WP-0009-applied-workflow-generation-pipeline.md acceptance matrix and workflow generation 2026-05-14 16:01:32 +02:00
IB-WP-0010-kontextual-engine-integration-boundary.md engine and lifecycle 2026-05-14 16:26:42 +02:00
IB-WP-0011-pruned-legacy-reference-pilot.md Kontextual Engine Integration Boundary 2026-05-14 16:43:29 +02:00
IB-WP-0012-replacement-readiness-cli-parity.md command parity and migration guide 2026-05-14 17:16:39 +02:00
IB-WP-0013-wealth-vsm-generation-pipeline-parity.md infospace pipeline for wealth of nations example 2026-05-14 18:04:38 +02:00
IB-WP-0014-infospace-backend-abstraction.md chore(consistency): sync task status from DB [auto] 2026-05-17 11:52:20 +02:00
IB-WP-0015-generic-source-infospace-generator-cli.md generic source-to-infospace generator 2026-05-14 19:33:22 +02:00
IB-WP-0016-lefevre-ebook-infospace-readiness.md IB-WP-0016-T07: review report and output policy; close IB-WP-0016 2026-05-18 01:22:41 +02:00
IB-WP-0017-agentic-memory-profile-pilot.md Agentic memory profile 2026-05-15 16:01:35 +02:00
IB-WP-0018-adaptive-llm-routing-consumer.md IB-WP-0018-T03+T04: shadow sampling + report/CLI surfacing; close IB-WP-0018 2026-05-18 11:52:05 +02:00
IB-WP-0019-budget-and-usage-registry.md IB-WP-0019-T07: archive integration; close IB-WP-0019 2026-05-17 21:53:28 +02:00
IB-WP-0020-provider-routing-cli.md IB-WP-0020-T02: routing config loader 2026-05-18 19:58:15 +02:00