Skip to content

docs(openspec): plan #2644 catch findings.json validation errors - #3147

Merged
dan-petty merged 2 commits into
mainfrom
fix/2644-a-findings-json-that-does-not
Nov 2, 2026
Merged

dan-petty merged 2 commits into
mainfrom
fix/2644-a-findings-json-that-does-not

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Plans #2644

This plan adds one shared loader for review session files. The loader catches pydantic's validation error and raises the project's ValidationError with the file path and the dotted field path. The four readers of findings.json (review findings, review verify, review intake and review corpus score) will call the loader, so each command ends with one error line and exit code 1, with no traceback.

The plan has two behavior groups. Each group orders its tasks as failing test, then implementation. A git grep check shows that no reader calls model_validate_json itself.

Change: openspec/changes/2644-a-findings-json-that-does-not/

@devops-cli-service
devops-cli-service Bot marked this pull request as ready for review November 2, 2026 02:41
@dan-petty

Copy link
Copy Markdown
Owner

Advisory pre-merge review (automated; a person decides).

Recommendation: hold. The plan has one major gap: group 2 has no failing test and no repeatable check for its two main goals.

Severity Where Problem Evidence Fix
major tasks.md task 2.1 Group 2 changes behavior in four readers (traceback becomes a clean error and exit code). It has no failing test. Its only check is test_session_loader.py, which tests the loader only. It cannot show that the call sites use the loader or that the CLI prints no traceback. The spec scenario "Clean exit on invalid file" and the issue criterion "All four readers use the shared loader" have no check. Task 2.1 ends with "verify that uv run devops ci test tests/review/test_session_loader.py passes". Group 1 already makes that test pass. openspec/config.yaml line 33 says a behavior group orders its tasks as failing test, then implementation. Add a failing CLI test first in tests/commands/test_review.py (RFC 5737 findings.json from the issue) for review findings and review verify. Add a read_session test. Add a repeatable check: ! git grep -n 'ReviewSessionPayload.model_validate_json' src/devops_cli/commands/review.py src/devops_cli/review/handoff.py.
minor tasks.md groups 1 and 2 Groups have no kind. openspec/config.yaml line 33: "Give each group a kind". State behavior for both groups.
minor tasks.md tasks 1.1 and 1.2 Both tasks tell the implementer to write the same test. Task 1.2 mixes implementation and test. Task 1.2 repeats the test text of 1.1. Remove the test text from 1.2. Keep one test task, then one implementation task.
minor task 1.2, src/devops_cli/review/session.py:45 The plan does not say how session.py gets ReviewSessionPayload at run time. It is imported under TYPE_CHECKING only. session.py line 45 sits inside if TYPE_CHECKING:. Name the choice (lazy import in the loader, or loader placement) in design.md.
minor proposal.md Feasibility No command output is recorded. The "pattern to follow" claim is weak: the command-error-exit spec says command modules do not report a DevOpsCLIError themselves. The exit seam already prints the error and sets the exit code. The lens ran the issue reproduction on origin/main: a Rich traceback ending in ValidationError ... network_references.0.reputation.outcome / Field required. The premise is true. Record the reproduction output. State that the loader relies on the exit seam and that no catch is added in the command modules.
minor proposal.md Impact, tasks.md Code and tests that must keep passing are not named. tests/commands/test_review_adjudication.py:321 uses _read_session_file. Line 339 patches devops_cli.commands.review._read_session_file. runner.py:1272 calls handoff.read_session. Name these as must-keep-passing.
nit specs/command-error-exit/spec.md The requirement title is a slug. Other titles are sentences. The text mixes loader behavior and command behavior. Base spec titles are sentences. Use a sentence title. Keep the text to what a person sees.
nit PR body and state The body uses present tense ("now call this loader") but the PR only plans the change. The PR is not a draft. draft:false from the pulls API. AGENTS rule 6 requires a draft. Write the body as a plan. Open plan PRs as drafts.

Good points: all named paths exist; the four readers named are the only ReviewSessionPayload.model_validate_json call sites; Plans #2644 has no closing keyword; the title is short.

Checks that I ran:

  • Read tasks.md in the PR worktree and openspec/config.yaml line 33 (confirms the major finding and the kind finding).
  • The plan lens ran openspec validate 2644-a-findings-json-that-does-not --strict and devops openspec check: both pass.
  • The plan lens reproduced the issue on origin/main and searched the call sites with git grep.
  • I ran no code from the PR branch.

@dan-petty

Copy link
Copy Markdown
Owner

