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
fix(config): honor dotenv backend selection at runtime (#210)
* fix(config): honor dotenv backend selection at runtime
Settings classes now read .env directly through pydantic-settings so backend and related runtime configuration match the repo documentation without requiring callers to load dotenv themselves.
A focused regression test reloads the config module from a temporary working directory to prove EVOLVE_BACKEND=postgres is picked up from .env and that the module-level singleton follows the same behavior.
Constraint: Keep configuration loading dependency-free and inside existing pydantic settings flow
Rejected: Add manual load_dotenv bootstrap in library entrypoints | spreads config side effects across multiple runtimes
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: If config needs to work outside the repo root, prefer an explicit absolute env file strategy rather than adding more implicit loaders
Tested: ./.venv/bin/pytest -v tests/unit/test_client.py; ./.venv/bin/ruff check altk_evolve/config/evolve.py altk_evolve/config/postgres.py altk_evolve/config/filesystem.py altk_evolve/config/milvus.py altk_evolve/config/llm.py altk_evolve/config/phoenix.py tests/unit/test_client.py
Not-tested: Full e2e MCP or CLI startup from non-repo working directories
* test(client): preserve default config state after dotenv reload
The dotenv-backed backend assertion reloads altk_evolve.config.evolve under a temporary working directory. The cleanup now restores the original cwd and clears EVOLVE_BACKEND before reloading so the module singleton is rebuilt against the default repo context instead of the temporary postgres fixture.
Constraint: importlib.reload reconstructs evolve_config from the current cwd and environment\nRejected: Only overwrite evolve_config.backend after reload | the module instance is still recreated from tmp_path/.env\nConfidence: high\nScope-risk: narrow\nReversibility: clean\nDirective: Tests that reload settings modules should restore both cwd and env before cleanup reloads\nTested: uv run pytest -v tests/unit/test_client.py\nNot-tested: Full test suite
0 commit comments