You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(config): use pydantic-settings and platformdirs #628
Polylogue declares pydantic-settings as a runtime dependency but still hand-rolls runtime settings and XDG path resolution.
Evidence:
pyproject.toml declares pydantic-settings, but rg pydantic_settings polylogue devtools tests finds no imports.
polylogue/config.py:29-151 uses dataclasses plus manual env reads such as VOYAGE_API_KEY.
polylogue/paths/_roots.py:9-33 manually implements XDG config/data/cache/state fallback logic with os.environ.get.
polylogue/paths/_roots.py:66-73 handles POLYLOGUE_ARCHIVE_ROOT and render-root derivation outside a typed settings model.
This is both a compactness issue and a drift issue: config/environment behavior is spread across path helpers, config dataclasses, Drive auth helpers, pipeline commands, and terminal formatting helpers.
Suggested shape
Add a RuntimeSettings / adapter layer using pydantic_settings.BaseSettings with a POLYLOGUE_ prefix.
Add platformdirs as a direct dependency for user config/data/cache/state roots, or explicitly reject it and remove pydantic-settings if the project wants custom path code.
Keep existing Config, Source, and DriveConfig as public/internal contracts at first; make get_config() consume the settings adapter.
Migrate manual env reads in follow-up slices.
Acceptance criteria
get_config() is backed by typed settings validation rather than scattered os.environ.get calls.
XDG/default path resolution goes through one platform-aware path/settings layer.
Existing env vars keep their intended behavior, with tests for POLYLOGUE_ARCHIVE_ROOT, XDG roots, Drive credential/token paths, schema validation mode, and VOYAGE_API_KEY.
pydantic-settings is either used directly or removed from runtime dependencies.
Documentation lists the supported env vars from the same settings source of truth.
Superseded by #614. I consolidated this finding into the composite issue so the work can be handled as one coherent slice instead of as a tiny standalone ticket. The original evidence remains available in this issue history.
Activity
Sinity commentedon May 1, 2026
Superseded by #614. I consolidated this finding into the composite issue so the work can be handled as one coherent slice instead of as a tiny standalone ticket. The original evidence remains available in this issue history.