test: add TDD bug-capture test for #1079 — project context set missing flag (#1130)
CI / build (push) Successful in 18s
CI / helm (push) Successful in 21s
CI / lint (push) Successful in 3m17s
CI / quality (push) Successful in 3m41s
CI / typecheck (push) Successful in 4m3s
CI / security (push) Successful in 4m4s
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Successful in 7m7s
CI / unit_tests (push) Successful in 7m15s
CI / docker (push) Successful in 1m31s
CI / e2e_tests (push) Successful in 12m39s
CI / coverage (push) Successful in 11m32s
CI / status-check (push) Successful in 1s
CI / benchmark-publish (push) Successful in 29m36s

## 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: #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>
This commit was merged in pull request #1130.
This commit is contained in:
2026-03-28 02:14:55 +00:00
committed by Forgejo
parent b46a0e6102
commit 26632f79e9
7 changed files with 665 additions and 2 deletions
+2 -2
View File
@@ -23,7 +23,7 @@ TDD Resource Add Succeeds Without Explicit Init
... The helper exits 0 with a sentinel when the command
... succeeds (bug is fixed), and exits 1 when the bug is
... present (OperationalError).
[Tags] tdd_bug tdd_bug_1023
[Tags] tdd_expected_fail tdd_issue tdd_issue_1023
${result}= Run Process ${PYTHON} ${HELPER} resource-add-no-init cwd=${WORKSPACE} timeout=120s on_timeout=kill
Log ${result.stdout}
Log ${result.stderr}
@@ -37,7 +37,7 @@ TDD Project Create Succeeds Without Explicit Init
... The helper exits 0 with a sentinel when the command
... succeeds (bug is fixed), and exits 1 when the bug is
... present (OperationalError).
[Tags] tdd_bug tdd_bug_1023
[Tags] tdd_expected_fail tdd_issue tdd_issue_1023
${result}= Run Process ${PYTHON} ${HELPER} project-create-no-init cwd=${WORKSPACE} timeout=120s on_timeout=kill
Log ${result.stdout}
Log ${result.stderr}