Collapse the namespace-filter ``runner.invoke(...)`` call onto a single
line so ``ruff format --check`` (the ``lint`` gate's ``format``
session) passes.
ISSUES CLOSED: #3773
Two changed source lines were uncovered by the existing test suite:
- ``src/cleveragents/cli/commands/config.py:57`` — ``return Path(home_env)``
branch in ``_get_config_dir()`` (only reached when
``CLEVERAGENTS_HOME`` is set).
- ``src/cleveragents/cli/commands/plan.py:3131`` —
``active_filters.append(f"[yellow]Namespace:[/yellow] {namespace}")``
in ``lifecycle_list_plans`` (only reached when ``--namespace`` is
passed).
Add one scenario per uncovered line:
- ``features/config_cli_safety_net_coverage.feature`` — new
``safety-net _get_config_dir`` scenario sets
``CLEVERAGENTS_HOME`` and asserts the resolver returns that
path. Step reuses the existing safety-net env var helper.
- ``features/plan_cli_spec_alignment.feature`` — new ``Plan list
with --namespace filter`` scenario invokes ``plan list
--namespace myteam`` against the existing plan-spec-alignment
fixtures and reuses the existing ``the plan spec list should
succeed`` assertion.
ISSUES CLOSED: #3773
Tests in features/config_cli_*.feature and robot/config_cli.robot /
robot/automation_profile_cli.robot patch
``cleveragents.cli.commands.config._CONFIG_DIR`` /
``_CONFIG_PATH`` with ``unittest.mock.patch.object`` to redirect
the CLI to a temp config directory. ``_get_service`` was calling
``_get_config_dir()`` and recomputing the path from
``CLEVERAGENTS_HOME`` / ``Path.home()`` on every invocation, which
bypassed the patches and routed every test through the developer's
real ``~/.cleveragents`` — producing the 8 unit_tests scenario
failures and 3 integration Robot failures observed on CI.
Read the patched module-level constants directly so the patches
take effect. Module-load-time path resolution (the assignment at
file scope) still honours ``CLEVERAGENTS_HOME``.
The 4 robot tests that had ``tdd_expected_fail`` for tdd_issue_4204
and tdd_issue_4302 now pass — drop the tag so the
tdd_expected_fail_listener doesn't invert their PASS into a FAIL.
ISSUES CLOSED: #3773
Fix 8 distinct integration test and E2E failures:
1. JSON envelope unwrapping in test helpers
Helpers were asserting keys at the top-level of the JSON envelope
({command, status, exit_code, data, timing, messages}) rather than
inside the nested 'data' field. Updated helpers to access
parsed['data'] for assertions on the actual response payload:
- helper_cli_formats.py: action_list_json, action_show_yaml,
plan_list_json, global_format_json_version, global_format_yaml_version,
global_format_shorthand
- helper_automation_profile_cli.py: test_show_json, test_list_json
- helper_cli_extensions.py: action_show_json
- helper_config_cli.py: config_set_get_roundtrip
- helper_config_project_scope.py: cli_roundtrip
2. Plan list --namespace / -n option (issue #4301)
Add 'namespace' parameter to lifecycle_list_plans() in plan.py,
passing it through to service.list_plans(namespace=...) and
displaying it in the Filters panel.
3. Config registry key count (issue #4304)
Update expected count from 105 to 106 to match current registry
(additional server key was added via the server stubs feature).
4. Container tool exec mock fix (issue #4243)
The test mocked ev.resolve_and_validate (no longer called) instead
of ev.resolve_with_precedence. Fix the mock target so ToolRunner
correctly routes to the container path and returns the expected
error when no ContainerToolExecutor is configured.
5. E2E config CLI CLEVERAGENTS_HOME support
config.py used a hardcoded Path.home() / '.cleveragents' for the
config directory, ignoring CLEVERAGENTS_HOME. E2E tests run in
isolated temporary homes set via CLEVERAGENTS_HOME; this caused the
WF07 CI Profile Configuration test to read from the global config
(returning 'review') instead of the test-scoped config. Make
_get_config_dir() and _get_service() respect CLEVERAGENTS_HOME.
ISSUES CLOSED: #4204#4205#4206#4243#4301#4302#4303#4304