Description
Problem Description
devops roadmap eval jev --from-shadow stops with StopIteration when a mark intake.jev_shadow holds a probability above 1 or below 0. The report must count such a mark as unreadable and go on.
ShadowAnswerinsrc/devops_cli/roadmap/intake/intake_jev_shadow.pyis aNamedTuplewithprobability: floatand no bounds.ShadowObservation.from_markaccepts1.5and-0.1._bandinsrc/devops_cli/roadmap/jev_shadow_report.pycallsnext(...)overBANDS, which cover only[0, 1.01). A value out of range has no band, sonextraisesStopIteration.observed_issuescatches onlyValidationError, so the bound must be in the model.
Intake does not write such a value: the System One model checks that each probability is in [0, 1]. But the mark is in the job record of the issue body on GitHub, and a person or a tool can change the body. The report reads every issue of the repository, so one bad mark stops the whole report.
Reproduction Steps
- Read the mark
{"at":"2026-11-10T12:00:00Z","answers":{"priority":["P1-High",1.5,"P2-Medium"]}}withShadowObservation.from_mark. - Give the answer to
_count_labelofjev_shadow_reportwith the final labelP1-High.
Expected vs Actual Behavior
Expected: from_mark raises ValidationError, and the report counts the mark in unreadable.
Actual: from_mark accepts the mark, and _count_label raises StopIteration. The same occurs for -0.1.
Environment Diagnostics
devops-cli at commit 6cf78e7 of main. Python 3.14. The error does not depend on the host.
Logs, Traces, or Terminal Output
accepted ShadowAnswer(jev='P1-High', probability=1.5, triage='P2-Medium')
report: StopIteration
report neg: StopIteration
Proposed fix
Bound the field: probability: Annotated[float, Field(ge=0, le=1)] in ShadowAnswer. Then from_mark refuses the mark with ValidationError, and observed_issues counts it as unreadable. Test first: a mark with 1.5 and a mark with -0.1 count in unreadable, and the report of the other marks is the same.
Pre-Submission Checklist
- No sensitive credentials, private keys or internal tokens are in this report.
- I searched the existing issues and pull requests. No duplicate exists.
Source: #4438
Proposed design
Problem statement
A shadow mark in an issue body can hold a probability outside [0, 1]. The report calls _band and next raises StopIteration, so one bad mark stops the whole Jev shadow report. The change bounds the field in the model, counts the mark as unreadable, and lets the report continue.
Acceptance criteria
Requirement: Shadow mark above one
ShadowObservation.from_mark SHALL reject a mark with a probability above 1 by raising ValidationError.
Scenario: High probability mark
- WHEN A mark holds
"probability": 1.5for a field. - THEN
ShadowObservation.from_markraisesValidationError.
Requirement: Shadow mark below zero
ShadowObservation.from_mark SHALL reject a mark with a probability below 0 by raising ValidationError.
Scenario: Negative probability mark
- WHEN A mark holds
"probability": -0.1for a field. - THEN
ShadowObservation.from_markraisesValidationError.
Requirement: Unreadable mark counted
observed_issues SHALL count each rejected mark in unreadable and SHALL continue with the other issues.
Scenario: One out-of-range mark among valid marks
- WHEN
observed_issuesreads one issue withprobability1.5and one issue with a valid mark. - THEN It returns one
Observedrecord andunreadableequal to 1.
Requirement: Valid report unchanged
report_of SHALL give the same field, band and duplicate counts for valid marks as before the change.
Scenario: Valid marks only
- WHEN
report_ofruns on the same valid marks before and after the change. - THEN The
fields,bandsandduplicatecounts are equal.
Requirement: Probability one in last band
report_of SHALL place a probability of 1.0 in the last band.
Scenario: Probability at the upper bound
- WHEN
report_ofreads a valid mark withprobability1.0 and a final label. - THEN The last band's total is 1.
Requirement: Jev out-of-range counts as error
ShadowIntakeModel.observation SHALL count a Jev answer with a probability outside [0, 1] as jev_error and SHALL return None.
Scenario: Jev returns an out-of-range probability
- WHEN The Jev decision model returns a probability of
1.5. - THEN
observationreturnsNoneand each asked field countsjev_error.
Existing Tool Considered
No alternatives check has run. Pydantic, already a dependency, covers the need: Annotated[float, Field(ge=0, le=1)] on ShadowAnswer.probability rejects out-of-range marks at ShadowObservation.from_mark. The change builds no new validation code.
Key questions
- Does
ShadowObservation.from_markrun Pydantic validation on eachShadowAnswerfield?: Yes.from_markcallsmodel_validate_json, andanswersis typedMapping[str, ShadowAnswer]. Pydantic validates theAnnotatedfield constraint. [sources: src/devops_cli/roadmap/intake/intake_jev_shadow.py, src/devops_cli/roadmap/intake/intake_jev_shadow.py:70] - Where must the probability bound live so that
observed_issuescounts the mark as unreadable?: InShadowAnswer.probability, becauseobserved_issuescatches onlyValidationError. (best practice) [sources: src/devops_cli/roadmap/jev_shadow_report.py, src/devops_cli/roadmap/intake/intake_jev_shadow.py:70]- Chosen: Bound the field in ShadowAnswer. The model rejects the mark with ValidationError, and observed_issues already counts that error as unreadable.
- Rejected: Guard only in _band. observed_issues catches no such error, and the report would still stop or misclassify the mark.
- Should
ShadowAnswerstay aNamedTupleor become a Pydantic model?: KeepShadowAnsweraNamedTupleand addAnnotated[float, Field(ge=0, le=1)]toprobability. (best practice) [sources: src/devops_cli/roadmap/intake/intake_jev_shadow.py:70]- Chosen: Keep NamedTuple and add Annotated bound. The change is small and keeps tuple construction and unpacking for existing callers.
- Rejected: Convert ShadowAnswer to a BaseModel. It changes construction and unpacking for every caller and adds risk beyond the defect.
- Rejected: Add a guard in _band only. It does not make the mark unreadable and does not use the existing ValidationError path.
- Should
ShadowIntakeModel.observationcatchValidationErrorfrom the new bound?: Yes. AddValidationErrorto the caught exceptions so a Jev answer outside [0, 1] counts asjev_errorand does not crash intake. (best practice) [sources: src/devops_cli/roadmap/intake/intake_jev_shadow.py]- Chosen: Catch ValidationError as jev_error. The new bound can raise during observation, and the existing failure path already counts jev_error.
- Rejected: Let ValidationError propagate. A bad Jev answer would stop intake instead of counting a failed field.
- Does a probability of 1.0 stay in the last band?: Yes.
Field(le=1)accepts 1.0, andBANDSends at 1.01, so_band(1.0)returns the last band. [sources: src/devops_cli/roadmap/jev_shadow_report.py:42, src/devops_cli/roadmap/jev_shadow_report.py:136] - Should
_bandget a fallback for an out-of-range value?: No. The model bound makes the mark unreadable before_bandruns. A fallback would hide a bad mark in a band. (best practice) [sources: src/devops_cli/roadmap/jev_shadow_report.py, src/devops_cli/roadmap/jev_shadow_report.py:136]- Chosen: Keep _band as is. The model bound is the single validation point, and the report counts the mark as unreadable.
- Rejected: Clamp or default an out-of-range value. It would put an invalid mark into a probability band and hide the defect.
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.One bad mark stops the whole report, but the report is a diagnostic tool and no data is lost.The report is a diagnostic aid; one bad mark blocking it is annoying but not a workflow blocker.The fix is one Pydantic field constraint on a single NamedTuple field plus two test cases.Both fix a bad value stopping shadow processing, but 4450 fixes a partial reply in the intake round while this fixes an out-of-range probability in the shadow report.devops-cli-service commentedon Nov 11, 2026
Status set to Ready at 2f6114f (see proposed design in issue body).
devops-cli-service commentedon Nov 11, 2026
Released in v0.112.2: https://github.com/dan-petty/devops-cli/releases/tag/v0.112.2
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 17:36 UTC