Repository navigation
Description
Problem
read_change in src/devops_cli/roadmap/plan_read.py reads the criteria list outside its try block. A criterion with Group 0 makes StageCriterion raise pydantic.ValidationError. The error leaves the reader. plan-check and plan-recheck catch only PlanReadError, so the command ends with an uncaught error.
Reproduction
On origin/main at d254410:
- Render a change folder with one criterion, such as
{"criterion": "The command prints one line for each problem", "group": 1}. - In
tasks.md, changeGroup 1:toGroup 0:. - Call
read_changeon the files.
Result: ValidationError: 1 validation error for StageCriterion.
Expected
The reader raises PlanReadError that names tasks.md and gives the reason. The plan check then reports the file and goes on.
Found by
The premise check of #3498.
Proposed design
Problem statement
A criterion with Group 0 makes StageCriterion raise a pydantic ValidationError inside read_change. The error escapes the reader because _criteria runs outside the try block. plan-check and plan-recheck catch only PlanReadError, so they end with an uncaught error. The reader must convert the validation error into PlanReadError that names tasks.md, so the commands report the file and continue.
Acceptance criteria
Requirement: Criterion validation error becomes a plan read error
The plan reader SHALL raise PlanReadError when StageCriterion rejects a criterion line.
Scenario: Criterion with Group 0
- WHEN A change folder has the criterion line
Group 0: The command prints one line for each problemintasks.md. - THEN
read_changeraisesPlanReadErrorwhosepathistasks.mdand whosereasonnames thegroupfield and the validation problem.
Requirement: Plan check reports an invalid criterion
The plan check SHALL report the tasks.md file and continue when a criterion line has an invalid group number.
Scenario: plan-check with Group 0
- WHEN
devops roadmap plan-checkreads a change folder whosetasks.mdhas the criterion lineGroup 0: The command prints one line for each problem. - THEN The command prints a problem that names
tasks.mdand exits without an uncaughtValidationError.
Requirement: Plan recheck reports an invalid criterion
The plan recheck SHALL report the tasks.md file and continue when a criterion line has an invalid group number.
Scenario: plan-recheck with Group 0
- WHEN
devops roadmap plan-recheckreads a change folder whosetasks.mdhas the criterion lineGroup 0: The command prints one line for each problem. - THEN The command prints a problem that names
tasks.mdand exits without an uncaughtValidationError.
Requirement: Valid criterion groups still parse
The plan reader SHALL keep a criterion line whose group number is valid.
Scenario: Valid Group 1 criterion
- WHEN A change folder has the criterion line
Group 1: The command prints one line for each problemintasks.md. - THEN
read_changereturns aStageProposalwhosecriterialist holds oneStageCriterionwithgroupequal to 1.
Existing Tool Considered
No alternatives check has run. No open, maintained tool or library covers this need: the defect is in this repository's own read_change and _criteria functions. No tool matches the need, so the plan fixes the existing code instead. The fix is about 5 lines. The written cost to build, keep and fix it is under 500 tokens and under 1 hour elapsed.
Key questions
- Where does
read_changeconvert theStageCriterionValidationErrorintoPlanReadError?: Convert it in_criteriawithtryandexcept ValidationError. RaisePlanReadError(_TASKS, _reasons(exc))from the handler. This matches_read_group, which converts theValidationErrorof a task group where the group is built. (best practice) [sources: src/devops_cli/roadmap/plan_read.py, openspec/changes/archive/2026-11-04-3482-the-plan-reader-reports-each-bad-plan/design.md]- Chosen: Convert in
_criteria. It keeps the conversion next to the constructor that raises, as_read_groupdoes. - Rejected: Wrap the
_criteriacall inread_change. It leaves_criteriaable to raise a pydantic error and separates the error from its cause.
- Chosen: Convert in
- What reason text does the new
PlanReadErrorcarry?: Reuse_reasons(exc). It renders each pydantic error on one line with its location and message, and it adds no trace and no URL. (best practice) [sources: src/devops_cli/roadmap/plan_read.py]- Chosen: Reuse
_reasons(exc). It gives the one-line form that the reader already uses for a bad task group. - Rejected: Use
str(exc). It includes the input value and a documentation link, and it spans several lines. - Rejected: Join
exc.errors()by hand. It duplicates_reasonsand risks a different format.
- Chosen: Reuse
- Should
StageCriterionacceptGroup 0instead of rejecting it?: No. Keep the group constraint inStageCriterionand convert itsValidationErrorin the reader. A group number names a task group, and the groups start at 1. (best practice) [sources: src/devops_cli/roadmap/stage_criteria.py, src/devops_cli/roadmap/step_files.py, src/devops_cli/roadmap/plan_read.py]- Chosen: Keep the constraint and convert the error. It reports a malformed plan and keeps the criterion tied to a real task group.
- Rejected: Relax
StageCriterionto acceptGroup 0. It hides a malformed plan and lets a criterion point at no task group.
- Do
plan-checkandplan-recheckcatch onlyPlanReadError?: Yes. Both commands catchPlanReadError, so a pydanticValidationErrorfromread_changeescapes them. The fix makesread_changeraisePlanReadErrorfor an invalid criterion. [sources: src/devops_cli/roadmap/plan_check.py, src/devops_cli/roadmap/plan_recheck.py] - Does
_criteriarun outside thetryblock ofread_change?: Yes.read_changecalls_criteriabefore thetryblock that wraps theStageProposalconstruction. AValidationErrorfrom_criteriatherefore leaves the reader. [sources: src/devops_cli/roadmap/plan_read.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 5, 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.An uncaught error crashes plan-check and plan-recheck for any plan with a Group 0 criterion.It breaks two commands for a specific but valid input, so users see a traceback instead of a report.The fix is to move the criteria read inside the existing try block or add a targeted catch.Both concern read_change in plan_read.py letting a ValidationError escape, but the candidate is a new Group-0 case found after #3482 closed.devops-cli-service commentedon Nov 6, 2026
Status set to Ready at bd65ef6 (see proposed design in issue body).
devops-cli-service commentedon Nov 7, 2026
Released in v0.77.1: https://github.com/dan-petty/devops-cli/releases/tag/v0.77.1
devops-cli-service commentedon Nov 7, 2026
Live since 2026-11-07 05:06 UTC