Files
cleveragents-core/features/config_cli_scope_coverage.feature
T
freemo 00951dd750 fix(config): remove undocumented LOCAL scope from ConfigLevel/ConfigScope enums and resolve() chain
The specification defines exactly 5 configuration precedence levels:
  1. CLI flag
  2. Environment variable
  3. Project-scoped config (config.toml in project root)
  4. Global config file (~/.cleveragents/config.toml)
  5. Built-in default

The implementation had an undocumented 6th level (LOCAL scope / config.local.toml)
inserted between env var and project-scoped config. This creates a spec deviation
that may cause user confusion and hidden reliance on undocumented behavior.

Changes:
- Remove LOCAL = 'local' from ConfigLevel enum (now has 5 spec-defined levels)
- Remove LOCAL = 'local' from ConfigScope enum (now has 2 spec-defined scopes)
- Remove local_config_path property from ConfigService
- Remove read_local_config() method from ConfigService
- Update read_merged_config() to merge only global and project scopes
- Update write_scoped_config() to remove LOCAL scope branch
- Update set_value() to remove LOCAL scope branch
- Update resolve() to implement 5-level chain (remove Level 3 local config)
- Update config_set CLI to reject --scope local as invalid
- Remove config.local.toml from DEFAULT_IGNORE_PATTERNS in context_service
- Update all BDD feature files and step definitions to reflect 5-level chain

Closes #3432

---
**Automated by CleverAgents Bot**
Supervisor: Implementation | Agent: ca-issue-worker
2026-05-30 17:35:11 -04:00

54 lines
2.9 KiB
Gherkin

Feature: Config CLI scope coverage (cfcov3)
Supplementary scenarios targeting uncovered lines in
cleveragents/cli/commands/config.py the --scope flag handling
in the config_set command.
Background:
Given a cfcov3 isolated temp config directory
# ── Invalid scope raises typer.BadParameter ──────────────────────────
Scenario: config set with invalid --scope raises BadParameter
When I invoke cfcov3 config set "plan.concurrency" "8" with scope "invalid"
Then the cfcov3 CLI result should have a non-zero exit code
And the cfcov3 CLI output should contain "Invalid scope"
# ── --scope global branch ─────────────────────────────────────────────
Scenario: config set with --scope global writes via set_value
When I invoke cfcov3 config set "plan.concurrency" "16" with scope "global"
Then the cfcov3 CLI result should have exit code 0
And the cfcov3 CLI output should contain "plan.concurrency"
And the cfcov3 CLI output should contain "global"
# ── --scope project branch ────────────────────────────────────────────
Scenario: config set with --scope project writes via set_value
When I invoke cfcov3 config set "plan.concurrency" "12" with scope "project"
Then the cfcov3 CLI result should have exit code 0
And the cfcov3 CLI output should contain "plan.concurrency"
And the cfcov3 CLI output should contain "project"
# ── --scope global with pre-existing value ────────────────────────────
Scenario: config set --scope global shows previous value from config_data
Given the cfcov3 global config has "plan.concurrency" set to 4
When I invoke cfcov3 config set "plan.concurrency" "99" with scope "global"
Then the cfcov3 CLI result should have exit code 0
And the cfcov3 set_value mock should have been called with scope GLOBAL
# ── --scope project reads previous from project config ────────────────
Scenario: config set --scope project reads previous from project config
Given the cfcov3 project config returns "plan.concurrency" as 7
When I invoke cfcov3 config set "plan.concurrency" "14" with scope "project"
Then the cfcov3 CLI result should have exit code 0
And the cfcov3 read_project_config mock should have been called
# ── --scope local is rejected as invalid ─────────────────────────────
Scenario: config set with --scope local is rejected as invalid scope
When I invoke cfcov3 config set "plan.concurrency" "20" with scope "local"
Then the cfcov3 CLI result should have a non-zero exit code
And the cfcov3 CLI output should contain "Invalid scope"