Repository navigation
Conversation
`conduit proxy` with no config, an empty `conduit.toml`, or a config without a `[providers.*]` section used to create `conduit.db`, `-shm` and `-wal` before failing on the missing providers, because the database was opened before `conduit_proxy::start` ran its check. The check now lives in `Config::ensure_providers`, which `main` calls for the proxy command right after loading the config, so a config error leaves the working directory untouched. `start` calls the same method, as it is a public entry point. The dashboard still runs without providers. A CLI test runs the binary in an empty directory to keep it that way. Refs #37 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The "No providers specified" error didn't say which config Conduit read or how to fix it. It now names the file that was read, or says that no config file was found at ./conduit.toml, and suggests adding a `[providers.<name>]` section or using --config / CONDUIT_CONFIG. To know where the config came from, `Config` gets a `source` field set by `Config::load`. It is skipped by serde, so it can't be set from the TOML file, and defaults to `NotLoaded` for configs built in code. Fixes #37 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the provider-validation startup changes.
No open issues 🎉
What changed in this PR
Fixes #37 by validating providers before proxy startup opens the database, preventing missing-provider errors from leaving database files behind.
Changes:
- Shares provider validation between CLI and proxy startup while keeping dashboard usage provider-independent.
- Tracks config provenance to provide actionable errors naming the selected or missing config file.
- Adds CLI regression tests for rejected configs, filesystem side effects, and dashboard behavior.
| File | Description |
|---|---|
crates/proxy/src/lib.rs |
Uses shared provider validation at startup. |
crates/core/src/config.rs |
Adds config provenance, provider validation, diagnostics, and unit tests. |
crates/cli/tests/config_errors.rs |
Tests config errors, absence of created files, and dashboard behavior. |
crates/cli/src/main.rs |
Validates proxy providers before opening storage. |
crates/cli/Cargo.toml |
Adds tempfile as a test dependency. |
Cargo.lock |
Records the CLI’s tempfile dependency. |
Review effort: Balanced
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.
Fixes #37.
conduit proxywith no config, an emptyconduit.toml, or a config without a[providers.*]section used to createconduit.db,-shmand-walbefore failing on the missing providers. The providers check now runs right after the config loads, before the database is opened, so a config error leaves the directory as it was.The error also says how to fix the problem and names the file that was read:
Commits
Config::ensure_providers().maincalls it for theproxycommand before opening the database, andconduit_proxy::startcalls it in place of its own check. The wording is unchanged in this commit. A new CLI test runs the binary in an empty temp directory and asserts nothing is created.For the reviewer
Configgains a publicsource: ConfigSourcefield, skipped by serde so it can't be set from the TOML file. It is public because the proxy tests buildConfig { ..Config::default() }from another crate, and it takes part in==.dashboardstill runs without providers; a test covers that.tempfileas a dev-dependency, hence the one-lineCargo.lockchange.Path::new(".").join(path), so it would read.\conduit.tomlon Windows and the exact-string test would fail there. CI runs on Linux only.Testing
cargo fmt --all --check,cargo clippy --workspace --tests --lockedandcargo test --workspace --lockedpass on each commit. The table from the issue was also reproduced by hand with the built binary: every config-error case exits 1 and leaves no database files, and a valid config still starts and creates the database.🤖 Generated with Claude Code