Files
zeekay 42124b1f45 hanzo-research 0.2.0: every research and arena route, the crate's records, provenance
The Python client now reaches what the Rust crate does and the server
serves. Research covers every /v1/research route: record() files
benchmarks, studies, runs and papers in one batch a kind; runs(),
get_run() and compare() read them; grant(), revise() and retract() move
consent and versions; the experiment plane and artifacts as before.
Arena covers /v1/benchmark: catalog, leaderboard, claims (written with
protocol and source), history, compare, presets, and runs, which queue a
paid execution and are refused without confirm=True.

wire holds the crate's Run, Benchmark, Measure, Study, Paper and
Comparison field for field; canonical writes RFC 8785 bytes equal to the
crate's (tests/vectors/rust.json, written by the crate); lineage and wal
are the crate's records, and a WAL the crate wrote verifies here.
capture() reads the harness commit (the diff's SHA-256 when dirty), the
weights' SHA-256, host, CPU, GPU, device, dtype and packages, and
apply() folds them into a run.

runs(org=) sends no credential: the server answers ?org= only to a
caller with no org. An org the token does not belong to is refused
before the request, since the server would act in the home org. The
command is hanzo-research; the native CLI owns `hanzo`.
2026-10-15 12:11:45 -07:00

40 lines
1.2 KiB
Python

from __future__ import annotations
import os
import sys
from typing import Iterator
import pytest
sys.path.insert(0, os.path.dirname(__file__))
from fake import Server, jwt # noqa: E402
from hanzo_research import wire, transport # noqa: E402
HANZO = jwt(
{
"sub": "u-1",
"owner": "hanzo",
"orgs": [{"org": "hanzo", "role": "admin"}, {"org": "lux", "role": "admin"}],
"exp": 4102444800,
}
)
SUPER = jwt({"sub": "u-0", "owner": "admin", "orgs": [{"org": "admin", "role": "admin"}], "exp": 4102444800})
ATLAS = jwt({"sub": "u-2", "owner": "hanzo", "orgs": [{"org": "hanzo"}], "project": "atlas", "exp": 4102444800})
@pytest.fixture(autouse=True)
def quiet(monkeypatch: pytest.MonkeyPatch) -> None:
"""No test reads the caller's own credential or waits out a real backoff."""
monkeypatch.delenv("HANZO_API_KEY", raising=False)
monkeypatch.delenv("RESEARCH_BASE", raising=False)
monkeypatch.delenv("RESEARCH_PROJECT", raising=False)
monkeypatch.setattr(transport, "WAITS", (0, 0, 0))
monkeypatch.setattr(wire, "token", lambda: "")
@pytest.fixture
def server() -> Iterator[Server]:
with Server() as s:
yield s