fix(config): correct Settings.data_dir default from Path("data") to Path.home() / ".cleveragents" #3198

Merged
freemo merged 1 commit from fix/settings-data-dir-default into master 2026-04-05 21:09:47 +00:00
Owner

Summary

Fixes a bug where Settings.data_dir defaulted to Path("data") (a relative path) instead of the spec-required ~/.cleveragents. This caused all persistent state (logs, database, cache, backups) to be written to a relative data/ directory when CLEVERAGENTS_DATA_DIR was not explicitly set.

Changes

Bug Fix

  • src/cleveragents/config/settings.py: Changed data_dir default_factory from lambda: Path("data") to lambda: Path.home() / ".cleveragents", aligning with the specification and the existing ConfigService core.data-dir default.

Tests (TDD — failing test written first)

  • features/settings_configuration.feature: Added two new Behave scenarios:
    • data_dir default is the spec-required home directory path — verifies Settings().data_dir == Path.home() / ".cleveragents" when CLEVERAGENTS_DATA_DIR is not set
    • data_dir env var override takes precedence over default — verifies CLEVERAGENTS_DATA_DIR env var override continues to work correctly
  • features/steps/settings_steps.py: Added step definition the data directory should equal the home cleveragents path

Verification

  • Settings().data_dir now returns Path.home() / ".cleveragents" when CLEVERAGENTS_DATA_DIR is not set
  • CLEVERAGENTS_DATA_DIR env var override continues to work correctly
  • Settings.data_dir default is now consistent with ConfigService core.data-dir default (~/.cleveragents)
  • All 35 settings-related Behave scenarios pass (31 existing + 4 from coverage boost)
  • nox -e typecheck — 0 errors, 0 warnings
  • nox -e lint — All checks passed
  • nox -e format — 1874 files left unchanged

Impact

Any code that reads Settings().data_dir without setting CLEVERAGENTS_DATA_DIR will now correctly use ~/.cleveragents instead of a relative data/ directory. This affects log storage, database location, cache directory, backups directory, and all persistent state.

Closes #2851


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

## Summary Fixes a bug where `Settings.data_dir` defaulted to `Path("data")` (a relative path) instead of the spec-required `~/.cleveragents`. This caused all persistent state (logs, database, cache, backups) to be written to a relative `data/` directory when `CLEVERAGENTS_DATA_DIR` was not explicitly set. ## Changes ### Bug Fix - **`src/cleveragents/config/settings.py`**: Changed `data_dir` `default_factory` from `lambda: Path("data")` to `lambda: Path.home() / ".cleveragents"`, aligning with the specification and the existing `ConfigService` `core.data-dir` default. ### Tests (TDD — failing test written first) - **`features/settings_configuration.feature`**: Added two new Behave scenarios: - `data_dir default is the spec-required home directory path` — verifies `Settings().data_dir == Path.home() / ".cleveragents"` when `CLEVERAGENTS_DATA_DIR` is not set - `data_dir env var override takes precedence over default` — verifies `CLEVERAGENTS_DATA_DIR` env var override continues to work correctly - **`features/steps/settings_steps.py`**: Added step definition `the data directory should equal the home cleveragents path` ## Verification - ✅ `Settings().data_dir` now returns `Path.home() / ".cleveragents"` when `CLEVERAGENTS_DATA_DIR` is not set - ✅ `CLEVERAGENTS_DATA_DIR` env var override continues to work correctly - ✅ `Settings.data_dir` default is now consistent with `ConfigService` `core.data-dir` default (`~/.cleveragents`) - ✅ All 35 settings-related Behave scenarios pass (31 existing + 4 from coverage boost) - ✅ `nox -e typecheck` — 0 errors, 0 warnings - ✅ `nox -e lint` — All checks passed - ✅ `nox -e format` — 1874 files left unchanged ## Impact Any code that reads `Settings().data_dir` without setting `CLEVERAGENTS_DATA_DIR` will now correctly use `~/.cleveragents` instead of a relative `data/` directory. This affects log storage, database location, cache directory, backups directory, and all persistent state. Closes #2851 --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
fix(config): correct Settings.data_dir default from Path("data") to Path.home() / ".cleveragents"
All checks were successful
CI / lint (pull_request) Successful in 26s
CI / typecheck (pull_request) Successful in 48s
CI / security (pull_request) Successful in 1m0s
CI / quality (pull_request) Successful in 35s
CI / build (pull_request) Successful in 18s
CI / helm (pull_request) Successful in 23s
CI / unit_tests (pull_request) Successful in 6m42s
CI / e2e_tests (pull_request) Successful in 16m55s
CI / integration_tests (pull_request) Successful in 23m3s
CI / coverage (pull_request) Successful in 10m44s
CI / docker (pull_request) Successful in 1m42s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 58m29s
e4966021e9
The Settings class had data_dir defaulting to Path("data") — a relative
path — but the specification requires the default data directory to be
~/.cleveragents. This inconsistency caused any code reading Settings().data_dir
without setting CLEVERAGENTS_DATA_DIR to use a relative 'data/' directory
instead of the spec-required ~/.cleveragents, affecting log storage, database
location, cache, backups, and all persistent state.

