Files
cleveragents-core/features/config_project_scope.feature
freemo 7d74be68aa feat(config): add project-scoped config overrides
Add --project flag to config set, config get, and config list CLI
commands, enabling per-project configuration overrides stored under
[project."<name>"] TOML tables in the global config file.

Project-scoped resolution slots between environment variable and global
levels in the ConfigService resolution chain. config list --project
shows only overrides for the named project with source annotations.

Implementation:
- ConfigService: add set_project_value() and get_project_overrides()
  methods for TOML-backed project-scoped persistence and retrieval
- CLI config commands: wire --project flag through set, get, and list
  subcommands; project-scoped list filters to overrides only
- Database persistence: project-scoped config stored as alternative
  backend for projects not using TOML
- Documentation: update docs/reference/config_resolution.md with
  project-scopable key lists, CLI examples, precedence diagram, and
  non-scopable key rejection behavior

Tests:
- Behave: 12 BDD scenarios in features/config_project_scope.feature
  covering set/get/list, precedence over global defaults, and
  non-scopable key rejection
- Robot: 5 integration smoke tests in robot/config_project_scope.robot
  for end-to-end project-scoped round-trip verification
- ASV: benchmarks/config_project_scope_bench.py measuring resolution
  overhead with project scope active

All nox quality gates pass: lint, typecheck, unit_tests (7522 scenarios),
integration_tests (Config Project Scope suite passed), and coverage at
98% line rate (threshold 97%).

Closes #259
2026-03-02 15:05:20 +00:00

70 lines
3.6 KiB
Gherkin

Feature: Project-scoped configuration overrides
As a user managing multiple projects
I want to set config overrides per project
So that different projects can have different settings
Background:
Given a clean project-scoped config environment
Scenario: Set a project-scoped config value
When I set config "core.automation-profile" to "manual" for project "my-project"
Then the project-scoped config for "my-project" should contain "core.automation-profile" = "manual"
Scenario: Project-scoped value overrides global
Given a global config value "core.automation-profile" = "supervised"
And a project-scoped config value "core.automation-profile" = "manual" for project "my-project"
When I get config "core.automation-profile" for project "my-project"
Then the project-resolved value should be "manual"
Scenario: Global value used when no project override exists
Given a global config value "core.automation-profile" = "supervised"
When I get config "core.automation-profile" for project "my-project"
Then the project-resolved value should be "supervised"
Scenario: List project-scoped overrides
Given a project-scoped config value "core.automation-profile" = "manual" for project "my-project"
And a project-scoped config value "plan.concurrency" = "8" for project "my-project"
When I list config for project "my-project"
Then the output should show 2 project-scoped overrides
Scenario: Non-project-scopable key is rejected for project set
When I attempt to set non-scopable key "core.data-dir" to "/tmp" for project "my-project"
Then the project set should fail with a scopable error
Scenario: Project set via CLI command
When I run config set "core.automation-profile" "trusted" with project "my-project" via CLI
Then the CLI config set should succeed
And the CLI output should mention project scope "my-project"
Scenario: Project get via CLI command
Given a project-scoped config value "core.automation-profile" = "trusted" for project "my-project"
When I run config get "core.automation-profile" with project "my-project" via CLI
Then the CLI config get should succeed
Scenario: Project list via CLI command shows only overrides
Given a project-scoped config value "core.automation-profile" = "trusted" for project "cli-proj"
And a project-scoped config value "plan.concurrency" = "16" for project "cli-proj"
When I run config list with project "cli-proj" via CLI
Then the CLI config list should succeed
And the CLI list output should show exactly 2 entries
Scenario: Project list via CLI command with no overrides
When I run config list with project "empty-proj" via CLI
Then the CLI config list should show no overrides message
Scenario: Empty project name is rejected by service
When I attempt to get overrides for empty project name
Then the empty project name should raise ValueError
Scenario: Set project value via service method
When I use service set_project_value for "my-project" key "plan.concurrency" value "12"
Then the project-scoped config for "my-project" should contain "plan.concurrency" = "12"
Scenario: Get project overrides returns only project keys
Given a project-scoped config value "core.automation-profile" = "trusted" for project "proj-a"
And a project-scoped config value "plan.concurrency" = "6" for project "proj-a"
And a global config value "core.log.level" = "DEBUG"
When I get all project overrides for "proj-a"
Then the project overrides should have 2 keys
And the project overrides should not contain "core.log.level"