8000 Schema: Run leaves the Eval body; per-run facets, status and metrics; Card.run_results; evalhub.eval/2.0 by ynishi · Pull Request #36 · ynishi/evalhub · GitHub
[go: up one dir, main page]

Skip to content

Schema: Run leaves the Eval body; per-run facets, status and metrics; Card.run_results; evalhub.eval/2.0 - #36

Merged
ynishi merged 1 commit into
mainfrom
feat/schema-run
Sep 25, 2026
Merged

ynishi merged 1 commit into
mainfrom
feat/schema-run

Conversation

@ynishi
@ynishi ynishi commented Sep 25, 2026
Copy link
Copy Markdown
Owner

Stage 1 of 9 of #24 (Runs as first-class rows). The type change only: no validation, hashes, tables or endpoints. All five crates are green on this tree, so the branch is mergeable on its own; the version bump is stage 9 (#35).

What changed

  • run module (new): Run { run_id, status, error?, skip_reason?, started_at?, ended_at?, model?, task?, harness?, generation?, trial?, env?, calls?, artifacts[], attachments[], metrics{}, ext, meta? }, RunStatus { ok, error, skipped }, RunError { kind, message?, log? }. deny_unknown_fields on Run and RunError. The facets reuse facet; attachments[] reuses common::Attachment; metrics is BTreeMap<String, f64>; meta is uninterpreted JSON. The module doc carries the run_id rule (URL segment, no /, ≤ 200 bytes), the error.kind slug rule and unrecorded.
  • Eval is the header (evalhub.eval/2.0, schemas/eval-2.json): runs and the old Run / Outcome are gone from it. The module doc is rewritten: header plus runs, runs belong to the record and not to a version, run_set no longer requires runs and any eval_kind may have them, conditions are per run with the header's facets as defaults, tasks and runs are not separate types, a run has no verdict.
  • eval::v1 (new): the 1.0 Eval / Run / Outcome, accepted by 0.2.0 only and removed in 0.3.0 (doc note, not #[deprecated], so -D warnings stays clean on the internal uses stages 2 and 6 need). It still generates schemas/eval.json, which is byte-identical to main.
  • Schema ids: EVAL_SCHEMA = evalhub.eval/2.0, CARD_SCHEMA = evalhub.card/1.1. RecordKind::schema_ids() lists the accepted ids, schema_for(id) returns the document for one of them; schema_id() / schema() are unchanged in shape, so the query path table and every exhaustive match are untouched. The schema constraint on Card is an enum of 1.0 and 1.1. The versioning section in lib.rs names 0.2.0 as the release that accepts evalhub.eval/1.0 and 0.3.0 as the one that removes it.
  • Card.run_results[] { eval, run_id, metric, value?, label?, by?, from? }, default empty. The used set is documented on Card and on attrs.runs in common.
  • ErrorCode: runs_moved, run_status_detail, run_id_invalid, run_id_mismatch, run_result_value_or_label, run_results_eval_unknown, run_unknown, run_not_in_used_set, too_many_run_results, run_deleted (409), batch_duplicate_run_id, batch_too_large (413), body_too_large (413). metric_id_invalid now also covers run_results[].metric and a run's metrics key.
  • Generated contracts, same commit: schemas/card.json, schemas/error.json regenerated; schemas/eval-2.json, schemas/run.json new; SCHEMA_NAMES gains eval-2 and run; the server OpenAPI snapshot and web/src/lib/api/schema.d.ts (ErrorCode union) regenerated.
  • Fixtures: eval-run-set.json is a 2.0 header; the old file is kept as eval-run-set-v1.json for the compatibility tests of stages 2, 4 and 7; run.json and card-run-results.json (with run_results and a uses_eval carrying attrs.runs) are new; card-complete.json loses attrs.runs, has no run_results, and declares 1.1 (1.0 stays covered by evalhub-core's valid-card.json and a test that posts run_results under 1.0). In evalhub-core, valid-eval.json and eval-run-refs.json are schema-valid 2.0 headers; the run-pointer material of the latter returns with the run fixtures in stage 2.

Verified

Command Outcome
cargo fmt --check clean
cargo clippy --workspace --all-targets -- -D warnings clean
cargo test -p evalhub-schema 20 passed
cargo test -p evalhub-core 34 passed
cargo test -p evalhub-query 15 passed
cargo t 8000 est -p evalhub-store (Docker) 63 passed
cargo test -p evalhub-server (Docker) 60 passed, OpenAPI snapshot regenerated, no .snap.new
cargo doc --no-deps -p evalhub-schema 0 warnings; run and eval::v1 present
just semver-check evalhub-schema: 5 major lints (Eval.runs / Run / Outcome removed, Card.run_results and ErrorCode variants added), the expected 0.1 → 0.2; core / query: no update required
corepack pnpm check (web) 0 errors

Not run: just e2e, cargo deny check (no dependency added), deploy/fly/smoke.sh (targets the hosted service; read and still posts a valid 2.0 header).

Deliberately not covered

Validation rules, hashes, store tables, endpoints (stages 2–7). validate.rs, the query grammar / typecheck docs and the web Eval page still describe runs in the body; stages 2, 3 and 8 own those lines.

Refs #27

…rd.run_results; evalhub.eval/2.0

An Eval's runs were embedded in the record body: adding one run meant
posting a whole new version, a run could carry no measurements
(`deny_unknown_fields`, no `ext`), conditions existed once per Eval,
and `Run.outcome` was a verdict in a type whose doc says grading
belongs to the Card. This is the type change of #24, stage 1 of 9:
the shapes only, no behaviour.

New `run` module: `Run { run_id, status, error?, skip_reason?,
started_at?, ended_at?, six facets, calls?, artifacts[],
attachments[], metrics{}, ext, meta? }`, `RunStatus { ok, error,
skipped }`, `RunError { kind, message?, log? }`. A run has no verdict;
its facets default to the header's; `metrics` is what was measured
from the run itself; `meta` is never interpreted.

`Eval` is now the header alone (`evalhub.eval/2.0`, `schemas/eval-2.json`).
Removing a key is a major bump, so the 1.0 types move to `eval::v1`,
keep generating `schemas/eval.json` unchanged, and stay accepted by
0.2.0 only (the versioning section in `lib.rs` names 0.2.0 and 0.3.0).
`RecordKind::schema_ids()` and `schema_for(id)` expose the accepted
ids; `schema_id()` / `schema()` keep returning the current one, so the
query path table and every exhaustive match are untouched.

`Card.run_results[] { eval, run_id, metric, value?, label?, by?, from? }`
is a new optional key, so `evalhub.card/1.1`, one document, `schema`
accepting 1.0 and 1.1. The used set (`attrs.runs`, else every live run
at posting time) is documented on `Card` and on `attrs.runs`.

`ErrorCode` gains the thirteen run codes (enum and doc only; the checks
arrive in stages 2, 4, 5 and 7). `SCHEMA_NAMES` gains `eval-2` and
`run`. Fixtures: `eval-run-set.json` is a header, the old file stays as
`eval-run-set-v1.json` for the compatibility tests, `run.json` and
`card-run-results.json` are new, `card-complete.json` loses
`attrs.runs`. The server OpenAPI snapshot and the web client's
`ErrorCode` union are regenerated in this commit.

Not here: validation, hashes, store tables, endpoints. `validate.rs`,
the query docs and the Eval page still speak of `runs` in the body;
stages 2, 3 and 8 own those.

Verified: cargo fmt --check; cargo clippy --workspace --all-targets
-D warnings; cargo test -p evalhub-schema (20 passed), -p evalhub-core
(34), -p evalhub-query (15), -p evalhub-store (63, Docker),
-p evalhub-server (60, Docker); cargo doc --no-deps -p evalhub-schema
(0 warnings); just semver-check reports evalhub-schema needs the
0.2 bump (5 major lints: Eval.runs / Run / Outcome removed,
Card.run_results and ErrorCode variants added), which is the expected
result; the bump is stage 9.

Refs #27

Signed-off-by: Yutaka Nishimura <ytk.nishimura@gmail.com>
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

0