refactor(config): replace stringly-typed fields with typed enums#4909
Merged
Conversation
…, #4900) - SttConfig.provider: String → ProviderName for consistency with all other provider-reference fields in providers.rs - CandleConfig/CandleInlineConfig: source: String → CandleSource enum (Huggingface | Local), device: String → CandleDevice enum (Cpu | Cuda | Metal | Auto); serde rename_all="lowercase" preserves TOML backward compatibility including device="auto" - Remove default_stt_provider() and default_candle_{source,device}() helper functions; replaced by #[serde(default)] on enum types - select_device() in provider_factory.rs takes CandleDevice; exhaustive match eliminates silent wildcard fallthrough - Fix stale &str call sites in src/bootstrap/tests.rs Closes #4899 Closes #4900
bug-ops
enabled auto-merge (squash)
June 6, 2026 11:36
bug-ops
force-pushed
the
4899-4900-config-typed-fields
branch
from
June 6, 2026 11:36
23f2d68 to
015aa4d
Compare
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
SttConfig.provider: StringwithProviderNamenewtype for consistency with all other provider-reference fields inproviders.rsCandleSourceenum (Huggingface|Local) andCandleDeviceenum (Cpu|Cuda|Metal|Auto) replacing bareStringfields inCandleConfigandCandleInlineConfigdefault_stt_provider(),default_candle_source(),default_candle_device()helper functions replaced by#[serde(default)]on typed enumsselect_device()inprovider_factory.rsnow takesCandleDevice; exhaustive match eliminates silent wildcard fallthroughTOML backward compatibility preserved:
#[serde(rename_all = "lowercase")]maps existing string values;device = "auto"continues to work viaCandleDevice::Autowith identical Metal→CUDA→CPU fallback logic.Closes #4899
Closes #4900
Test plan
cargo +nightly fmt --check— cleancargo clippy --workspace -- -D warnings— cleanRUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked— cleancargo nextest run --config-file .github/nextest.toml --workspace --lib --bins— 10519 passed, 21 skippedcargo check -p zeph --features candle— clean (stale&strtests inbootstrap/tests.rsfixed)provider = "...",source = "huggingface",device = "auto"parse correctly