Skip to content

refactor(server): read [embed_fallback] and resolve its env overrides in the core (#1414) - #1415

Merged
ajianaz merged 1 commit into
developfrom
refactor/server-embed-fallback-1414
Oct 9, 2026
Merged

ajianaz merged 1 commit into
developfrom
refactor/server-embed-fallback-1414

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

What

  • Core: FallbackSettings::with_env_overrides() (and an injectable with_overrides_from) own the UTEKE_EMBED_FALLBACK_{API_KEY,BASE_URL,ENDPOINT_PATH,MODEL} rules: env wins, an empty variable counts as unset.
  • CLI: EmbedFallbackConfig::is_configured / resolve_with_env now delegate to the core type instead of keeping their own copy (same behaviour; its existing tests are unchanged and green).
  • Server: ServerFileConfig gets [embed_fallback]; after the store is opened, a fully configured fallback (api_key, base_url AND model) is applied with set_fallback_settings, as the CLI already does. Logged as Embedding fallback: enabled (<url>).

Why

Closes #1414, step A of #1355 (split by section, not one big move). A server using an external embedder could not fall back to a second endpoint although the CLI could, and the override rules were written once per consumer. The project-local uteke.toml stays untrusted for embed_fallback.api_key/base_url/endpoint_path through the shared layered resolver (covered by a test).

Testing

  • fmt, clippy -D warnings, cargo test --workspace, vecq-only core lib tests green
  • New tests: 3 in core (env wins field by field, empty env ignored, env alone can configure and partial config is not configured), 4 in the server (absent/partial section, complete section with endpoint path, env completes/overrides the file, untrusted project file cannot set it); the 2 existing CLI fallback tests still pass
  • End to end, run locally with the built uteke-serve: primary embedder pointing at a dead port. Without a fallback remember returned embedding_written: false with the connection error; with UTEKE_EMBED_FALLBACK_* pointing at a fake OpenAI-compatible server it returned embedding_written: true and the fake server logged exactly 1 request. Not run: a real second embedder
  • Behaviour change: a server whose uteke.toml already holds a complete [embed_fallback] starts using it (it was ignored before)

🤖 Generated with Claude Code

… in the core (#1414)

FallbackSettings (core) now owns the UTEKE_EMBED_FALLBACK_* override rules
(env wins, empty env ignored). The CLI delegates to it instead of its own copy,
and uteke-serve reads [embed_fallback] and applies it when api_key, base_url and
model are all set. First step of #1355 (split by section).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 460e832 into develop Oct 9, 2026
15 checks passed
@ajianaz
ajianaz deleted the refactor/server-embed-fallback-1414 branch October 9, 2026 09:16
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(server): read [embed_fallback] and resolve its env overrides in the core (#1355 step A)

1 participant