Changes:
- Fix data_dir default_factory from Path("data") to Path.home() / ".cleveragents"
- Add Behave scenario: 'data_dir default is the spec-required home directory path'
- Add Behave scenario: 'data_dir env var override takes precedence over default'
- Add step definition: 'the data directory should equal the home cleveragents path'

Settings.data_dir is now consistent with ConfigService core.data-dir default
(~/.cleveragents). The CLEVERAGENTS_DATA_DIR env var override continues to work.

ISSUES CLOSED: #2851
Author
Owner

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3198-1743897600]


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3198-1743897600] --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
freemo left a comment

Code Review — LGTM

PR: fix(config): correct Settings.data_dir default from Path("data") to Path.home() / ".cleveragents"

Review Checklist

Correctness: lambda: Path.home() / ".cleveragents" is the correct default per spec. Consistent with ConfigService core.data-dir default.

Test Coverage: Two new BDD scenarios — default value and env var override. Both in features/ as required.

Type Safety: No # type: ignore. Pyright passes with 0 errors.

Commit Format: fix(config): follows Conventional Changelog format.

Issues Noted (Non-blocking)

  • ⚠️ Missing milestone — Please assign to the appropriate milestone.
  • ⚠️ Missing Type/ label — Please add Type/Bug.

Decision: LGTM — Proceeding to merge when CI passes.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer

## Code Review — LGTM ✅ **PR:** fix(config): correct Settings.data_dir default from Path("data") to Path.home() / ".cleveragents" ### Review Checklist **✅ Correctness:** `lambda: Path.home() / ".cleveragents"` is the correct default per spec. Consistent with `ConfigService` `core.data-dir` default. **✅ Test Coverage:** Two new BDD scenarios — default value and env var override. Both in `features/` as required. **✅ Type Safety:** No `# type: ignore`. Pyright passes with 0 errors. **✅ Commit Format:** `fix(config):` follows Conventional Changelog format. ### Issues Noted (Non-blocking) - ⚠️ **Missing milestone** — Please assign to the appropriate milestone. - ⚠️ **Missing Type/ label** — Please add `Type/Bug`. ### Decision: **LGTM** — Proceeding to merge when CI passes. --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
freemo scheduled this pull request to auto merge when all checks succeed 2026-04-05 08:28:02 +00:00
Author
Owner

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3198-1775372800]


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3198-1775372800] --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
freemo added this to the v3.7.0 milestone 2026-04-05 09:24:59 +00:00
freemo left a comment

Independent Code Review — LGTM

PR: fix(config): correct Settings.data_dir default from Path("data") to Path.home() / ".cleveragents"
Linked Issue: #2851
Reviewer: ca-pr-self-reviewer (independent review)

Review Summary

This is a clean, focused bug fix that corrects a spec violation in Settings.data_dir. The change is minimal (1 line of production code), well-tested (2 new BDD scenarios), and aligns with both the specification and the existing ConfigService defaults.