Changes for the review findings (commit 24e8709):

  • Group 2 now starts with a failing CLI test: tests/commands/test_review_invalid_session_file.py, one test with four ids (findings, verify, intake, corpus-score). Each runs the real command on an invalid file and asserts exit code 1, SystemExit, one error line, the file path and the field path. A prototype of the loader made all four pass; all four fail on the base. Note: verify shows no traceback on the base. It exits 1 with a four-line message that has no file path.
  • Task 2.3 adds the call-site check: ! git grep -n 'ReviewSessionPayload.model_validate_json' src/ ':!src/devops_cli/review/session.py' (four lines and exit 1 on the base, no output and exit 0 after).
  • Both groups have a kind (behavior). Task 1.1 is the test only. Task 1.2 is the implementation only.
  • design.md names the run-time import: a lazy import in the loader, because devops_cli.ai.review_schema costs 1.68 s to import and session.py is imported widely.
  • The Feasibility section holds the traceback lines from origin/main. It states that the loader relies on the exit seam, with no new catch in the command modules.
  • Impact names the tests that must keep passing.
  • The spec requirement has a sentence title and describes what a person sees.
  • The PR body starts with Plans #2644 and reads as a plan. The PR stays ready, as requested.

@dan-petty

Copy link
Copy Markdown
Owner

Advisory pre-merge review (automated; a person decides).

Recommendation: merge. The lens found no finding above nit. The two nits are optional.

Findings

Severity Where Problem Evidence Fix
nit openspec/changes/2644-a-findings-json-that-does-not/tasks.md task 1.2 and specs/command-error-exit/spec.md The spec says one error line names the dotted path of each failure. Task 1.2 does not say how the loader joins two or more failures into one line. Both new tests use a file with one failure. Tasks 1.1 and 2.1 use one missing field (network_references.0.reputation.outcome). Task 1.2 says only that the message names the file path and the dotted loc of each error. State the join in task 1.2 (for example ; between failures). Or add a case with two failures to test_the_loader_names_the_file_and_the_failing_field.
nit specs/command-error-exit/spec.md The new requirement is about review session files and names four review commands. The capability command-error-exit covers the generic exit seam for any DevOpsCLIError. A review-* capability may fit better. The delta passes validation, so this is a placement question only. openspec/specs/command-error-exit/spec.md Purpose text. Existing capabilities: review-finding-state, review-filed-findings, review-merged-code. Keep it, or move the ADDED requirement to a review-* capability. The owner can decide.

Checks that I ran

  • Paths: each file in Reads and Changes exists at origin/main (d5dc921) or is marked new. New tests sit in the mirror directories tests/review/ and tests/commands/.
  • Premise: I ran the issue reproduction with a temporary data directory and no network. It gives a Rich traceback that ends in ValidationError ... network_references.0.reputation.outcome ... Field required, and exit 1. This matches the issue.
  • Call sites: git grep shows four model_validate_json sites, at the lines that the proposal gives (review.py 1122, 1163, 2066; handoff.py 112).
  • Exit seam: OTelTyper and _report_devops_error in core/cli.py print exc.message and exit with exc.exit_code. verify_finding and corpus score already catch the project's ValidationError (review.py lines 1278 and 2260).
  • Prototype (scratch only, worktree untouched): with the project's ValidationError raised, findings, verify, intake --dry-run and corpus score each exit 1 with one line that has the path and the field.
  • Scope: all five acceptance criteria of the issue map to groups 1 and 2. Nothing extra is added.
  • Test rule: both groups are behavior groups and start with a failing test. The failing-on-base claims are true (ImportError for the new function; a traceback or a four-line message with no path).
  • Order: group 1 adds an unused function, so tests pass after it. Group 2 uses it.
  • openspec validate 2644-... --strict passes. uv run devops openspec check passes.
  • The grep check in task 2.3 prints the four base hits and exits 1 on base, as the task says.
  • Tests that must keep pass are named, including the patch of _read_session_file at test_review_adjudication.py line 339.
  • PR hygiene: the body starts with Plans #2644 and has no closing keyword. The title summary is 48 characters. The PR is a draft.
  • Design: the generic ValidationError is reasoned in design.md. No review-specific error type fits. The inline import is justified by the TYPE_CHECKING import in session.py. I measured the schema import at 0.64 s against the 1.68 s in the design. This is cache variation and does not change the decision.

@dan-petty
dan-petty merged commit 853987e into main Nov 2, 2026
20 checks passed
@dan-petty
dan-petty deleted the fix/2644-a-findings-json-that-does-not branch November 2, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant