Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/backend/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl Backend for UnifiedGitBackend {
.config
.get_tool_opts(&self.ba)
.await?
.unwrap_or_else(|| tv.request.options());
.unwrap_or_else(|| self.ba.opts());
let api_url = self.get_api_url(&opts);

// Check if URL already exists in lockfile platforms first
Expand Down
8 changes: 7 additions & 1 deletion src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@ impl RegistryTool {

if let Some(backend) = self.get_backend(full) {
for (k, v) in backend.options {
opts.insert(k.to_string(), toml::Value::String(v.to_string()));
// Try to parse as TOML to preserve nested table structure
// (e.g., platforms with per-platform options like asset_pattern)
let value = match toml::from_str::<toml::Value>(v) {
Ok(parsed) if parsed.is_table() => parsed,
_ => toml::Value::String(v.to_string()),
};
Comment on lines +136 to +139

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-table TOML scalars are silently demoted to strings

The guard if parsed.is_table() means valid non-table TOML literals (booleans, integers, floats, and arrays) will be stored as toml::Value::String rather than their native types. For example, if a registry entry ever sets a numeric or boolean option (e.g., timeout = 30), toml::from_str::<toml::Value>("30") returns Ok(Integer(30)) but because !parsed.is_table() it falls through to String("30"), losing type information.

A more future-proof guard would be to only fall back to String when parsing fails outright:

Suggested change
let value = match toml::from_str::<toml::Value>(v) {
Ok(parsed) if parsed.is_table() => parsed,
_ => toml::Value::String(v.to_string()),
};
let value = if let Ok(parsed) = toml::from_str::<toml::Value>(&format!("v={v}"))
&& let Some(v) = parsed.get("v")
&& !v.is_str()
{
v.clone()
} else {
toml::Value::String(v.to_string())
};

Or, more simply, only skip the table guard by falling back to String for everything that isn't a table or array, since those are the only composite types that need reconstruction. This is a low-risk style concern for now, but worth addressing before adding integer/boolean registry options.

Fix in Claude Code

opts.insert(k.to_string(), value);
}
}

Expand Down
Loading