mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix(cli): compare the resolved settings path when deciding whether the lite up and autoroute backups guard it
This commit is contained in:
parent
b3f2de058b
commit
708381948b
2 changed files with 16 additions and 1 deletions
|
|
@ -66,7 +66,7 @@ def claude_settings_path(environ: Mapping[str, str]) -> Path:
|
|||
|
||||
def settings_file_owners(settings_path: Path) -> tuple[SettingsFileOwner, ...]:
|
||||
"""The commands whose backups guard settings_path: `lite up` and `lite autoroute up` only ever manage the default file."""
|
||||
return SETTINGS_FILE_OWNERS if settings_path == CLAUDE_SETTINGS_PATH else ()
|
||||
return SETTINGS_FILE_OWNERS if settings_path.resolve() == CLAUDE_SETTINGS_PATH.resolve() else ()
|
||||
|
||||
|
||||
def load_json_or_empty(path: Path) -> dict[str, JsonValue]:
|
||||
|
|
|
|||
|
|
@ -1477,6 +1477,21 @@ class TestLoginConfigClaude:
|
|||
assert "Run `lite down` first" in result.output
|
||||
assert not default_settings_path.exists()
|
||||
|
||||
def test_flag_refuses_while_lite_up_holds_the_default_file_reached_through_a_symlinked_config_dir(self, tmp_path):
|
||||
default_config_dir = tmp_path / "default-home" / ".claude"
|
||||
default_config_dir.mkdir(parents=True)
|
||||
alias = tmp_path / "claude-alias"
|
||||
alias.symlink_to(default_config_dir, target_is_directory=True)
|
||||
(tmp_path / "claude_settings_backup.json").write_text("{}")
|
||||
|
||||
result, _settings_path, _backup_path = self._run_login(
|
||||
tmp_path, ["--config-claude"], config_dir_env={"CLAUDE_CONFIG_DIR": str(alias)}
|
||||
)
|
||||
|
||||
assert result.exit_code != 0
|
||||
assert "`lite up` is currently managing" in result.output
|
||||
assert not (default_config_dir / "settings.json").exists()
|
||||
|
||||
def test_flag_writes_an_alternate_config_dir_even_while_lite_up_holds_the_default_file(self, tmp_path):
|
||||
(tmp_path / "claude_settings_backup.json").write_text("{}")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue