UAT: Settings.data_dir default is 'data' (relative path) — spec requires ~/.cleveragents #2851

Closed
opened 2026-04-04 20:55:43 +00:00 by freemo · 4 comments
Owner

Metadata

  • Branch: fix/settings-data-dir-default
  • Commit Message: fix(config): correct Settings.data_dir default from Path("data") to Path.home() / ".cleveragents"
  • Milestone: v3.7.0
  • Parent Epic: #362

Bug Description

The Settings class in src/cleveragents/config/settings.py has data_dir defaulting to Path("data") — a relative path — but the specification requires the default data directory to be ~/.cleveragents.

Expected Behavior (from spec)

The default data directory is ~/.cleveragents. This is established by the agents init command, which creates the directory and its subdirectories (logs/, cache/, backups/, etc.).

Actual Behavior

# src/cleveragents/config/settings.py line ~100
data_dir: Path = Field(
    default_factory=lambda: Path("data"),  # BUG: should be Path.home() / ".cleveragents"
    validation_alias=AliasChoices("CLEVERAGENTS_DATA_DIR"),
)

Verified by running:

from cleveragents.config.settings import Settings
s = Settings()
print(s.data_dir)  # outputs: data

Impact

Any code that reads Settings().data_dir without setting CLEVERAGENTS_DATA_DIR will use a relative data/ directory instead of the spec-required ~/.cleveragents. This affects:

  • Log storage
  • Database location
  • Cache directory
  • Backups directory
  • All persistent state

Note: The ConfigService registry correctly has core.data-dir defaulting to ~/.cleveragents, but the Settings class (used for runtime configuration) is inconsistent with both the spec and the ConfigService.

Code Location

src/cleveragents/config/settings.pydata_dir field definition

Subtasks

  • Change data_dir default from Path("data") to Path.home() / ".cleveragents" in Settings
  • Verify the fix does not break any existing Behave unit tests that rely on the old default
  • Update or add a Behave scenario covering the correct default value for data_dir
  • Verify CLEVERAGENTS_DATA_DIR env var override still works correctly after the fix
  • Confirm ConfigService and Settings are now consistent in their data_dir defaults
  • Run nox -e typecheck to confirm no type regressions

Definition of Done

  • Settings().data_dir 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 consistent with ConfigService core.data-dir default
  • Behave scenario added or updated to cover the correct default
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/settings-data-dir-default` - **Commit Message**: `fix(config): correct Settings.data_dir default from Path("data") to Path.home() / ".cleveragents"` - **Milestone**: v3.7.0 - **Parent Epic**: #362 ## Bug Description The `Settings` class in `src/cleveragents/config/settings.py` has `data_dir` defaulting to `Path("data")` — a relative path — but the specification requires the default data directory to be `~/.cleveragents`. ### Expected Behavior (from spec) > The default data directory is `~/.cleveragents`. This is established by the `agents init` command, which creates the directory and its subdirectories (`logs/`, `cache/`, `backups/`, etc.). ### Actual Behavior ```python # src/cleveragents/config/settings.py line ~100 data_dir: Path = Field( default_factory=lambda: Path("data"), # BUG: should be Path.home() / ".cleveragents" validation_alias=AliasChoices("CLEVERAGENTS_DATA_DIR"), ) ``` **Verified by running:** ```python from cleveragents.config.settings import Settings s = Settings() print(s.data_dir) # outputs: data ``` ### Impact Any code that reads `Settings().data_dir` without setting `CLEVERAGENTS_DATA_DIR` will use a relative `data/` directory instead of the spec-required `~/.cleveragents`. This affects: - Log storage - Database location - Cache directory - Backups directory - All persistent state **Note:** The `ConfigService` registry correctly has `core.data-dir` defaulting to `~/.cleveragents`, but the `Settings` class (used for runtime configuration) is inconsistent with both the spec and the `ConfigService`. ### Code Location `src/cleveragents/config/settings.py` — `data_dir` field definition ## Subtasks - [ ] Change `data_dir` default from `Path("data")` to `Path.home() / ".cleveragents"` in `Settings` - [ ] Verify the fix does not break any existing Behave unit tests that rely on the old default - [ ] Update or add a Behave scenario covering the correct default value for `data_dir` - [ ] Verify `CLEVERAGENTS_DATA_DIR` env var override still works correctly after the fix - [ ] Confirm `ConfigService` and `Settings` are now consistent in their `data_dir` defaults - [ ] Run `nox -e typecheck` to confirm no type regressions ## Definition of Done - [ ] `Settings().data_dir` 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 consistent with `ConfigService` `core.data-dir` default - [ ] Behave scenario added or updated to cover the correct default - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-04 20:55:50 +00:00
Author
Owner

