Description
Problem
On 2026-11-18, a live devops roadmap eval stage case on origin/main failed with RoadmapStageError. The error lists every test file of the repository, each with unhandled reference to 'and':
tests/ai/agents/test_agent.py: unhandled reference to 'and'. tests/ai/agents/test_agent_invariants.py: unhandled reference to 'and'. ...
find_removed_names in src/devops_cli/roadmap/stage/stage_removal_references.py keeps each backticked span after a removal verb when str.isidentifier() is true. "and".isidentifier() is true, so a plan line such as "drops and from the title" makes and a removed name. scan_removal_references then finds and in every Python file and the stage item fails. A Python keyword is never an entity that a plan removes.
Expected behavior
find_removed_namesskips a span that is a Python keyword (keyword.iskeyword) or a soft keyword (keyword.issoftkeyword).- A test shows that a plan text with "drops
andfrom" gives no removed name, and that "removesold_helper" still givesold_helper.
Related
- feat(roadmap): Check test references to entities a plan removes #3324 (the check), fix(roadmap): A schema limit of the plan reply never fails a stage item #6319 (stage failures that do not come from a bad plan).
Alternatives check of 2026-11-18: covers.
Tool: python/cpython (https://github.com/python/cpython), NOASSERTION, last activity 2026-11-18, maintained.
Reason: Searches found no third-party library, but Python's own standard-library keyword module already answers the question exactly (iskeyword, issoftkeyword), and the issue itself names those calls as the fix.
Covers:
- Rejects hard keywords such as
and,forandclass - Rejects soft keywords such as
match,caseand_ - Ships with Python, so no new dependency or pin
Lacks:
- Does not find backticked spans after a removal verb
- Does not test whether a span is an identifier (
str.isidentifier) - Knows nothing of plan text or the files to scan
Proposed design
Problem statement
find_removed_names keeps every backticked span after a removal verb whose text passes str.isidentifier(). "and".isidentifier() is true, so a plan line such as "drops and from the title" makes and a removed name, scan_removal_references finds it in every Python file, and the stage fails with RoadmapStageError. A Python hard or soft keyword is never an entity that a plan removes, so the extraction excludes them.
Acceptance criteria
Requirement: Hard keyword skip
find_removed_names SHALL exclude a backticked span that is a Python hard keyword.
Scenario: A plan drops and
- WHEN
find_removed_namesreceives the text "The change dropsandfrom the title." - THEN The test asserts that the returned set is empty.
Requirement: Soft keyword skip
find_removed_names SHALL exclude a backticked span that is a Python soft keyword.
Scenario: A plan drops match
- WHEN
find_removed_namesreceives the text "The change dropsmatchfrom the title." - THEN The test asserts that the returned set is empty.
Requirement: Passive keyword skip
find_removed_names SHALL exclude a keyword span in the passive removal form as well as the active one.
Scenario: A plan says and is removed
- WHEN
find_removed_namesreceives the text "andis removed from the title." - THEN The test asserts that the returned set is empty.
Requirement: Ordinary identifier kept
find_removed_names SHALL keep a backticked span that is an ordinary Python identifier after a removal verb.
Scenario: A plan removes old_helper
- WHEN
find_removed_namesreceives the text "The change removesold_helper." - THEN The test asserts that the returned set is
{"old_helper"}.
Requirement: Stage scan survives a keyword span
scan_removal_references SHALL report no unhandled test reference for a plan whose only removed span is a Python keyword.
Scenario: A change folder drops and
- WHEN
scan_removal_referencesruns on a change whoseproposal.mdsays "dropsandfrom the title" and on a repository whose test file containsand. - THEN The test asserts that
has_test_failuresis false andunhandled_testsis empty.
Existing Tool Considered
python/cpython (https://github.com/python/cpython) is the open, maintained tool that covers this need: the alternatives block of 2026-11-18 in the issue body records the verdict covers and states what the tool lacks. The change calls keyword.iskeyword and keyword.issoftkeyword in find_removed_names.
Key questions
- Should the item adopt the
keywordmodule of python/cpython, or keep its own keyword list?: Adopt the standard-librarykeywordmodule: guard each candidate span withkeyword.iskeyword(span)orkeyword.issoftkeyword(span)next to the existingspan.isidentifier()check, and addimport keyword. The project floor is Python 3.14 (pyproject.toml:10), which ships both calls, so no dependency or pin is added. (best practice) [sources: src/devops_cli/roadmap/stage/stage_removal_references.py:74, src/devops_cli/roadmap/stage/stage_removal_references.py:84, pyproject.toml:10]- Chosen: Standard-library
keywordmodule (python/cpython). It rejects hard and soft keywords exactly, ships with the supported Python floor, and needs no new dependency or pin. - Rejected: Hard-coded keyword tuple. It duplicates CPython's list and drifts from the interpreter, and it misses soft keywords unless it is maintained by hand.
- Rejected: Third-party parser library such as libcst. It adds a dependency for a one-line membership test that the standard library already answers.
- Rejected: Keep only
str.isidentifier(). It acceptsand, which is the cause of the stage failure.
- Chosen: Standard-library
- Where should the keyword guard go?: Put the rule in one private helper
_is_removable_identifier(span)that strips the span and returns true only when it is an identifier that is neither a hard nor a soft keyword. Call it from both the passive match loop and the active match loop, so the two paths cannot drift apart. (best practice) [sources: src/devops_cli/roadmap/stage/stage_removal_references.py:72, src/devops_cli/roadmap/stage/stage_removal_references.py:77]- Chosen: One private helper used by both match paths. The passive and active loops share one rule, so a later change reaches both paths at once.
- Rejected: An inline condition in each loop. The same rule appears twice and can change in one place only.
- Rejected: Filter the final set. The scan builds its patterns from the set, and a final filter hides which span the extraction rejected.
- Why does the current code treat
andas a removed name?: Both match paths accept a span whenstr.isidentifier()is true alone.str.isidentifier()returns true forand, so the span is added to the removed names and later matched in every Python file. [sources: src/devops_cli/roadmap/stage/stage_removal_references.py:74, src/devops_cli/roadmap/stage/stage_removal_references.py:84, src/devops_cli/roadmap/stage/stage_removal_references.py:185]
Open questions
- The alternatives check found that
https://github.com/python/cpythoncovers this item. Adopt the tool, or keep the item and give the reason. (a person decides)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 18, 2026
A live stage job on origin/main fails with RoadmapStageError, which is a service job failure.#3324 added the removal-reference check; this candidate fixes a bug in that check where Python keywords are treated as removed names.devops-cli-service commentedon Nov 18, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (10)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 18, 2026
Owner question: The alternatives check found that
https://github.com/python/cpythoncovers this item. Adopt the tool, or keep the item and give the reason. (a person decides)Options
Recommendation: Decide the question: only a person can answer it.
Evidence
dan-petty commentedon Nov 19, 2026
Decision on the owner question: adopt the tool. The fix uses the standard-library
keywordmodule of python/cpython.Reason: the owner's standing direction is "follow best practices". The module is part of Python 3.14, the project floor, so the fix adds no dependency. A hand-made keyword list would not follow new Python releases.
fix(roadmap): Tell the stage planner what counts as source code (#6335)
devops-cli-service commentedon Nov 19, 2026
Released in v0.179.2: https://github.com/dan-petty/devops-cli/releases/tag/v0.179.2
devops-cli-service commentedon Nov 19, 2026
Live since 2026-11-19 05:06 UTC