fix(tools): do not blame the plan for a verdict okf_adjudicate built
run() parses the plan before building anything and parses its own
verdict after. Only the first failure is the operator's file.
The second is reachable: an empty --adjudicator produces a verdict the
grammar refuses ("adjudication field 'adjudicated_by' must be a
non-empty string"). The plan parsed fine; the fault is in what this
command stamped onto it.
Catching SegmentationError at the top of main() -- the previous commit
-- caught both raise sites and printed "malformed plan" for each. On
this path that is a clean, confident, WRONG diagnosis: it sends the
operator to fix the one artifact that was fine. Worse than the traceback
it replaced, because a traceback at least does not claim to know.
The verdict parse now raises AdjudicationError, which is what "this
command failed" already means in this file and already returns 2. Exit
code unchanged either way, nothing written either way; only the message
changes.
Suite 1073 -> 1074 passed (pytest exit 0, measured without a pipe);
ruff and mypy --strict clean.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
a72053f66f
commit
798f64ad6b
3 changed files with 55 additions and 1 deletions
|
|
@ -213,7 +213,16 @@ def run(
|
|||
verdict = build_verdict(
|
||||
payload, adjudicator=adjudicator, adjudicated_at=adjudicated_at, dwell_s=dwell_s
|
||||
)
|
||||
parse_segmentation_plan(verdict)
|
||||
# The plan already parsed above, so a failure HERE is this command's
|
||||
# own output, not the operator's file. Raised as an AdjudicationError
|
||||
# so it is not reported as a malformed plan: that would send the
|
||||
# operator to fix the one artifact that was fine.
|
||||
try:
|
||||
parse_segmentation_plan(verdict)
|
||||
except SegmentationError as exc:
|
||||
raise AdjudicationError(
|
||||
f"the verdict this command built does not parse back [{exc.code}]: {exc}"
|
||||
) from exc
|
||||
out_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
out_path.write_text(
|
||||
json.dumps(verdict, indent=2, ensure_ascii=False) + "\n", encoding="utf-8", newline=""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue