Skip to content

fix(roadmap): a shadow mark out of range stops the shadow report #4469

Closed

Description

@dan-petty

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.

  • ShadowAnswer in src/devops_cli/roadmap/intake/intake_jev_shadow.py is a NamedTuple with probability: float and no bounds. ShadowObservation.from_mark accepts 1.5 and -0.1.
  • _band in src/devops_cli/roadmap/jev_shadow_report.py calls next(...) over BANDS, which cover only [0, 1.01). A value out of range has no band, so next raises StopIteration.
  • observed_issues catches only ValidationError, 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

  1. Read the mark {"at":"2026-11-10T12:00:00Z","answers":{"priority":["P1-High",1.5,"P2-Medium"]}} with ShadowObservation.from_mark.
  2. Give the answer to _count_label of jev_shadow_report with the final label P1-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.5 for a field.
  • THEN ShadowObservation.from_mark raises ValidationError.

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.1 for a field.
  • THEN ShadowObservation.from_mark raises ValidationError.

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_issues reads one issue with probability 1.5 and one issue with a valid mark.
  • THEN It returns one Observed record and unreadable equal 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_of runs on the same valid marks before and after the change.
  • THEN The fields, bands and duplicate counts 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_of reads a valid mark with probability 1.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 observation returns None and each asked field counts jev_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_mark run Pydantic validation on each ShadowAnswer field?: Yes. from_mark calls model_validate_json, and answers is typed Mapping[str, ShadowAnswer]. Pydantic validates the Annotated field 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_issues counts the mark as unreadable?: In ShadowAnswer.probability, because observed_issues catches only ValidationError. (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 ShadowAnswer stay a NamedTuple or become a Pydantic model?: Keep ShadowAnswer a NamedTuple and add Annotated[float, Field(ge=0, le=1)] to probability. (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.observation catch ValidationError from the new bound?: Yes. Add ValidationError to the caught exceptions so a Jev answer outside [0, 1] counts as jev_error and 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, and BANDS ends 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 _band get a fallback for an out-of-range value?: No. The model bound makes the mark unreadable before _band runs. 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

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  2. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. One bad mark stops the whole report, but the report is a diagnostic tool and no data is lost.
    • Value: Medium. The report is a diagnostic aid; one bad mark blocking it is annoying but not a workflow blocker.
    • Effort: Low. The fix is one Pydantic field constraint on a single NamedTuple field plus two test cases.
    • Related: fix(roadmap): a partial Jev reply stops the intake round #4450, which asks for a different change. 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.
  3. added
    priority/p2-medium
    on Nov 11, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 2f6114f (see proposed design in issue body).

  6. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 11, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 11, 2026
  8. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-11 17:36 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions