Repository navigation
fix(cli): eval, report, answers, benchmark and evaluate exit with a message on bad input or output #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cli): eval, report, answers, benchmark and evaluate exit with a message on bad input or output #236
Changes from all commits
b4229b7
f1df186
b5fde53
8325400
cfde4be
1a86525
ecc3b86
865b817
cbb1fc1
0644d19
8137a3c
11f9e77
3331949
34f8e41
5ebaeca
33bb01e
fabe4be
eeebd1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| ### Fixed | ||
|
|
||
| - **`eval`, `report`, `answers`, `benchmark` and `evaluate`** exit with a message on an unreadable or invalid input file or an unwritable `--output`, instead of a traceback. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,9 +110,22 @@ def _print_plan(plan: dict) -> None: | |
| print(f" {key}: {value}") | ||
|
|
||
|
|
||
| def _check_questions_from(questions_from: str, key: str) -> tuple[Path, list, str | None]: | ||
| """The resolved --questions-from file, its records, and a message when it is unusable.""" | ||
| from dokimi.orchestrator.pipeline import load_questions_payload, resolve_questions_from_path | ||
|
|
||
| qf = resolve_questions_from_path(Path(questions_from), key) | ||
| if not qf.exists(): | ||
| return qf, [], f"questions source not found: {qf}" | ||
| try: | ||
| return qf, load_questions_payload(qf), None | ||
| except Exception as exc: | ||
| return qf, [], f"questions source invalid: {qf} ({exc})" | ||
|
|
||
|
|
||
| def cmd_benchmark_preflight(args: argparse.Namespace) -> None: | ||
| """Validate the resolved benchmark plan without running LLM calls.""" | ||
| from dokimi.orchestrator.pipeline import load_questions_payload, resolve_questions_from_path | ||
| from dokimi.orchestrator.pipeline import load_questions_payload | ||
| from dokimi.mcp.factory import create_doc_source_client | ||
|
|
||
| registry = _load_registry(args) | ||
|
|
@@ -149,15 +162,11 @@ def cmd_benchmark_preflight(args: argparse.Namespace) -> None: | |
| errors.append(f"doc source invalid: {plan['doc_source']} ({exc})") | ||
|
|
||
| if plan["questions_from"]: | ||
| qf = resolve_questions_from_path(Path(plan["questions_from"]), entry.key) | ||
| if not qf.exists(): | ||
| errors.append(f"questions source not found: {qf}") | ||
| qf, questions, problem = _check_questions_from(plan["questions_from"], entry.key) | ||
| if problem: | ||
| errors.append(problem) | ||
| else: | ||
| try: | ||
| questions = load_questions_payload(qf) | ||
| print(f" questions: {qf} ({len(questions)} items)") | ||
| except Exception as exc: | ||
| errors.append(f"questions source invalid: {qf} ({exc})") | ||
| print(f" questions: {qf} ({len(questions)} items)") | ||
|
|
||
| # Check golden set only if no external questions source (--questions-from takes precedence) | ||
| if plan["questions_root"] and not plan["questions_from"]: | ||
|
|
@@ -218,6 +227,12 @@ def cmd_benchmark_run(args: argparse.Namespace) -> None: | |
| questions_from = getattr(args, "questions_from", None) | ||
| questions_root = getattr(args, "questions_root", None) | ||
|
|
||
| if questions_from: | ||
|
vchamarthi marked this conversation as resolved.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit (plausible, maintainability): Questions file is parsed twice per
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Acceptable as is: the pre-flight check gives a clean exit-2 message before any run starts, and the pipeline reads stay the authoritative path for other callers. Leaving the double parse; no change. 🤖 Addressed by Claude Code |
||
| _, _, problem = _check_questions_from(questions_from, entry.key) | ||
|
vchamarthi marked this conversation as resolved.
|
||
| if problem: | ||
| print(f"Error: {problem}", file=sys.stderr) | ||
| sys.exit(1) | ||
|
|
||
| if n_runs == 1: | ||
| _run_single_library( | ||
| entry, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.