Repository navigation
Description
Problem Description
A findings.json that does not validate against ReviewSessionPayload ends the command with a pydantic traceback. No reader reports the file name or says what to do.
Four readers load the file with ReviewSessionPayload.model_validate_json and no handler. They are devops review findings (commands/review.py, the list), _read_session_file (verify and the other verdict commands), _session_findings (the benchmark) and read_session (review/handoff.py). There is no single loader, so one fix in one place does not cover them.
The case that shows it today: the change for #2504 makes NetworkReputationRecord.outcome a required field. A findings.json written before #2289 holds network_references[].reputation records that have no outcome. Such a file no longer loads. Any later schema change gives the same result for the sessions that exist.
Reproduction Steps
- Make a data directory
<data>and a session directory<data>/reviews/20261001-000000. - Write
findings.jsonthere with this text:{"findings": [], "network_references": [{"target": "203.0.113.7", "reference_type": "ip", "reputation": {"target": "203.0.113.7", "ip": "203.0.113.7", "reputation_summary": "Clean"}}]}. - Run
DEVOPS_CLI_DATA_DIR=<data> uv run devops review findings.
Expected vs Actual Behavior
Expected: the command reports the validation error as the existing review error type. The message names the file and the field (network_references.0.reputation.outcome), and the command ends with an exit code and no traceback.
Actual: a Rich traceback that ends with ValidationError: 1 validation error for ReviewSessionPayload.
Environment Diagnostics
devops-cli 0.16.0 with the change for #2504 applied, Linux, Python 3.14. The probe used a temporary data directory and made no network request.
Logs, Traces, or Terminal Output
ValidationError: 1 validation error for ReviewSessionPayload
network_references.0.reputation.outcome
Field required [type=missing, ...]
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.
Source: found while working on #2504.
Proposed design
Problem statement
Four readers of findings.json call ReviewSessionPayload.model_validate_json without catching ValidationError. When a file fails validation after a schema change, the command ends with a raw pydantic traceback. The user sees no file name, no field path, and no guidance on what to do.
Acceptance criteria
Requirement: Shared loader catches validation errors
A single shared loader function SHALL catch pydantic.ValidationError and raise the project's existing review error type.
Scenario: Loader raises review error on invalid file
- WHEN A findings.json file fails ReviewSessionPayload validation
- THEN The loader raises the project's review error type, not ValidationError
Requirement: Error message names the file
The error message SHALL include the file path of the findings.json that failed validation.
Scenario: Message contains file path
- WHEN A findings.json file fails validation
- THEN The error message contains the full path to that file
Requirement: Error message names the failing field
The error message SHALL include the dotted field path of each validation failure.
Scenario: Message contains field path
- WHEN A required field is missing in a findings.json file
- THEN The error message contains the dotted path such as network_references.0.reputation.outcome
Requirement: No traceback on validation failure
The command SHALL exit with a non-zero exit code and no traceback when findings.json fails validation.
Scenario: Clean exit on invalid file
- WHEN A findings.json file fails validation
- THEN The process exits with a non-zero code and the output contains no Python traceback
Requirement: All four readers use the shared loader
All four readers of findings.json SHALL call the shared loader instead of model_validate_json directly.
Scenario: All call sites updated
- WHEN The source is inspected
- THEN The findings list, _read_session_file, _session_findings, and read_session all call the shared loader
Existing Tool Considered
No check has run. Pydantic, which the project already uses for ReviewSessionPayload, provides ValidationError with structured field-path data. The project already has a review error type for command-level errors. No additional library is needed. The written cost is one shared loader function of about 15 lines, four call-site changes, and one test.
Key questions
- What is the project's existing review error type?: The body names it as 'the existing review error type.' The class is defined in the review command module. Refine must confirm the exact class name and its exit-code behavior from the source. [sources: src/devops_cli/commands/review.py]
- Should the fix create a single shared loader or add try/except at each of the four sites?: Create a single shared loader. The body states 'There is no single loader, so one fix in one place does not cover them,' which identifies the missing loader as the root cause. A shared loader gives one place to format the message and one place to test. (best practice) [sources: src/devops_cli/commands/review.py:1151, src/devops_cli/commands/review.py:2028, src/devops_cli/ai/review/exporter.py:166]
- Chosen: Single shared loader function. One place to format the error, one place to test, and the body identifies the missing loader as the root cause.
- Rejected: try/except at each of the four call sites. Duplicates the formatting logic four times and leaves room for a fifth reader to miss the handler.
- What must the error message contain?: The file path and the dotted field path of each validation failure. The body gives the example network_references.0.reputation.outcome. [sources: src/devops_cli/commands/review.py]
- What exit code does the command produce on this error?: A non-zero exit code set by the project's existing review error type. The body requires 'an exit code and no traceback.' Refine must confirm the exact code from the error class. [sources: src/devops_cli/commands/review.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Oct 29, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The command ends with an unhandled traceback instead of a clean error message; this is a defect in error handling.The user can still read the traceback, so the command is not fully broken, but the experience is poor and the fix is straightforward.A clean error message that names the file and field helps users diagnose schema mismatches without reading a stack trace.Four separate readers load findings.json with no shared loader, so the fix touches multiple call sites.Both deal with a pydantic ValidationError crashing a review command, but #640 fixes a type annotation in ReviewProfile while the candidate adds error handling to four findings.json readers.devops-cli-service commentedon Oct 30, 2026
Status set to Ready at 0b7e190 (see proposed design in issue body).
devops-cli-service commentedon Nov 2, 2026
Staged: branch
fix/2644-a-findings-json-that-does-not, draft pull request #3147. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:
docs(openspec): add failing tests and call-site check to plan #2644
docs(openspec): plan #2644 catch findings.json validation errors (#3147)
[-]fix(review): a findings.json that does not validate ends the command with a traceback[/-][+]fix(review): catch findings.json validation errors[/+]dan-petty commentedon Nov 6, 2026
The job shortened the title of this item. The summary had 72 characters, and the limit is 60. The type and the scope stay.
fix(review): a findings.json that does not validate ends the command with a tracebackfix(review): catch findings.json validation errorsdevops-cli-service commentedon Nov 6, 2026
Released in v0.73.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.73.0
devops-cli-service commentedon Nov 6, 2026
Live since 2026-11-06 22:09 UTC