8000 Store: the Card's used set and run_results at ingest, the run projection query, hidden Evals for redaction, comparison over used runs · Issue #31 · ynishi/evalhub · GitHub
[go: up one dir, main page]

Skip to content

Store: the Card's used set and run_results at ingest, the run projection query, hidden Evals for redaction, comparison over used runs #31

Closed

Description

@ynishi

Part of #24, stage 5 of 9. Depends on stages 3 and 4; stage 7 depends on it.

Scope

evalhub-store: everything that joins Cards to runs. Today the server extracts results and passes them as NewVersion.results; for run_results the store reads body["run_results"] itself (a new pattern, chosen so NewVersion gains no field and the server's struct literal does not change in this stage). The run_results count limit is the server's (stage 7).

Changes

  • Card ingest (records.rs, create_or_append): after relation resolution (step 5), take FOR SHARE on each referenced Eval's record row, then fix the used set per Eval record: the union of attrs.runs over the Card's core/uses_eval relations resolved to that record; if none carries attrs.runs, every run of the record that is neither archived nor tombstoned at that moment. A relation that resolved to an external or not-yet-resolvable target has no used set and gets no card_eval_runs rows. Existence is checked only among Evals the writer can see (relations::visible_to); a run of an Eval the writer cannot see, and a run_results.eval that resolved to nothing, answer exactly as a missing run, run_unknown. run_results[] entries must lie inside the used set (run_not_in_used_set); archived and tombstoned runs are rows and therefore inside it. resolve_version returns only a version id today; it must also yield the Eval's record id. At step 8, beside results, insert run_results and card_eval_runs (each used run with its current content_hash).
  • relations::add (POST …@{seq}/relations adding uses_eval later): the same used-set fixing and card_eval_runs insert; that path carries no run_results.
  • Projection: runs::project(record_id, RunQuery, cards, include, caller_ns) -> page: runs joined with run_metrics, run_fingerprints and, per chosen Card, the run_results of that Card's latest live version; per Card, used_set_hash (stage 2 formula over card_eval_runs) and changed_since_card from card_eval_runs rows whose stored hash differs from the current runs.content_hash; keyset paging on (sort key, run_id); archived and tombstoned rows only when asked and only for a member of the namespace; a used run that is archived or tombstoned appears marked as such (for a non-member, archived looks like tombstoned). cards are resolved with visible_to for the caller and must have a uses_eval into this Eval; a Card the caller cannot see, that does not exist, or that does not use this Eval is answered identically as unknown. SQL builder in a new run_sql.rs: query_sql::build is bound to records JOIN versions.
  • relations::hidden_evals(card_version_ids, caller_ns): for each Card version, the Eval record ids named by its run_results that the caller cannot see. hidden_targets covers only resolved relations[]; this is the second input the server's redaction needs.
  • Comparison view (relations::cards_using_eval): same_harness / same_model compare the Card's fingerprint with every run in its used set (false if any used run's fingerprint differs or is missing); each row gains runs_used, used_set_hash and changed_since_card.
  • Existing tests touched: tests/relations.rs (the relations::add case with attrs.runs ["r9"] now seeds a run row, and a second case asserts run_unknown without one; the raw INSERT edges with attrs.runs stay as they are). The tests/records.rs NewVersion with attrs.runs ["r1"] targets an external Eval, so it has no used set and needs nothing. The server fixture card-complete.json carries no attrs.runs since stage 1, so cargo test -p evalhub-server needs no change here.
  • .sqlx regenerated in the same commit.

Acceptance

  • cargo test -p evalhub-store (Docker): used set with and without attrs.runs, and as a union over two uses_eval to different seqs of one Eval; run_unknown for a missing run and, byte-identical, for a run of an Eval the writer cannot see; run_not_in_used_set; an archived and a tombstoned run still count as rows; card_eval_runs holds the hash at posting time and overwriting a run afterwards puts it in changed_since_card and changes used_set_hash; projection filter, sort and page on status, error.kind, a facet key, metrics[x] and results[c][m].value; include=archived honoured only for a member; a private Card named in cards by an outsider is unknown; hidden_evals for a public Card citing a private Eval; same_model false when one used run's model differs.
  • just sqlx-check green; cargo test -p evalhub-server still green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0