Repository navigation
Description
Problem Description
Two stage plan gates refuse correct plans. The refusals stop the stage job for items that have a correct plan.
- The module-test gate (fix(roadmap): refuse a behavior group that omits a test it changes #3414, PR fix(roadmap): refuse a behavior group that omits a test it changes #4356, live since 0.107.2) finds the tests of a changed module with
grep_atinsrc/devops_cli/roadmap/stage/stage_overlap.py.grep_atrunsgit grep -w -e <name>, so each dot of the dotted module name is a regex wildcard.devops_cli.lang.en.messagesthen matches the path textdevops_cli/lang/en/messagesintests/commands/test_new.pyand in fixtures. A plan that changessrc/devops_cli/lang/en/messages.pymust then nametests/commands/test_new.py, which does not import the module. A test that holds the name of the module in a string or a path is no test of the module either. - The caller gate (feat(roadmap): name every caller of a changed function #3307) reads a function name from each task text of the form
Add ... toname``. The match runs across sentences and also takes a class (an enum member, a field, a property) as a function.StagedTree.callersthen runs `git grep -F "name("` with no word boundary, so `_fix(` matches `scan_fix(` and `TaskGroup(` matches `asyncio.TaskGroup(`.
Reproduction Steps
- Read the refused replies of the stage job (
<n>.refused.json, written atsrc/devops_cli/roadmap/stage/stage.py:1258) for the items of 2026-11-10 and 2026-11-11. - Count the problems "names no existing test of that module" and "which calls it".
- Compare each problem with the import lines of the named test and with the call sites of the named function at the staged commit.
Expected vs Actual Behavior
Expected: a test counts for a changed module only when it imports that module. The caller gate reads only a parameter that a task adds to a function, and it names only a file that calls that function.
Actual: in 36 refused replies, 18 of 34 module-test problems and 22 of 26 caller problems are false. The module-test gate was in all 4 stage row errors after 17:44Z on 2026-11-10, and in 7 of the last 12 stage failures.
Environment Diagnostics
- DevOps CLI Version: 0.110.0
- Execution Environment: Service (the stage job in the cluster)
Logs, Traces, or Terminal Output
Group 1 changes `src/devops_cli/lang/en/messages.py` and names no existing test of that module. Add `tests/commands/test_new.py` to `reads`, to the `Changes:` line or to a task of the group: the implement job cannot edit a test that the plan leaves out.
The plan changes `TaskGroup` and leaves out `src/devops_cli/ai/review/pool.py`, which calls it.
The plan changes `_fix` and leaves out `src/devops_cli/commands/scan.py`, which calls it.
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Proposed design
Problem statement
Two stage plan gates refuse correct plans. The module-test gate searches a dotted module name as a regular expression. A dot then matches a slash, so a path in a test file counts as a test of the module.
The caller gate reads a function name across sentences. It takes a class or a field as a function. It matches a longer identifier that ends with the name. The fix searches the module name as a literal string and keeps only tests that import the module. It reads callers from the syntax tree of the staged files.
Acceptance criteria
Requirement: A path in a string is no test of the module
The module-test gate SHALL NOT count a file as a test of a changed module when the file holds the module path as text and imports no part of the module.
Scenario: A test holds the module path in a string
- WHEN a plan changes
src/devops_cli/lang/en/messages.pyandtests/commands/test_new.pyholdssrc/devops_cli/lang/en/messages.pywith no import of the module - THEN the gate reports no problem for that group
Requirement: The gate names the importing test
The module-test gate SHALL report a problem that names a test file that imports the changed module, when the plan leaves that file out.
Scenario: The plan leaves out the importing test
- WHEN a test file holds
from devops_cli.lang.en.messages import MESSAGESand the plan that changes the module does not name it - THEN the gate reports a problem that names that test file
Requirement: The module name is a fixed string
grep_at SHALL pass -F to git grep, so the name is a fixed string and no dot of it matches another character.
Scenario: A module name with dots
- WHEN
grep_atsearches fordevops_cli.lang.en.messagesat the staged commit - THEN the search returns the files that hold that literal text and no file that holds only
devops_cli/lang/en/messages
Requirement: The caller gate reads one task
The caller gate SHALL read a function name only from a task whose whole text has the form Add <parameter> to <name>`` and SHALL read no name from a task that holds more text.
Scenario: A task holds a second sentence
- WHEN a task holds the words
Add the field toand the code spanTaskGroup, then a second sentence - THEN the gate reads no function name from that task
Requirement: A class or a field is no function
The caller gate SHALL ignore a name that the staged commit defines as a class, an enum member, a field or a property, and SHALL read only a function or a method.
Scenario: A task names an enum member
- WHEN a task holds the words
Add a member toand the code spanStatus, andStatusis a class at the staged commit - THEN the gate reports no missing caller
Requirement: A longer name is no caller
The caller gate SHALL count a call only when the called name is the whole identifier, so a longer identifier that ends with the name is no call.
Scenario: A longer function name holds the name
- WHEN the plan changes
_fixandsrc/devops_cli/commands/scan.pyholdsdef scan_fix(with no call to_fix - THEN the gate names no file for
_fix
Requirement: A call of another module is no caller
The caller gate SHALL count a call only in a file that imports the function from the module that defines it, so a call of the same short name from another module is no caller.
Scenario: The same short name in another module
- WHEN the plan changes the
TaskGroupof the stage plan andsrc/devops_cli/ai/review/pool.pycallsasyncio.TaskGroupwith no import of the stage module - THEN the gate names no caller in
src/devops_cli/ai/review/pool.py
Requirement: The metric senders keep their files
The fixed-string search SHALL return the same files for a metric name of INSTRUMENTS as the word search returned.
Scenario: A metric name with no dot
- WHEN
metric_senderssearches for a name ofINSTRUMENTSat the staged commit - THEN the search returns each file that holds the name as a whole word
Existing Tool Considered
No alternatives check has run. The ast module of the Python standard library covers the need: it reads the imports and the calls of a Python file, so the gate keeps a test that imports the module and a file that calls the function. It lacks a repository-wide search, so the gate still takes its candidate files from git grep -F.
Key questions
- Which tool reads the imports and the calls of a staged Python file?: The
astmodule of the Python standard library. It parses a file intoImport,ImportFromandCallnodes, and the gate reads them without a run of the code. (best practice) [sources: src/devops_cli/roadmap/stage/stage_overlap.py:204]- Chosen:
astof the Python standard library. It reads the imports and the calls of a file with no dependency and no run of the code. - Rejected:
tree-sitter-python. It adds a parser and a grammar to the path, andastreads the same Python with no extra dependency. - Rejected: A regular expression over the file text. A string, a comment and a longer identifier match, which is the defect of this issue.
- Chosen:
- How does
grep_atkeep a dotted module name literal?: It passes-Ftogit grepand keeps-w, so the name is a fixed string and a whole word.metric_senderskeeps its result, because a metric name holds no dot. (best practice) [sources: src/devops_cli/roadmap/stage/stage_overlap.py:204, src/devops_cli/roadmap/stage/stage_overlap.py]- Rejected: Escape the name with
re.escapebeforegit grep.grep_atpromises the files that hold a name, and a regex escape still matches a comment or a string that holds the name. - Chosen: Pass
-Ftogit grep. The name is a literal, and-Fremoves the wildcard dot for the module gate and keeps the metric search exact. - Rejected: Keep
-w -eand filter the hits in the module gate. The wildcard still returns the path hits, and the gate drops them only by a second text rule.
- Rejected: Escape the name with
- Which test files count as the tests of a changed module?: The files under
tests/that the fixed-string search returns and that import the module. The gate reads each candidate withastand keepsimport <module>,from <module> import <name>andfrom <package> import <module name>. (best practice) [sources: tests/commands/test_new.py]- Rejected: Keep the text hit. A path or a string that holds the name counts as a test, which is the defect of this issue.
- Chosen: Read the candidates with
astand keep the importing files. An import line is the one evidence that a test reads the module. - Rejected: Import each candidate module at runtime. It runs the code and needs the fixtures and the dependencies of the test.
- How does the caller gate read a function name from a task?: It matches the whole task text against
^Add .+ to<name>$, so a second sentence gives no name. It then reads the definition of<name>in the staged tree withast. (best practice) [sources: src/devops_cli/lang/en/messages.py]- Rejected: Search the whole task text for
Add ... toand a code span. The match runs across a sentence break, which is the defect of this issue. - Chosen: Match the whole task text against
^Add .+ to<name>$. A second sentence then gives no name, and the task form stays the one that the gate documents. - Rejected: Take the last code span of the task. A task holds a path or a command in a code span, so the last span is often no function.
- Rejected: Search the whole task text for
- Which names does the caller gate accept as a function?: Only a
FunctionDefor anAsyncFunctionDefat the staged commit, at module level or in a class body. AClassDef, an enum member, anAnnAssignand a property give no caller problem. (best practice) [sources: src/devops_cli/lang/en/messages.py]- Rejected: Take every name as a function. The issue shows an enum member and a field that the gate took as a function.
- Chosen: Look the name up with
astand accept only a function or a method. The staged commit holds the definition, so the gate reads the real kind of the name. - Rejected: Keep a list of the known classes and fields. The list goes stale with the next class that a change adds.
- Which files does the caller gate name as callers?: The files that hold a
Callnode whose name is the function, and that import the function from its defining module. A longer identifier and a call of the same short name from another module give no caller. (best practice) [sources: src/devops_cli/ai/review/pool.py, src/devops_cli/commands/scan.py]- Rejected:
git grep -F "name("._fix(matchesscan_fix(, andTaskGroup(matchesasyncio.TaskGroup(. - Rejected:
git grep -F -w "name(". A word boundary still matchesasyncio.TaskGroup, because the short name is the same. - Chosen:
git grep -F -lfor candidates, thenastcalls that import the name from the defining module. The search bounds the files to read, and the syntax tree and the import prove that the file calls this function.
- Rejected:
- Does the fixed-string search keep the metric senders?: Yes.
metric_senderspasses a name ofINSTRUMENTS, which holds letters, digits and underscores and no dot, so-F -wreturns the same files as-w -e. [sources: src/devops_cli/roadmap/stage/stage_overlap.py] - Where do the tests of the two gates go?:
tests/roadmap/stage/test_roadmap_stage_paths.pyholds the tests ofgrep_at, and the new tests of the two gates go beside it intests/roadmap/stage/. [sources: tests/roadmap/stage/test_roadmap_stage_paths.py] - Where do the import and call readers go?: A new module
src/devops_cli/roadmap/stage/stage_symbols.pyholds the threeastreaders: the imports of a file, the definition of a name, and the calls of a name. The two gates call it, so each rule has one implementation and one test module. (best practice) [sources: src/devops_cli/roadmap/stage/stage_overlap.py:204, src/devops_cli/roadmap/stage/stage.py:1258]- Rejected: Put the readers in
stage_overlap.py. That module names open plans and metric senders, and the readers serve two other gates. - Rejected: Put the readers in
stage.py. The stage job module is already large, and it holds the job and not a file reader. - Chosen: A new
stage_symbols.py. One module holds the three readers, and each gate imports it.
- Rejected: Put the readers in
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 11, 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.(roadmap)scope of the title gives the scope.The gates block correct plans and caused 7 of the last 12 stage failures.Correct plans are rejected, stopping the stage job for valid work.Two grep calls need literal matching and word-boundary fixes in one file.Both concern the module-test gate, but #3414 adds the gate while the candidate fixes its false-positive grep matching.devops-cli-service commentedon Nov 11, 2026
Status set to Ready at 54743c4 (see proposed design in issue body).
dan-petty commentedon Nov 11, 2026
Service data, 48 hours to 2026-11-10T23:45Z: the module-test gate
Count: 7 item refusals with "names no existing test of that module" in the 4 failed stage rounds after the gate went live (#4356, released in 0.107.2, live at 14:35Z on 2026-11-10). The rounds were at 17:44, 18:33, 20:24 and 21:11Z, with 12 item failures in all.
lang/en/messages.pytests/commands/test_new.pylang/en/help.pytests/commands/test_new.pylang/en/messages.pytests/commands/test_new.pyroadmap/plan_check.pytests/invariants/test_workflow_contracts.pylang/en/messages.pytests/commands/test_new.pylang/en/messages.pytests/commands/test_new.pygithub/client.pytests/ai/client/test_batch_2_review_defects.pyFirst and last: 17:44Z on 2026-11-10, and 03:06:45Z on 2026-11-11 (#4028 again, after the window). Still occurring: yes.
Cost: only #4043 had this refusal as its single problem after the second try. The other 6 items also had other refusals (What Changes, Feasibility cite, callers, test path, self-acceptance), so no round failed for this gate alone. The repair round of #4043 did not add the suggested test, also when it was the single problem. 5 of the 14 stage results in the window (12 failures and 2 staged plans) touched
messages.pyorhelp.py, so the gate is a latent blocker for each of those plans.Root cause, with a correction to the fix of this issue. There are two separate causes:
grep_at(src/devops_cli/roadmap/stage/stage_overlap.py:204) runsgit grep -w -l -e <name>with no-F.record_module_tests(src/devops_cli/roadmap/stage/stage_paths.py:377) adds each test that the search returns._unnamed_module_test(stage_paths.py:405) suggeststests[0]in sort order.record_module_testsat HEAD with the livegrep_atand withgit grep -w -F(script:.data/agent/scratch/svc48/t2_module_tests.py):-F: count, first testlang/en/messages.pytests/commands/test_new.pytests/roadmap/implement/test_roadmap_implement_amend.pylang/en/help.pytests/commands/test_new.pyroadmap/plan_check.pytest_workflow_contracts.pytest_workflow_contracts.pygithub/client.pytest_batch_2_review_defects.pytest_batch_2_review_defects.pySo
-Falone removes only thehelp.pyrefusal.test_roadmap_implement_amend.pyreally hasfrom devops_cli.lang.en.messages import MESSAGESon line 5, so an "imports the module" rule also keeps it, and themessages.pyplans stay refused with an unrelated suggestion. Most tests (48) import the registry asfrom devops_cli.lang import MESSAGES, which neither search finds. For a text registry (lang/en/messages.py,lang/en/help.py), the fix must leave it out of the gate or require a more specific match. Theplan_check.pyandgithub/client.pyrefusals are the gate working as designed (the plans named no importing test), with a poor suggestion:tests[0], not the most specific test.Two smaller defects:
stage_paths.py:395-398takes a test file name from any folder, sogithub/client.pyalso getstests/cloudflare/test_client.py.plan_recheck.py:282-296searches with-Fand no-w, so aplan_recheckreplay does not reproduce the livetest_new.pysuggestion. Make the two searches the same before a replay measures the fix.Priority: P1 fits the evidence.
Queries:
devops-cli-service commentedon Nov 11, 2026
Released in v0.112.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.112.0
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 14:13 UTC