Repository navigation
Description
Update 2026-11-26 (infra move): devops install-tools and tools_lock are deleted (#6555), so the CLI test, TQ2, S1, S3 and S4 no longer apply. The version read is version_finding in openspec/gate.py. Left: assert the full unreadable detail in the gate test, treat a nonzero exit as no version (C3), and check TQ3.
Problem Description
Depends on #5355.
The vetting of #5355 found that the new tests do not prove some branches of the version read. A mutant that deletes such a branch passes the tests. The items below come from the verdict (TQ1, TQ2, TQ3, C3, S1, S3, S4). The line numbers are at the head of #5355 (59486f86b).
Test gaps:
- TQ1. No CLI test and no gate test asserts the text that says the version cannot be read. A mutant that deletes the unreadable branch in
src/devops_cli/commands/install_tools.py:410-411or insrc/devops_cli/openspec/gate.py:117-123passes all 76 targeted tests. Without the branch, the check prints the "differs" line withNoneas the version. That line also names the path, and the check also exits 1, so the tests see no change. Also, the fake_record_npm(tests/commands/test_install_tools.py:412-461) always answers--versionwith exit 0 (line 431). Thus no CLI test proves the merged scenario "A command that prints no version fails the check", whose WHEN is "theopenspeccommand on PATH exits 1". - TQ2.
tests/tools_lock/test_versions.py:57-67gives the failing answer an empty stdout. Thus the ruleif result.returncode != 0: return (path, None)(src/devops_cli/tools_lock/versions.py:36-37) is not proven. A mutant that deletes the rule passes, because an empty stdout also gives no version line. - TQ3.
tests/openspec/test_openspec_gate.py:159-175asserts that the finding detail does not holdregenerate. This assertion proves nothing:missing_hintnever holdsregenerate, and the test edits no skill. Only the assertion onupdate --forceproves the early return.
Code nits in the same files:
- C3.
_version_finding(src/devops_cli/openspec/gate.py:114) reads only stdout and ignores the exit code ofopenspec --version.path_versionreads a nonzero exit as no version. The two readers must apply the same rule. - S1.
path_version(src/devops_cli/tools_lock/versions.py:35) runs--versionwith the default subprocess timeout of 1800 s and does not changesubprocess.TimeoutExpiredinto a domain error.OpenSpecTool.run(src/devops_cli/openspec/tool.py:66-84) usesDEFAULT_OPENSPEC_COMMAND_TIMEOUT_SECONDS(120 s) and raisesToolExecutionError. - S3.
path_versionpasses noCONST_OPENSPEC_OPT_OUT_ENV, and the isolated child environment dropsDO_NOT_TRACK,OPENSPEC_TELEMETRYandOPENSPEC_NO_UPDATE_CHECK. ADR 0010 sets the opt-outs on every run of the tool. Now no request goes out, becauseopenspec --versionexits before the telemetry hook of the tool. A later release of the tool can change this. - S4. The help text of
--only-missing(src/devops_cli/lang/en/help.py:2333-2336, and the generateddocs/commands/install-tools.md:15) says that the option installs each tool "whose command on PATH prints another version". The code reads the version ofopenspeconly (_version_state,src/devops_cli/commands/install_tools.py:392-400).
Reproduction Steps
- Check out the head of fix: install-tools --check passes an older openspec binary #5355, or
mainafter the merge. - Delete the
if version is Nonebranch atsrc/devops_cli/commands/install_tools.py:410-411. - Run
uv run pytest tests/commands/test_install_tools.py tests/openspec/test_openspec_gate.py tests/tools_lock/test_versions.py. - All tests pass.
- Do steps 2 to 4 again for
src/devops_cli/openspec/gate.py:117-123and forsrc/devops_cli/tools_lock/versions.py:36-37. All tests pass again.
Expected vs Actual Behavior
Expected: each branch of the version read has a test that fails when the branch is deleted. Both readers read a nonzero exit as no version. The version run has the timeout, the error type and the opt-outs of every other openspec run. The help text says that only the openspec version is read.
Actual: the mutants pass. The gate reads a version from a run that exits nonzero. The version run of path_version has a 1800 s timeout and no opt-outs. The help text says that the option reads the version of each tool.
Proposed Fix
- TQ1: Let
_record_npmanswer--versionwith an exit code that the test sets. Add a CLI test in whichopenspec --versionexits 1. Assert exit 1 and the fullMESSAGES.install.check_version_unreadableline. In the gate test, assert the fullMESSAGES.openspec.version_unreadabledetail. - TQ2: In
tests/tools_lock/test_versions.py:57-67, answer withProcessAnswer(returncode=1, stdout="1.17.0\n", stderr="boom\n"). - TQ3: Add a hand edit of a committed
SKILL.mdto the test attests/openspec/test_openspec_gate.py:159. Then theregenerateassertion proves the early return. - C3: In
_version_finding, read a nonzero exit as no version, aspath_versiondoes. One shared function insrc/devops_cli/tools_lock/versions.pycan hold the rule for both readers. - S1: Give the run in
path_versionthe timeoutDEFAULT_OPENSPEC_COMMAND_TIMEOUT_SECONDS. Changesubprocess.TimeoutExpiredintoToolExecutionError, asOpenSpecTool.rundoes. - S3: Pass
CONST_OPENSPEC_OPT_OUT_ENVin theenvargument of the version run. - S4: Change the help text to say that the option reads the version of the
openspeccommand on PATH only. Then runuv run devops docs generate.
Existing tool: pytest and the process_fake fixture cover the tests. No new tool is necessary.
Acceptance
- Each new test that proves a branch fails on the code before the fix. For a guard that exists already (the unreadable branches and the nonzero-exit rule), mutation evidence is sufficient: the test fails when the branch is deleted.
check_openspecgives the fullMESSAGES.openspec.version_unreadabledetail whenopenspec --versionexits 1, and a gate test proves it.uv run devops docs checkpasses.
Environment Diagnostics
- DevOps CLI Version: head of fix: install-tools --check passes an older openspec binary #5355 (
59486f86b), on 0.126.x - Python Version: 3.14.10
- OS & Architecture: Linux x86_64
- Execution Environment: DevContainer
Logs, Traces, or Terminal Output
# From the vetting verdict of #5355:
# A mutant that deletes the unreadable branches (install_tools.py:410-411, gate.py:117-123) passes all 76 tests.
# A mutant that deletes versions.py:36 passes, because the failing answer has an empty stdout.Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal keys are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Source: #5355
Alternatives check of 2026-11-17: not-applicable.
Class: test, no search.
Tool: none found.
Proposed design
Problem statement
The tests added in #5355 do not prove the unreadable-version branches. A mutant that deletes one branch passes. The gate and path_version apply different rules to a nonzero exit. The path_version run lacks the OpenSpec timeout, error type and opt-outs. The help text says that --only-missing reads every tool version, but the code reads only openspec.
Acceptance criteria
Requirement: CLI unreadable version branch
The CLI check MUST print the unreadable version line when openspec --version exits nonzero.
Scenario: Nonzero version exit in install-tools
- WHEN a CLI test runs
devops install-tools --check --tool openspecand the fakeopenspec --versionexits 1. - THEN the command exits 1 and its output holds the full
MESSAGES.install.check_version_unreadableline.
Requirement: Gate unreadable version detail
The OpenSpec gate MUST report the full unreadable version detail when openspec --version exits nonzero.
Scenario: Nonzero version exit in the gate
- WHEN a gate test runs with an
openspec --versionanswer that exits 1. - THEN the
GateCheck.VERSIONfinding detail equals the formattedMESSAGES.openspec.version_unreadabletext.
Requirement: Failing version command returns no version
path_version MUST return no version when the version command exits nonzero, even if stdout holds a version.
Scenario: Failing command with version output
- WHEN the process fake answers
openspec --versionwith return code 1, stdout1.17.0\nand stderrboom\n. - THEN
path_version("openspec")returns the PATH withNoneas the version.
Requirement: Hand-edited skill proves early return
The gate test MUST hand-edit a committed SKILL.md so the regenerate assertion proves the early return.
Scenario: Hand-edited committed skill
- WHEN a gate test hand-edits a committed
SKILL.mdand runs the gate. - THEN the finding detail holds the pinned
openspec update --forcehint and does not holdregenerate.
Requirement: Gate reads nonzero exit as no version
_version_finding MUST read a nonzero exit of openspec --version as no version, as path_version does.
Scenario: Gate nonzero exit with version output
- WHEN the
openspec --versionrun exits 1 and prints a version. - THEN the gate reports the unreadable version finding, not the version-differs finding.
Requirement: Version run timeout
path_version MUST run the version command with DEFAULT_OPENSPEC_COMMAND_TIMEOUT_SECONDS and raise ToolExecutionError on a timeout.
Scenario: Version command timeout
- WHEN the process fake makes
openspec --versiontime out. - THEN
path_versionraisesToolExecutionErrorwith the 120 s timeout in its message.
Requirement: Version run opt-outs
path_version MUST pass CONST_OPENSPEC_OPT_OUT_ENV in the environment of the version run.
Scenario: Version run opt-out environment
- WHEN a test records the environment of the
openspec --versionrun. - THEN the environment holds
DO_NOT_TRACK,OPENSPEC_TELEMETRYandOPENSPEC_NO_UPDATE_CHECK.
Requirement: Help text names openspec only
The help text of --only-missing MUST say that the option reads only the openspec version from PATH.
Scenario: Generated install-tools help
- WHEN
uv run devops docs generateruns and thenuv run devops docs checkruns. - THEN the check exits 0 and
docs/commands/install-tools.mdsays that the option reads theopenspecversion only.
Requirement: Mutation of guarded branches
Each new branch test MUST fail when its guarded branch is deleted.
Scenario: Deleted guarded branch
- WHEN a mutant deletes one guarded branch in
install_tools.py,gate.pyorversions.py. - THEN the targeted
pytestrun fails.
Existing Tool Considered
The alternatives check in the issue body gives not-applicable and names no tool. The change extends the existing pytest tests and the process_fake fixture. It builds no new tool.
Key questions
- Should one shared function hold the nonzero-exit rule for both version readers?: Yes. Put the rule in one helper in
src/devops_cli/tools_lock/versions.pyand call it frompath_versionand_version_finding. (best practice) [sources: src/devops_cli/tools_lock/versions.py:35-37, src/devops_cli/openspec/gate.py:114]- Chosen: Shared helper in versions.py. It keeps the two readers aligned and avoids a second copy of the rule.
- Rejected: Duplicate the rule in gate.py. The two copies can drift, which is the defect C3 reports.
- Should
path_versionuse the OpenSpec timeout and error type?: Yes. UseDEFAULT_OPENSPEC_COMMAND_TIMEOUT_SECONDSand raiseToolExecutionErroronsubprocess.TimeoutExpired, asOpenSpecTool.rundoes. (best practice) [sources: src/devops_cli/openspec/tool.py:66-84, src/devops_cli/config/defaults.py:545]- Chosen: Use the OpenSpec timeout and error type. It bounds the wait to 120 s and gives callers one domain error.
- Rejected: Keep the default 1800 s subprocess timeout. It can block the check for 30 minutes and leaks
subprocess.TimeoutExpired.
- Should the
path_versionrun receive the OpenSpec opt-out environment?: Yes. PassCONST_OPENSPEC_OPT_OUT_ENVin theenvargument of the version run. (best practice) [sources: src/devops_cli/openspec/tool.py:43, src/devops_cli/config/constants.py:5605]- Chosen: Pass the opt-out environment. Every other
openspecrun sets these opt-outs, and a later release can send telemetry before the version exits. - Rejected: Leave the isolated environment unchanged. It drops
DO_NOT_TRACK,OPENSPEC_TELEMETRYandOPENSPEC_NO_UPDATE_CHECK.
- Chosen: Pass the opt-out environment. Every other
- Should the help text say that
--only-missingreads only theopenspecversion?: Yes. Change the help text to say that the option reads theopenspeccommand version on PATH only. (best practice) [sources: src/devops_cli/commands/install_tools.py:392-400, src/devops_cli/lang/en/help.py:2333-2336]- Chosen: Say the
openspecversion only._version_statereads onlyopenspec, so the current text promises more than the code does. - Rejected: Read every tool version. That is a larger change, and no code does it.
- Chosen: Say the
- Should the gate test hand-edit a committed
SKILL.md?: Yes. Add a hand edit of a committedSKILL.mdto the test so theregenerateassertion proves the early return. (best practice) [sources: tests/openspec/test_openspec_gate.py:159-175]- Chosen: Hand-edit a committed
SKILL.md. The currentregenerateassertion passes with no edit and proves nothing. - Rejected: Keep the current assertion.
missing_hintnever holdsregenerate, so the assertion cannot prove the early return.
- Chosen: Hand-edit a committed
- How should the CLI test make
openspec --versionexit nonzero?: Add aversion_returncodeparameter to_record_npmand return that code from its--versionbranch. (best practice) [sources: tests/commands/test_install_tools.py:412-461]- Chosen: Add
version_returncodeto_record_npm. The helper already stands in for npm, and one parameter keeps the fake in one place. - Rejected: Patch
subprocess.runagain in the test. It duplicates the fake and can hide the npm recording behavior.
- Chosen: Add
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 13, 2026
Both touch install-tools version reading, but #5107 fixes the check to read the binary version while the candidate adds tests for unreadable branches and aligns the two version readers.devops-cli-service commentedon Nov 17, 2026
Alternatives check: not-applicable
Class: test. The check makes no search and no model call for an item of this class.
Tool: none found
Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Status set to Ready at 2620fae (see proposed design in issue body).