Repository navigation
Description
Problem Description
The test fixture cluster_jobs in tests/support/fakes/cluster_jobs.py does not isolate roadmap.implement.in_runner or DEVOPS_CLI_ROADMAP_IMPLEMENT_IN_RUNNER. When tests run in an environment where roadmap.implement.in_runner is true (such as inside the roadmap Service runner pod), the command roadmap implement takes the in-runner execution path rather than the outside-runner execution path. This causes 23 tests in tests/roadmap/implement/test_roadmap_implement_outside.py to fail with AssertionError: assert (0, True, False, []) == (0, True, True, []). In an implement run, these false failures cause the runner pod to start an unnecessary repair loop that spends the token budget and stops the item.
Reproduction Steps
- Run
DEVOPS_CLI_ROADMAP_IMPLEMENT_IN_RUNNER=true uv run pytest tests/roadmap/implement/test_roadmap_implement_outside.py - Observe 23 test failures.
Expected vs Actual Behavior
Expected: Tests in tests/roadmap/implement/test_roadmap_implement_outside.py isolate their environment and pass regardless of whether the outer environment runs inside a runner pod.
Actual: The tests inherit DEVOPS_CLI_ROADMAP_IMPLEMENT_IN_RUNNER=true and fail.
Environment Diagnostics
- DevOps CLI Version: 0.77.2
- Python Version: 3.14.10
- Execution Environment: Kubernetes runner pod / Local DevContainer
Proposed design
Problem statement
The cluster_jobs test fixture does not clear DEVOPS_CLI_ROADMAP_IMPLEMENT_IN_RUNNER. When the outer environment sets it true, as the runner pod does, 23 tests in tests/roadmap/implement/test_roadmap_implement_outside.py take the in-runner path and fail. The false failures start an unnecessary repair loop in the runner pod. The fix isolates the setting in the fixture.
Acceptance criteria
Requirement: The fixture clears the in-runner variable
The cluster_jobs fixture SHALL remove DEVOPS_CLI_ROADMAP_IMPLEMENT_IN_RUNNER from the process environment for each test that uses it.
Scenario: The outer environment runs inside a runner
- WHEN a test that uses the
cluster_jobsfixture starts whileDEVOPS_CLI_ROADMAP_IMPLEMENT_IN_RUNNERistruein the environment - THEN
os.environholds noDEVOPS_CLI_ROADMAP_IMPLEMENT_IN_RUNNERinside the test
Requirement: The outside-runner tests pass in a runner pod
The tests in tests/roadmap/implement/test_roadmap_implement_outside.py SHALL pass when DEVOPS_CLI_ROADMAP_IMPLEMENT_IN_RUNNER=true is set in the outer environment.
Scenario: The outside-runner suite runs with the variable set
- WHEN the command
DEVOPS_CLI_ROADMAP_IMPLEMENT_IN_RUNNER=true uv run pytest tests/roadmap/implement/test_roadmap_implement_outside.pyruns - THEN pytest reports that all tests passed
Requirement: The runner guard test keeps its setting
The test test_in_a_runner_the_command_starts_no_job_and_keeps_the_guard MUST still take the in-runner path after the fixture change.
Scenario: The guard test sets the setting in the config
- WHEN
test_in_a_runner_the_command_starts_no_job_and_keeps_the_guardruns withroadmap.implement.in_runnertrue in the config - THEN the command exits with code 1, prints
runs only as the GitHub App, and makes no kubectl call
Requirement: A test proves the isolation
A test SHALL prove that the cluster_jobs fixture removes the variable that the outer environment sets.
Scenario: A test sets the variable before it requests the fixture
- WHEN a test sets
DEVOPS_CLI_ROADMAP_IMPLEMENT_IN_RUNNERtotruein a fixture that runs beforecluster_jobs - THEN the test asserts that
os.environholds noDEVOPS_CLI_ROADMAP_IMPLEMENT_IN_RUNNER
Existing Tool Considered
No alternatives check has run. The need is covered by pytest's built-in monkeypatch fixture, which tests/support/fakes/cluster_jobs.py already uses to set DEVOPS_CLI_TELEMETRY_ENABLED. It lacks nothing for this change: monkeypatch.delenv(name, raising=False) removes the variable and restores it after the test. No new dependency and no custom isolation code are needed.
Key questions
- Where should the test isolate
roadmap.implement.in_runner?: In the sharedcluster_jobsfixture, which already setsDEVOPS_CLI_TELEMETRY_ENABLEDfor the test. (best practice) [sources: tests/support/fakes/cluster_jobs.py, tests/roadmap/implement/test_roadmap_implement_outside.py, tests/commands/k8s/test_k8s_run_job.py]- Chosen: Shared
cluster_jobsfixture. Both test files that start a Job use this fixture, and it already sets an environment variable for the test. - Rejected: Autouse fixture in
test_roadmap_implement_outside.py. It leavestests/commands/k8s/test_k8s_run_job.pyexposed and repeats the setup. - Rejected: The
clifixture. Every command test uses it, so a broad environment change risks unrelated tests.
- Chosen: Shared
- Should the fixture delete the variable or set it to
false?: Delete it withmonkeypatch.delenv("DEVOPS_CLI_ROADMAP_IMPLEMENT_IN_RUNNER", raising=False). (best practice) [sources: tests/support/fakes/cluster_jobs.py, docs/ENV_VARS.md:109]- Chosen: Delete with
monkeypatch.delenv. The default is false, and the config file stays free to setin_runnertrue for the guard test. - Rejected: Set to
falsewithmonkeypatch.setenv. It sets one value for every test and can override the config file value that the guard test needs.
- Chosen: Delete with
- Does the guard test still pass after the fixture removes the variable?: Yes. The test sets
roadmap.implement.in_runnerto true in the config file, so it does not read the environment variable. [sources: tests/roadmap/implement/test_roadmap_implement_outside.py, docs/ENV_VARS.md:109] - How does the test suite prove the isolation?: A test sets the variable in a fixture that runs before
cluster_jobs, and then asserts that the variable is absent. (best practice) [sources: tests/support/fakes/cluster_jobs.py, tests/commands/k8s/test_k8s_run_job.py]- Chosen: A test with an earlier fixture. It proves the fixture removes the outer value, and it runs offline.
- Rejected: A CI job that sets the variable for the whole file. It adds a second test invocation and does not check the fixture itself.
- Rejected: No new test. The regression can return without a failure.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-09: in-use.
The item already names this tool.
Tool: pytest (https://pypi.org/project/pytest), MIT, last activity 2026-10-27, maintained.
Activity
dan-petty commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(tests)scope of the title gives the scope.False test failures cause the runner pod to start an unnecessary repair loop and stop the item, but only in the runner pod environment.It prevents 23 false test failures and the resulting operational damage in the runner pod.Isolating one environment variable in a single test fixture is a small, targeted change.Both address missing test isolation in the roadmap test suite, but #3885 adds seams for serve and CI tests while the candidate isolates an environment variable in the cluster_jobs fixture.devops-cli-service commentedon Nov 8, 2026
Status set to Ready at 1f03ee3 (see proposed design in issue body).
devops-cli-service commentedon Nov 9, 2026
Alternatives check: in-use
Reason: pytest's built-in
monkeypatch.delenv(name, raising=False)removes the variable for one test and restores it afterwards. This covers the whole need. The issue says the fixture already usesmonkeypatch, and pytest is maintained: the latest release is 9.2.0, uploaded 2026-10-27. My web search returned only unrelated pages. I did not read pytest's documentation, so this rests on the issue text and the PyPI facts.The item already names this tool.
Tool: pytest (https://pypi.org/project/pytest)
Covers:
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-09. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 12, 2026
Released in v0.118.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.118.0
devops-cli-service commentedon Nov 12, 2026
Live since 2026-11-12 12:40 UTC