UAT: Settings.data_dir default is Path('data') but spec requires '~/.cleveragents' #4086

Open
opened 2026-04-06 10:12:28 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/settings-data-dir-default
  • Commit Message: fix(config): align Settings.data_dir default to spec-required ~/.cleveragents
  • Milestone: (backlog — non-critical)
  • Parent Epic: #352

Background and Context

The specification defines core.data-dir with a default of ~/.cleveragents as the root directory for all CleverAgents persistent state. The Settings class in src/cleveragents/config/settings.py uses Path("data") (a relative path) instead, creating an inconsistency between the two configuration layers and violating the spec.

Current Behavior

In src/cleveragents/config/settings.py, lines 132–135:

data_dir: Path = Field(
    default_factory=lambda: Path("data"),
    validation_alias=AliasChoices("CLEVERAGENTS_DATA_DIR"),
)

The Settings.data_dir field defaults to Path("data") (a relative path), not Path.home() / ".cleveragents" as required by the spec.

Similarly, storage_base_path also defaults to Path("data"):

storage_base_path: Path = Field(
    default_factory=lambda: Path("data"),
    validation_alias=AliasChoices("CLEVERAGENTS_STORAGE_BASE_PATH"),
)

Note: The ConfigService registry correctly registers core.data-dir with default "~/.cleveragents" (config_service.py line 134), but the Settings class uses Path("data"). This creates an inconsistency between the two configuration layers.

Steps to reproduce:

  1. Instantiate Settings() without setting CLEVERAGENTS_DATA_DIR
  2. Check settings.data_dir — it returns Path("data") instead of Path.home() / ".cleveragents"

Expected Behavior

Per the specification, section "Global Configuration Keys", core.data-dir:

core.data-dir | string | ~/.cleveragents | CLEVERAGENTS_DATA_DIR | Root directory for all CleverAgents persistent state: database, logs, cache, sessions, checkpoints, and backups.

Settings.data_dir should default to Path.home() / ".cleveragents" when no CLEVERAGENTS_DATA_DIR environment variable is set, ensuring all persistent state is stored in a consistent, user-scoped location regardless of the current working directory.

Acceptance Criteria

  • Settings().data_dir returns Path.home() / ".cleveragents" when CLEVERAGENTS_DATA_DIR is not set
  • Settings().data_dir still respects the CLEVERAGENTS_DATA_DIR environment variable when set
  • storage_base_path default is reviewed and aligned with spec if applicable
  • ConfigService default and Settings default are consistent
  • Existing tests updated to reflect the new default
  • No regression in tests that rely on the old Path("data") default

Subtasks

  • Change data_dir default_factory from lambda: Path("data") to lambda: Path.home() / ".cleveragents" in src/cleveragents/config/settings.py
  • Review and align storage_base_path default if it should also follow the spec
  • Update any unit tests that assert data_dir == Path("data")
  • Verify ConfigService and Settings defaults are consistent
  • Tests (pytest/Behave): Add/update scenario for Settings.data_dir default value
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%.

Supporting Information

  • Code location: src/cleveragents/config/settings.py, lines 132–139
  • Fix: Change default_factory=lambda: Path("data") to default_factory=lambda: Path.home() / ".cleveragents" for the data_dir field
  • Related: ConfigService in config_service.py line 134 already uses "~/.cleveragents" as the default — this fix aligns Settings with that existing correct behavior
  • Parent Epic: #352 Epic: Config Service A9 (Multi-Level Resolution)

Backlog note: This issue was discovered during autonomous operation
on milestone v3.7.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


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

## Metadata - **Branch**: `fix/settings-data-dir-default` - **Commit Message**: `fix(config): align Settings.data_dir default to spec-required ~/.cleveragents` - **Milestone**: (backlog — non-critical) - **Parent Epic**: #352 ## Background and Context The specification defines `core.data-dir` with a default of `~/.cleveragents` as the root directory for all CleverAgents persistent state. The `Settings` class in `src/cleveragents/config/settings.py` uses `Path("data")` (a relative path) instead, creating an inconsistency between the two configuration layers and violating the spec. ## Current Behavior In `src/cleveragents/config/settings.py`, lines 132–135: ```python data_dir: Path = Field( default_factory=lambda: Path("data"), validation_alias=AliasChoices("CLEVERAGENTS_DATA_DIR"), ) ``` The `Settings.data_dir` field defaults to `Path("data")` (a relative path), not `Path.home() / ".cleveragents"` as required by the spec. Similarly, `storage_base_path` also defaults to `Path("data")`: ```python storage_base_path: Path = Field( default_factory=lambda: Path("data"), validation_alias=AliasChoices("CLEVERAGENTS_STORAGE_BASE_PATH"), ) ``` Note: The `ConfigService` registry correctly registers `core.data-dir` with default `"~/.cleveragents"` (config_service.py line 134), but the `Settings` class uses `Path("data")`. This creates an inconsistency between the two configuration layers. **Steps to reproduce:** 1. Instantiate `Settings()` without setting `CLEVERAGENTS_DATA_DIR` 2. Check `settings.data_dir` — it returns `Path("data")` instead of `Path.home() / ".cleveragents"` ## Expected Behavior Per the specification, section "Global Configuration Keys", `core.data-dir`: > `core.data-dir` | string | `~/.cleveragents` | `CLEVERAGENTS_DATA_DIR` | Root directory for all CleverAgents persistent state: database, logs, cache, sessions, checkpoints, and backups. `Settings.data_dir` should default to `Path.home() / ".cleveragents"` when no `CLEVERAGENTS_DATA_DIR` environment variable is set, ensuring all persistent state is stored in a consistent, user-scoped location regardless of the current working directory. ## Acceptance Criteria - [ ] `Settings().data_dir` returns `Path.home() / ".cleveragents"` when `CLEVERAGENTS_DATA_DIR` is not set - [ ] `Settings().data_dir` still respects the `CLEVERAGENTS_DATA_DIR` environment variable when set - [ ] `storage_base_path` default is reviewed and aligned with spec if applicable - [ ] `ConfigService` default and `Settings` default are consistent - [ ] Existing tests updated to reflect the new default - [ ] No regression in tests that rely on the old `Path("data")` default ## Subtasks - [ ] Change `data_dir` `default_factory` from `lambda: Path("data")` to `lambda: Path.home() / ".cleveragents"` in `src/cleveragents/config/settings.py` - [ ] Review and align `storage_base_path` default if it should also follow the spec - [ ] Update any unit tests that assert `data_dir == Path("data")` - [ ] Verify `ConfigService` and `Settings` defaults are consistent - [ ] Tests (pytest/Behave): Add/update scenario for `Settings.data_dir` default value - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage >= 97%. ## Supporting Information - **Code location:** `src/cleveragents/config/settings.py`, lines 132–139 - **Fix:** Change `default_factory=lambda: Path("data")` to `default_factory=lambda: Path.home() / ".cleveragents"` for the `data_dir` field - **Related:** `ConfigService` in `config_service.py` line 134 already uses `"~/.cleveragents"` as the default — this fix aligns `Settings` with that existing correct behavior - **Parent Epic:** #352 Epic: Config Service A9 (Multi-Level Resolution) > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.7.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:11:15 +00:00
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
Reference
cleveragents/cleveragents-core#4086
No description provided.