Drop the reader for the kebab-case driver kind
Iris has already moved past that spelling, so nothing will ever present it again -- there is one backend and one phone, and both are past it. The alias and the enum that carried it are gone; the legacy provider is just a `ProviderConfig` now. The rest of the migration stays until it has actually run on the host, because deleting it before then would strand the install it was written for. Its doc now says that outright, along with what to delete and when: this module and the branch in `Config::load` that reaches it, once the host has started on a build containing it. That is the general rule Iris gave, not a judgement about this migration: a reader for a superseded format has a defined end, because his population is one machine he controls, and leaving it keeps a second parsing path alive that nothing exercises and that constrains every later change to the schema. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017xn8nHw1tw1R6PtiY1eEtw
This commit is contained in:
1 parent
5ccadffeaa
commit
0c55b809b1
1 file changed
+13
-52
+13
-52
@@ -245,66 +245,29 @@ pub struct SessionConfig {
|
||||
/// The shape `config.ron` had before setups (up to 2026-08-28).
|
||||
///
|
||||
/// Here only so an existing install upgrades rather than refusing to
|
||||
/// start. Nothing else may use these types, and when no install can
|
||||
/// plausibly still be on that shape they go, along with the branch in
|
||||
/// [`Config::load`] that reaches them.
|
||||
/// start, and **due for deletion as soon as it has run**. There is one
|
||||
/// backend and one phone, so once they are past this shape nothing
|
||||
/// anywhere is still on it, and a second parsing path that nothing
|
||||
/// exercises only constrains later changes to the schema.
|
||||
///
|
||||
/// The reader for the kebab-case driver kind has already gone for that
|
||||
/// reason. Delete the rest -- this module and the branch in
|
||||
/// [`Config::load`] that reaches it -- once the host has started on a
|
||||
/// build containing it.
|
||||
mod legacy {
|
||||
use serde::Deserialize;
|
||||
|
||||
use super::{DriverKind, ProviderConfig, TokenEntry};
|
||||
use super::{ProviderConfig, TokenEntry};
|
||||
|
||||
#[derive(Deserialize, Default)]
|
||||
#[serde(rename_all = "camelCase", default)]
|
||||
pub struct Config {
|
||||
pub tokens: Vec<TokenEntry>,
|
||||
pub providers: Vec<Provider>,
|
||||
pub providers: Vec<ProviderConfig>,
|
||||
pub hosts: Vec<Host>,
|
||||
pub sessions: Vec<Session>,
|
||||
}
|
||||
|
||||
/// A provider, when the driver kind was spelled in kebab case.
|
||||
///
|
||||
/// Both spellings are accepted because the rename happened on the same
|
||||
/// day as the RON move, so a config written that morning says
|
||||
/// `r#claude-cli` and one written that afternoon says `claude_cli`.
|
||||
/// Reading only one of them would turn this migration into a different
|
||||
/// crash.
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Provider {
|
||||
pub name: String,
|
||||
pub kind: LegacyKind,
|
||||
#[serde(default)]
|
||||
pub command: Option<String>,
|
||||
#[serde(default)]
|
||||
pub models: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Copy)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum LegacyKind {
|
||||
Echo,
|
||||
#[serde(alias = "claude-cli")]
|
||||
ClaudeCli,
|
||||
#[serde(alias = "llama-cpp")]
|
||||
LlamaCpp,
|
||||
}
|
||||
|
||||
impl From<Provider> for ProviderConfig {
|
||||
fn from(old: Provider) -> Self {
|
||||
Self {
|
||||
name: old.name,
|
||||
kind: match old.kind {
|
||||
LegacyKind::Echo => DriverKind::Echo,
|
||||
LegacyKind::ClaudeCli => DriverKind::ClaudeCli,
|
||||
LegacyKind::LlamaCpp => DriverKind::LlamaCpp,
|
||||
},
|
||||
command: old.command,
|
||||
models: old.models,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A machine, when the name lived on the connection rather than on a
|
||||
/// setup.
|
||||
#[derive(Deserialize)]
|
||||
@@ -454,7 +417,7 @@ impl Config {
|
||||
id: LOCAL_SETUP_ID.to_string(),
|
||||
name: LOCAL_SETUP.to_string(),
|
||||
ssh: None,
|
||||
providers: old.providers.into_iter().map(Into::into).collect(),
|
||||
providers: old.providers,
|
||||
});
|
||||
// Name and id both taken from the old host's name: it is what
|
||||
// sessions referenced, so reusing it is what lets them keep
|
||||
@@ -675,10 +638,8 @@ mod tests {
|
||||
let path = dir.path().join("config.ron");
|
||||
std::fs::write(
|
||||
&path,
|
||||
// `r#claude-cli` deliberately: the kebab spelling and the RON
|
||||
// move landed the same day, so a real file may have either.
|
||||
"tokens: [(name: \"phone\", sha256: \"ab\")],\n\
|
||||
providers: [(name: \"claude-cli\", kind: r#claude-cli, models: [\"opus\"])],\n\
|
||||
providers: [(name: \"claude-cli\", kind: claude_cli, models: [\"opus\"])],\n\
|
||||
hosts: [(name: \"dev vm\", address: \"bob@10.0.0.2\", port: 2222)],\n\
|
||||
sessions: [\n\
|
||||
(id: \"a\", provider: \"claude-cli\", host: \"dev vm\", title: \"remote\", created: 1.0),\n\
|
||||
|
||||
Reference in new issue
Block a user