8000 Validate ext keys as {ns}/{name} on records, runs and facets: ext_key_invalid (0.3.0) by ynishi · Pull Request #49 · ynishi/evalhub · GitHub
[go: up one dir, main page]

Skip to content

Validate ext keys as {ns}/{name} on records, runs and facets: ext_key_invalid (0.3.0) - #49

Merged
ynishi merged 1 commit into
mainfrom
fix/ext-key-invalid
Sep 27, 2026
Merged

ynishi merged 1 commit into
mainfrom
fix/ext-key-invalid

Conversation

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

0.3.0: ext keys are checked as {ns}/{name}

Fixes #46. The schema crate and the served JSON Schema have always said that ext is keyed by namespace ({ns}/{name}), and nothing checked it: a record or a run with "ext": {"notes": {}} was accepted, stored and served.

Behaviour

  • Every key of ext is validated with the same rule as a metric id, at the top level of a record or a run and inside each facet that carries an ext of its own (model, task, harness, generation, trial, grading, env).
  • A violation is 422 with one ext_key_invalid per key, at /ext/{key} or /{facet}/ext/{key}. Values are still not looked into.
  • Stored bodies are not rewritten. The rule applies to writes; a 0.2.0 body with an un-namespaced key keeps being read.

SDK (why 0.3.0)

  • evalhub_schema::error::ErrorCode gains ExtKeyInvalid and is now #[non_exhaustive], as its doc already asked of clients ("treat an unknown code as a generic 422"). A match on it in another crate needs a fallback arm.
  • schemas/error.json, the OpenAPI document and the web client's ErrorCode union are regenerated.

Deploy

Before fly deploy, run bash deploy/fly/ext-keys-check.sh (read-only) to list the stored keys a 0.2.0 hub accepted that 0.3.0 refuses on write, and record the result on #46. See docs/hosting.md, "Upgrading to 0.3.0".

Verification

cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test -p evalhub-schema / -core / -query / -server (Docker), cargo insta test -p evalhub-server --test boot, just semver-check, just package, pnpm check / pnpm lint. Store tests not run (no Rust change there).

…_invalid (0.3.0)

The schema crate has always documented `ext` as a map keyed by namespace,
and the served JSON Schema says the same, but nothing checked it: a record
or a run with `"ext": {"notes": {}}` was accepted, stored and served (#46).

The semantic pass now runs every key of `ext` through the same `{ns}/{name}`
rule as metric ids, at the top level of a record or a run and inside each
facet that carries an `ext` of its own (model, task, harness, generation,
trial, grading, env), and reports one `ext_key_invalid` (422) per key at
`/ext/{key}` or `/{facet}/ext/{key}`. Values are still not looked into.

`ErrorCode` gains the variant and becomes `#[non_exhaustive]`, which its doc
already asked of clients ("treat an unknown code as a generic 422"); the
variant is why this is 0.3.0. `schemas/error.json`, the OpenAPI snapshot and
the web client's `ErrorCode` union are regenerated.

Stored bodies are not rewritten; the rule applies to writes.
`deploy/fly/ext-keys-check.sh` lists the stored keys a 0.2.0 hub accepted
that 0.3.0 would refuse, to run before the deploy (docs/hosting.md).

Closes #46

Signed-off-by: Yutaka Nishimura <ytk.nishimura@gmail.com>
@ynishi
ynishi merged commit c594835 into main Sep 27, 2026
4 checks passed
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.

ext keys are documented as namespaced ({ns}/{name}) and never checked, on records or runs

1 participant

0