Detailed Review

Specification Alignment

  • The spec requires ~/.cleveragents as the default data directory. Path.home() / ".cleveragents" correctly implements this.
  • Settings.data_dir is now consistent with ConfigService core.data-dir default, eliminating a confusing inconsistency.

Correctness

  • Path.home() / ".cleveragents" is the idiomatic Python way to construct this path.
  • The validation_alias=AliasChoices("CLEVERAGENTS_DATA_DIR") is preserved, so env var override continues to work.
  • No side effects — this is a pure default value change.

Test Quality

  • Two meaningful BDD scenarios in features/settings_configuration.feature:
    1. Default value verification against Path.home() / ".cleveragents"
    2. Env var override verification with /tmp/custom-data
  • Step definition in features/steps/settings_steps.py includes a clear assertion message.
  • Tests cover both the fix and the regression guard (env var override still works).

Commit Quality

  • Single atomic commit with Conventional Changelog format: fix(config): ...
  • ISSUES CLOSED: #2851 footer present.
  • Commit body is descriptive and explains the "why" clearly.

Code Quality

  • No # type: ignore suppressions.
  • No unnecessary changes — the diff is surgically focused.
  • Follows existing patterns in the Settings class.

Security

  • No secrets, no injection vectors, no auth concerns.

Metadata Corrections Applied

  • Assigned milestone v3.7.0 (was missing, matching the linked issue's milestone).

CI Status

All required checks passing: lint , typecheck , security , quality , unit_tests , integration_tests , e2e_tests , coverage , build , status-check

Decision: APPROVED — Proceeding to merge.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer

## Independent Code Review — LGTM ✅ **PR:** fix(config): correct Settings.data_dir default from Path("data") to Path.home() / ".cleveragents" **Linked Issue:** #2851 **Reviewer:** ca-pr-self-reviewer (independent review) ### Review Summary This is a clean, focused bug fix that corrects a spec violation in `Settings.data_dir`. The change is minimal (1 line of production code), well-tested (2 new BDD scenarios), and aligns with both the specification and the existing `ConfigService` defaults. ### Detailed Review #### Specification Alignment ✅ - The spec requires `~/.cleveragents` as the default data directory. `Path.home() / ".cleveragents"` correctly implements this. - `Settings.data_dir` is now consistent with `ConfigService` `core.data-dir` default, eliminating a confusing inconsistency. #### Correctness ✅ - `Path.home() / ".cleveragents"` is the idiomatic Python way to construct this path. - The `validation_alias=AliasChoices("CLEVERAGENTS_DATA_DIR")` is preserved, so env var override continues to work. - No side effects — this is a pure default value change. #### Test Quality ✅ - Two meaningful BDD scenarios in `features/settings_configuration.feature`: 1. Default value verification against `Path.home() / ".cleveragents"` 2. Env var override verification with `/tmp/custom-data` - Step definition in `features/steps/settings_steps.py` includes a clear assertion message. - Tests cover both the fix and the regression guard (env var override still works). #### Commit Quality ✅ - Single atomic commit with Conventional Changelog format: `fix(config): ...` - `ISSUES CLOSED: #2851` footer present. - Commit body is descriptive and explains the "why" clearly. #### Code Quality ✅ - No `# type: ignore` suppressions. - No unnecessary changes — the diff is surgically focused. - Follows existing patterns in the `Settings` class. #### Security ✅ - No secrets, no injection vectors, no auth concerns. ### Metadata Corrections Applied - ✅ Assigned milestone v3.7.0 (was missing, matching the linked issue's milestone). ### CI Status All required checks passing: lint ✅, typecheck ✅, security ✅, quality ✅, unit_tests ✅, integration_tests ✅, e2e_tests ✅, coverage ✅, build ✅, status-check ✅ ### Decision: **APPROVED** — Proceeding to merge. --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-pr-self-reviewer
freemo merged commit f4233fb3bd into master 2026-04-05 21:09:37 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core!3198
No description provided.