Files
temp/robot/project_context_set_exec_env_priority.robot
T
brent.edwards 26632f79e9 test: add TDD bug-capture test for #1079 — project context set missing flag (#1130)
## Summary

This PR adds TDD bug-capture tests for bug #1079 (`project context set` missing `--execution-env-priority` flag). Per the Bug Fix Workflow in CONTRIBUTING.md, the first step in fixing any bug is to write a test that proves the bug exists.

### What was done

- **Behave unit tests** (6 scenarios in `features/project_context_set_exec_env_priority.feature`):
  - `project context set --execution-env-priority override` with `--execution-environment` should succeed and persist
  - `project context set --execution-env-priority fallback` with `--execution-environment` should succeed and persist
  - `--execution-env-priority` without `--execution-environment` should be rejected
  - Default to `fallback` when only `--execution-environment` is specified
  - Invalid `--execution-env-priority` value should be rejected
  - `project context show` should reflect persisted `execution_env_priority` in JSON output

- **Robot integration tests** (3 test cases in `robot/project_context_set_exec_env_priority.robot`):
  - Override acceptance with persistence verification
  - Fallback acceptance with persistence verification
  - Full round-trip persistence check

All tests are tagged `@tdd_bug @tdd_bug_1079 @tdd_expected_fail`. The underlying assertions fail (confirming the bug exists — `--execution-env-priority` is "No such option"), and the `@tdd_expected_fail` tag inverts the result so CI passes.

### Bug confirmed

The `context_set()` function in `cleveragents.cli.commands.project_context` does not accept `execution_env_priority` as a parameter. The specification (§Execution Environment Routing, precedence table) requires this flag at precedence level 2 for project-level execution environment priority control.

### Quality gates

| Gate | Result |
|------|--------|
| `nox -s lint` | PASS |
| `nox -s typecheck` | PASS (0 errors) |
| `nox -s unit_tests` | PASS (12236 scenarios, 0 failed) |
| `nox -s integration_tests` | My 3 tests pass (13 pre-existing failures) |
| `nox -s coverage_report` | PASS (98%, threshold 97%) |

Closes #1100

Reviewed-on: cleveragents/cleveragents-core#1130
Reviewed-by: Jeffrey Phillips Freeman <jeffrey.freeman@cleverthis.com>
Co-authored-by: Brent E. Edwards <brent.edwards@cleverthis.com>
Co-committed-by: Brent E. Edwards <brent.edwards@cleverthis.com>
2026-03-28 02:14:55 +00:00

39 lines
2.2 KiB
Plaintext

*** Settings ***
Documentation Smoke tests for project context set --execution-env-priority flag (Bug #1079)
...
... This test captures bug #1079: the ``--execution-env-priority`` flag
... is missing from the ``project context set`` command. Tagged as
... [tdd_issue] [tdd_issue_1079] [tdd_expected_fail] so that the test
... passes CI while the bug is unfixed. See CONTRIBUTING.md > Bug Fix Workflow.
Resource ${CURDIR}/common.resource
Suite Setup Setup Test Environment
Suite Teardown Cleanup Test Environment
Force Tags tdd_issue tdd_issue_1079 tdd_expected_fail
*** Variables ***
${HELPER} ${CURDIR}/helper_project_context_set_exec_env_priority.py
*** Test Cases ***
Project Context Set Accepts Execution Env Priority Override
[Documentation] Verify that ``project context set --execution-env-priority override``
... works with ``--execution-environment``. Currently fails due to bug #1079.
${result}= Run Process ${PYTHON} ${HELPER} set-env-priority-override cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} project-context-set-env-priority-override-ok
Project Context Set Accepts Execution Env Priority Fallback
[Documentation] Verify that ``project context set --execution-env-priority fallback``
... works with ``--execution-environment``. Currently fails due to bug #1079.
${result}= Run Process ${PYTHON} ${HELPER} set-env-priority-fallback cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} project-context-set-env-priority-fallback-ok
Project Context Set Persists Execution Env Priority
[Documentation] Verify that execution_env_priority is persisted and retrievable
... after ``project context set``. Currently fails due to bug #1079.
${result}= Run Process ${PYTHON} ${HELPER} set-env-priority-persists cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} project-context-set-env-priority-persists-ok