Skip to content
Open
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
3 changes: 2 additions & 1 deletion backend/chainlit/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,8 @@ def load_settings():
ui_settings = toml_dict.get("UI", {})
meta = toml_dict.get("meta")

if not meta or meta.get("generated_by") <= "0.3.0":
generated_by = meta.get("generated_by") if meta else None
if not generated_by or generated_by <= "0.3.0":
raise ValueError(
f"Your config file '{config_file}' is outdated. Please delete it and restart the app to regenerate it."
)
Expand Down
15 changes: 15 additions & 0 deletions backend/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@
from chainlit.config import ChainlitConfig


class TestLoadSettingsMetaGuard:
"""Regression test: meta section with missing generated_by must not raise TypeError."""

def test_meta_section_without_generated_by_raises_value_error(
self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
):
"""[meta] present but lacking 'generated_by' should raise ValueError, not TypeError."""
toml_content = "[meta]\nsome_other_key = \"value\"\n"
cfg_file = tmp_path / "config.toml"
cfg_file.write_text(toml_content, encoding="utf-8")
monkeypatch.setattr(chainlit_config, "config_file", str(cfg_file))
with pytest.raises(ValueError, match="outdated"):
chainlit_config.load_settings()


@pytest.fixture
def translation_dir(tmp_path: Path) -> Path:
"""Minimal translation directory with a controlled set of locale files."""
Expand Down