Starting implementation on branch fix/settings-data-dir-default.

Plan:

  • TDD approach: write failing Behave scenario first, then fix the bug
  • Fix: change data_dir default from Path("data") to Path.home() / ".cleveragents" in Settings
  • Verify env var override still works
  • Confirm consistency with ConfigService
  • Run all nox quality gates

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

Starting implementation on branch `fix/settings-data-dir-default`. **Plan:** - TDD approach: write failing Behave scenario first, then fix the bug - Fix: change `data_dir` default from `Path("data")` to `Path.home() / ".cleveragents"` in `Settings` - Verify env var override still works - Confirm consistency with `ConfigService` - Run all nox quality gates --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
Author
Owner

All subtasks complete. Quality gates passed. PR #3198 created on branch fix/settings-data-dir-default.

Implementation Summary:

  • Fixed Settings.data_dir default from Path("data") to Path.home() / ".cleveragents" (1-line change)
  • Added 2 Behave scenarios (TDD: failing test written first, then fix applied)
  • Added 1 step definition for the new assertion
  • All 35 settings-related scenarios pass
  • nox -e typecheck: 0 errors, 0 warnings
  • nox -e lint: All checks passed
  • nox -e format: No changes needed

PR review and merge handled by continuous review stream.


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

All subtasks complete. Quality gates passed. PR #3198 created on branch `fix/settings-data-dir-default`. **Implementation Summary:** - Fixed `Settings.data_dir` default from `Path("data")` to `Path.home() / ".cleveragents"` (1-line change) - Added 2 Behave scenarios (TDD: failing test written first, then fix applied) - Added 1 step definition for the new assertion - All 35 settings-related scenarios pass - `nox -e typecheck`: 0 errors, 0 warnings - `nox -e lint`: All checks passed - `nox -e format`: No changes needed PR review and merge handled by continuous review stream. --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
Author
Owner

PR #3198 reviewed, approved, and merged.

The fix correctly changes Settings.data_dir default from Path("data") to Path.home() / ".cleveragents", aligning with the specification. Two new BDD scenarios verify the default and env var override behavior. All CI checks passed.


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

PR #3198 reviewed, approved, and merged. The fix correctly changes `Settings.data_dir` default from `Path("data")` to `Path.home() / ".cleveragents"`, aligning with the specification. Two new BDD scenarios verify the default and env var override behavior. All CI checks passed. --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-pr-self-reviewer
Author
Owner

Issue transitioned to State/Completed and closed. All Definition of Done criteria met:

  • Settings().data_dir 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 consistent with ConfigService core.data-dir default
  • Behave scenarios added covering the correct default and env var override
  • All CI checks passed (lint, typecheck, security, quality, unit_tests, integration_tests, e2e_tests, coverage)

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

Issue transitioned to `State/Completed` and closed. All Definition of Done criteria met: - ✅ `Settings().data_dir` 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 consistent with `ConfigService` `core.data-dir` default - ✅ Behave scenarios added covering the correct default and env var override - ✅ All CI checks passed (lint, typecheck, security, quality, unit_tests, integration_tests, e2e_tests, coverage) --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-pr-self-reviewer
Sign in to join this conversation.
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.

Blocks
#362 Epic: Security & Safety Hardening
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#2851
No description provided.