Repository navigation
Description
What happened
The implement step runs mypy --strict on each Python file it changed, and the Job stops when mypy reports an error. mypy also reports the errors of the files that the checked file imports. MYPYPATH=src mypy --strict tests gives 739 errors in 220 files. So a step that changes one test file stops on old errors that it did not cause. Live stops of 2026-11-01: #2116 (tests/security/test_scanner_tool_executor.py, import-untyped), #2491 (tests/support/fakes/process.py:310, Too many arguments for "object"), #2166 (tests/core/test_process.py:570, set_process_runner argument type).
The first version of this issue named the --no-editable install and a missing py.typed as the cause. That was wrong: a non-editable install and the editable install of a workstation both give the same 48 errors on the two files (reproduced with a scratch venv; mypy 2.3.1). mypy_path = "src" removes only the import-untyped errors and leaves 10 real, old errors in those files.
The project gate does not check test files with strict mypy: devops ci runs mypy --strict src only. The step checks more than CI does, and it stops on what CI would pass.
What should happen
The step runs the checks of the gate, not stricter ones. It runs mypy --strict on the changed files under src/ and no type check on test files, exactly as devops ci does (read the list of files from the same constant or command that the gate uses, so that a change of the gate changes the step). It runs ruff and the formatter on every changed file, as the pre-commit hooks do.
Acceptance criteria
- A step that changes
tests/security/test_scanner_tool_executor.pydoes not stop on mypy errors of that file. - A step that changes a file under
src/still stops on a newmypy --stricterror in that file. - The step takes the file set of the type check from the gate's own definition, and a test fails if the two differ.
- The decision (the gate's rule, not a baseline) and its reason are in the proposal.
Proposed design
Problem statement
The implement step runs mypy --strict on every changed Python file, including test files. Mypy reports errors from imported files, so a step that changes one test file stops on pre-existing errors it did not cause. The CI gate runs mypy --strict on src/ only and does not type-check test files. The step checks more than the gate and stops on what the gate passes.
Acceptance criteria
Requirement: No mypy on test files
The implement step SHALL NOT run mypy on files under tests/.
Scenario: Step changes a test file
- WHEN A step changes tests/security/test_scanner_tool_executor.py
- THEN The step does not stop on mypy errors of that file
Requirement: Mypy on src files
The implement step SHALL run mypy --strict on changed files under src/ and stop on a new error in that file.
Scenario: Step changes a src file with a type error
- WHEN A step changes a file under src/ that has a new mypy --strict error
- THEN The step stops on that error
Requirement: File set from gate definition
The implement step SHALL read the mypy file set from the same definition that the CI gate uses, and a test SHALL fail if the two differ.
Scenario: Gate and step file sets differ
- WHEN The gate's mypy file set and the step's mypy file set differ
- THEN A test fails
Requirement: Ruff and formatter on all changed files
The implement step SHALL run ruff and the formatter on every changed file, as the pre-commit hooks do.
Scenario: Step changes any file
- WHEN A step changes any file in the repository
- THEN Ruff and the formatter run on that file
Existing Tool Considered
mypy (already in use by the project) covers the type-checking need. The project's devops ci command already defines the correct file set (src/). No new tool or library is needed. The change is in how the project's implement step code invokes mypy: it must read the file set from the gate's own definition instead of hard-coding a broader set.
Key questions
- Where does the CI gate define its mypy file set?: The gate runs mypy --strict src. The definition lives in the devops ci command implementation. The step must read the file set from that same source. [sources: docs/adr/0004-ci-is-the-authoritative-gate.md]
- Should the step type-check only the changed files under src/, or the whole src/ directory?: The step type-checks only the changed files under src/. This matches the gate's scope (src/) while limiting the check to files the step actually modified. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md]
- Chosen: Type-check only changed files under src/. Matches the gate's scope and limits the check to files the step modified. A new error in an unchanged file is not the step's fault.
- Rejected: Type-check the whole src/ directory. Catches errors in any src file, but stops the step on pre-existing errors it did not cause. This is the current broken behavior.
- Rejected: Type-check all changed files including tests/. This is the current behavior. It stops the step on test-file errors and imported-file errors that the gate does not check.
- How does the step stay in sync with the gate's file set?: The step reads the mypy file set from the same constant or command that the gate uses. A change of the gate changes the step automatically. A test asserts the two are equal. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md]
- Chosen: Read from the gate's own constant or command. A change of the gate changes the step automatically. No duplication. A test can assert equality.
- Rejected: Duplicate the file list in the step. The step and gate can drift apart. A change to the gate does not update the step. This is the current source of the bug.
- Should the step run ruff and the formatter on every changed file?: Yes. The step runs ruff and the formatter on every changed file, as the pre-commit hooks do. This is separate from the mypy check and applies to all file types. (proposed)
- Chosen: Run ruff and formatter on every changed file. Matches the pre-commit hooks. Catches style and format issues in any file the step changes.
- Rejected: Run ruff and formatter only on src/ files. Leaves test files and other files unchecked. Inconsistent with the pre-commit hooks.
Open questions
- Where is the implement step's current mypy invocation? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 1, 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.runner, and .github/labels.yml declares no scope/runner label. Add the label to the file to give the scope to this item.CI runner jobs are stopping on false mypy errors, blocking merges for at least 3 of 13 runs on one day.Developers cannot merge code while CI reports false type errors on correct code.Setting mypy_path is a one-line config change, but the build check step needs design and verification against mypy search-order docs.Both fix a tool resolving to the installed copy instead of the checkout, but #2449 fixes PATH for the devops binary in devcontainer while this sets mypy_path for type checking in the runner image.dan-petty commentedon Nov 1, 2026
The item cannot be built as written. The premise is false, and the acceptance criteria cannot pass with
mypy_path = "src". I changed no code.Evidence (commit 0dbd092, mypy 2.3.1, run in a worktree):
The stated cause is wrong. I built a venv with
uv sync --locked --no-editable(as the Dockerfile does).mypy --strict -- tests/security/test_scanner_tool_executor.py tests/support/fakes/process.pygives 48 errors, most of themimport-untyped. The normal editable environment (uv run mypy, same command) gives the same 48 errors. An editable install addssrcthrough a.pthfile. Mypy reads that path as an installed package, and the package has nopy.typedmarker. So a workstation does not differ from the runner.devops cidoes not show it, because it runsmypy --strict srconly: no test file is type-checked in CI.mypy_path = "src"works as the issue says for the import. The mypy source (mypy/modulefinder.py,compute_search_pathsand_find_module) searchespython_pathandmypy_pathbefore the installed packages. WithMYPYPATH=srctheimport-untypederrors go away in both environments.The acceptance criteria still fail. The same command then gives 10 real errors in 5 files. Examples:
tests/security/test_scanner_tool_executor.py:222(Item "None" of "Path | None" has no attribute "is_relative_to"),:656(base_revisiontype),tests/support/fakes/process.py:310and:399(Too many arguments for "object", the error of fix(github): a refused JWT exchange of the GitHub App names GitHub's reason, not a gh login #2491),tests/support/git_recording.py:156(set_process_runnerargument, the error of refactor(security): the unused run_subprocess re-import in security/ruff.py and the private _prepare_cmd alias go, and a ci row fails on a new noqa F401 re-import in src #2166),tests/support/fakes/model.py:302. The error of fix(github): a refused JWT exchange of the GitHub App names GitHub's reason, not a gh login #2491 is not caused by the shadowing.The test code is not clean under
mypy --strict.MYPYPATH=src mypy --strict testsgives 739 errors in 220 files. The implement step runsmypy --stricton each changed Python file, and mypy also reports errors in the files that it imports. So a step that changes a test file fails on old errors that it did not cause, with or withoutmypy_path.The fix needs a different decision: type-clean tests, or a check in the step that fails only on errors that the step added (a baseline), or no
mypy --strictof test files in the step. A person must choose. Amypy_pathchange alone, with a test and a Dockerfile check, would not make one run pass, and the Dockerfile check ontests/security/test_scanner_tool_executor.pywould itself fail on the 10 old errors.devops-cli-service commentedon Nov 1, 2026
Refine cannot set this item to Ready at 0dbd092 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
[-]fix(runner): mypy in the runner Job resolves devops_cli to the installed copy, so strict checks fail on correct code[/-][+]fix(roadmap): the implement step runs the type check of the gate, not strict mypy on every file[/+]devops-cli-service commentedon Nov 1, 2026
Refine cannot set this item to Ready at ae2d8e1 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
dan-petty commentedon Nov 1, 2026
Verified sources for the refine question "Where is the implement step's current mypy invocation?" (read on
origin/main, 2026-11-01):src/devops_cli/roadmap/implement_step.py, function_static_failure. It builds[BIN_UV, "run", BIN_MYPY, "--strict", "--", *files]withfiles = _python_files(changed), the Python files that the step changed (source and tests), afterruff check.src/devops_cli/commands/ci.py, the check spec namedtypecheck(titlemypy (py314 strict), around lines 750 to 766). It type-checkssrc/only, as the commandtypechecksays: "Run mypy static type-checker strictly targeting Python 3.14 over src/."The fix takes the file set and options of the step from the
typecheckspec of the gate.chore(main): release 0.37.4 (#3099)