Skip to content

test(cli): cover partial-batch --json, --apply-same and model-not-found paths (#468) - #503

Merged
jasonssdev merged 1 commit into
mainfrom
test/468-partial-batch-coverage
Aug 9, 2026
Merged

test(cli): cover partial-batch --json, --apply-same and model-not-found paths (#468)#503
jasonssdev merged 1 commit into
mainfrom
test/468-partial-batch-coverage

Conversation

@jasonssdev

Copy link
Copy Markdown
Owner

Closes items 1-3 of the partial-batch follow-up list. Refs #468, which stays open for items 4-5.

What was unproved

adjudicate's docstring states that every output mode (report, --json, --apply, --apply-same) processes batch.results exactly as a complete run before reporting the failure. Only the default report and --apply had partial-batch tests. And curate's OllamaModelNotFound re-raise arm was exercised only through a sequencer-level fake stage that raises directly — never through a real partial AdjudicationBatch.

The docstring is left intact. These tests prove the claim rather than weaken it.

The three tests

Test Covers
test_adjudicate_json_partial_batch_emits_completed_verdicts_then_exits_one --json: stdout parses to exactly the completed verdict, stderr carries the completed-of-total line, exit 1
test_adjudicate_apply_same_partial_batch_confirms_completed_count_only --apply-same: Total: and the confirm gate use the COMPLETED count; the merge commits; exit 1 follows
test_identity_partial_batch_model_not_found_still_walks_then_skips_later_stages OllamaModelNotFound through _identity_run's returned-batch split, with a merge already applied

The --json test is the RETURNED-batch path; the pre-existing unavailable test covers the RAISE path, where stdout stays empty. That pairing is what makes a partial array distinguishable from the pre-#441 behavior.

What item 4 looks like in practice

The --apply-same test pins current behavior rather than proposing a fix. Two groups queued, one adjudicated SAME: the operator is shown Total: 1, types 1, the merge commits — and only then does stderr reveal that a second group was queued and failed. The preview is accurate for what gets merged, but nothing at confirm time discloses the partial-ness. Whether it should is still open, and it now spans three surfaces (see below).

Verification

  • uv run pytest -q4035 passed, 1 skipped (the known darwin-gated test).
  • uv run mypy . → clean, 179 source files. uv run ruff check . and ruff format --check . → clean.
  • Zero production changesgit diff --stat -- src/ is empty.
  • Each test was mutation-verified against the exact production line it covers, then reverted: the --json payload call, total = len(previewed_groups), and the isinstance arm of the re-raise split. Every mutation produced a failure naming the behavior under test.

Disclosures

No review receipt. The lens review could not complete: the reviewer agents are provisioned with Read, Grep, Glob and no shell, while their protocol mandates gentle-ai review inspect-candidate and forbids substituting live files. Three launches returned inspection: incomplete. No PASS was authored in its place. This is a test-only change verified by the suite, lints and mutation testing above.

Pre-existing defect found while writing test 3, not fixed here. render_summary at src/openkos/cli/curate.py:1217 emits f"{stage.name}: {outcome.notice}", but all six notices already embed the stage name (curate.py:467,654,854,1089,1148,1200). Every summary line the operator sees is double-prefixed — Identity: Identity: applied 1, skipped 0. Substring assertions in the existing tests hide it. Filed separately.

…nd paths (#468)

`adjudicate`'s docstring claims every output mode processes `batch.results`
as a complete run before reporting the failure, but only the default report
and `--apply` had partial-batch tests. Two of the four modes carried the
claim unproved, and `curate`'s `OllamaModelNotFound` re-raise arm was reached
only through a sequencer-level fake that raises directly, never through a
real partial `AdjudicationBatch`.

Three tests close items 1-3 of #468. The docstring is left intact: these
prove the claim rather than weaken it.

- `--json` over a partial batch: stdout parses to exactly the completed
  verdict, stderr carries the completed-of-total line, exit 1. This is the
  RETURNED-batch path; the existing unavailable test covers the RAISE path,
  where stdout stays empty.
- `--apply-same` over a partial batch: `Total:` and the `--confirm-count`
  gate reflect the COMPLETED eligible count, not the queued count; the merge
  really commits, and only afterwards does the failure set exit 1. This pins
  current behavior for #468 item 4 — at confirm time nothing discloses that
  another group was queued and failed. That disclosure decision stays open.
- `OllamaModelNotFound` through `_identity_run`'s own returned-batch split,
  with a completed merge already applied before the failure surfaces.

Each test was mutation-verified against the exact production line it covers
and reverted: the `--json` payload call, `total = len(previewed_groups)`,
and the `isinstance` arm of the re-raise split. No production code changed.

Refs #468
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