evalrouter 0.3.20__tar.gz → 0.3.22__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. {evalrouter-0.3.20 → evalrouter-0.3.22}/PKG-INFO +9 -1
  2. {evalrouter-0.3.20 → evalrouter-0.3.22}/README.md +8 -0
  3. {evalrouter-0.3.20 → evalrouter-0.3.22}/pyproject.toml +1 -1
  4. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/evalrouter_contracts/__init__.py +1 -1
  5. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/__init__.py +1 -1
  6. evalrouter-0.3.22/src/kimpton_evalrouter/_chain_prefetch.py +225 -0
  7. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_comparison.py +22 -0
  8. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_comparison_checkpoint.py +44 -4
  9. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_comparison_html.py +69 -27
  10. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_report_brand.py +1 -1
  11. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_report_charts.py +137 -13
  12. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_report_document.py +39 -6
  13. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/types.py +9 -1
  14. {evalrouter-0.3.20 → evalrouter-0.3.22}/LICENSE +0 -0
  15. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/evalrouter_contracts/bundle.py +0 -0
  16. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/evalrouter_contracts/components.py +0 -0
  17. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/evalrouter_contracts/models.py +0 -0
  18. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/evalrouter_contracts/protocol.py +0 -0
  19. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/evalrouter_contracts/py.typed +0 -0
  20. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/evalrouter_contracts/templates.py +0 -0
  21. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/evalrouter_contracts/validation.py +0 -0
  22. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/__main__.py +0 -0
  23. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_account.py +0 -0
  24. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_artifacts.py +0 -0
  25. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_boundary.py +0 -0
  26. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_forecasts.py +0 -0
  27. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_group_results.py +0 -0
  28. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_group_review.py +0 -0
  29. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_group_summary_prefetch.py +0 -0
  30. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_groups.py +0 -0
  31. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_guided.py +0 -0
  32. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_helpers.py +0 -0
  33. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_history_labels.py +0 -0
  34. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_listing.py +0 -0
  35. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_progress.py +0 -0
  36. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_read_cache.py +0 -0
  37. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_reasoning_controls.py +0 -0
  38. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_report_chart_data.py +0 -0
  39. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_report_document_html.py +0 -0
  40. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_report_pareto.py +0 -0
  41. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_report_theme.py +0 -0
  42. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_resources.py +0 -0
  43. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_transport.py +0 -0
  44. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_tui.py +0 -0
  45. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_tui_port.py +0 -0
  46. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_tui_session.py +0 -0
  47. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_tui_table.py +0 -0
  48. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_tui_views.py +0 -0
  49. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/_update_notice.py +0 -0
  50. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/cli.py +0 -0
  51. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/langsmith.py +0 -0
  52. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/py.typed +0 -0
  53. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/render/__init__.py +0 -0
  54. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/render/_console.py +0 -0
  55. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/render/_theme.py +0 -0
  56. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/render/_widgets.py +0 -0
  57. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/render/live.py +0 -0
  58. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/render/picker.py +0 -0
  59. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/render/screens.py +0 -0
  60. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/render/tables.py +0 -0
  61. {evalrouter-0.3.20 → evalrouter-0.3.22}/src/kimpton_evalrouter/tracing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evalrouter
3
- Version: 0.3.20
3
+ Version: 0.3.22
4
4
  Summary: Interactive evaluation workspace, command-line tools, and Python client for EvalRouter
5
5
  Project-URL: Homepage, https://evalrouter.ai
6
6
  Project-URL: Documentation, https://evalrouter.ai/developers/docs/cli
@@ -423,6 +423,14 @@ report warns and the chain is not complete. `evalrouter export RUN
423
423
  each run to its newest resume at the time you run it, so a later resume makes
424
424
  it return a longer chain; the saved chain documents keep the exact version.
425
425
 
426
+ Aggregate-only reports show the retained metric values and their recorded sample
427
+ counts, plus per-code error or stop counts from the saved chain. Sample identities
428
+ and answers remain withheld. Missing counts and confidence intervals remain
429
+ unknown. SOB @6 reports identify their generation variant and each model's graded
430
+ denominator; unscored outcomes are kept separate without assigning them zero.
431
+ An existing downloaded archive does not change when the CLI is upgraded: generate
432
+ a new report to use the updated presentation.
433
+
426
434
  `sources/` keeps each export byte for byte, with its SHA-256 recorded. With
427
435
  `--evidence`, every graded sample must carry its scored answer by default: the final completion
428
436
  text for SOB, plus the per-sample metadata the export supplies (for SOB, the
@@ -391,6 +391,14 @@ report warns and the chain is not complete. `evalrouter export RUN
391
391
  each run to its newest resume at the time you run it, so a later resume makes
392
392
  it return a longer chain; the saved chain documents keep the exact version.
393
393
 
394
+ Aggregate-only reports show the retained metric values and their recorded sample
395
+ counts, plus per-code error or stop counts from the saved chain. Sample identities
396
+ and answers remain withheld. Missing counts and confidence intervals remain
397
+ unknown. SOB @6 reports identify their generation variant and each model's graded
398
+ denominator; unscored outcomes are kept separate without assigning them zero.
399
+ An existing downloaded archive does not change when the CLI is upgraded: generate
400
+ a new report to use the updated presentation.
401
+
394
402
  `sources/` keeps each export byte for byte, with its SHA-256 recorded. With
395
403
  `--evidence`, every graded sample must carry its scored answer by default: the final completion
396
404
  text for SOB, plus the per-sample metadata the export supplies (for SOB, the
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "evalrouter"
7
- version = "0.3.20"
7
+ version = "0.3.22"
8
8
  description = "Interactive evaluation workspace, command-line tools, and Python client for EvalRouter"
9
9
  readme = "README.md"
10
10
  license = "LicenseRef-Kimpton-EvalRouter-SDK"
@@ -8,4 +8,4 @@ computes digests and refuses invalid packages; it never imports contributed
8
8
  code, opens a network connection, signs anything or carries operator state.
9
9
  """
10
10
 
11
- __version__ = "0.3.20"
11
+ __version__ = "0.3.22"
@@ -35,7 +35,7 @@ __all__ = [
35
35
  "WaitCancelled",
36
36
  "types",
37
37
  ]
38
- __version__ = "0.3.20"
38
+ __version__ = "0.3.22"
39
39
 
40
40
 
41
41
  class Client(_Transport):
@@ -0,0 +1,225 @@
1
+ """Two isolated chain-result reads, accepted and checkpointed in caller order.
2
+
3
+ Only fresh comparisons use this optimization. Workers own their HTTP clients
4
+ and never touch checkpoint/source files or refresh credentials. A completed
5
+ response holds its slot until the caller verifies the entire series. A raced
6
+ cache reuse does not free a still-running request's slot.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import threading
12
+ import time
13
+ from contextlib import suppress
14
+ from datetime import UTC, datetime
15
+ from types import SimpleNamespace
16
+
17
+ from . import Client, _tui_port
18
+ from ._account import CLIENT_HEADER, DEVICE_HEADER
19
+ from ._transport import RequestOptions, RequestTimeout, WaitCancelled
20
+
21
+
22
+ def prepare(client, run_ids, checkpoint, allowance):
23
+ if len(run_ids) < 2 or type(client) is not Client or _tui_port.current() is not None:
24
+ return None
25
+ snapshot = client._read_snapshot((DEVICE_HEADER, CLIENT_HEADER))
26
+ if snapshot is None or not checkpoint.prefetch_allowed():
27
+ return None
28
+ return Reads(snapshot, run_ids, allowance=max(client.timeout, allowance))
29
+
30
+
31
+ def _client(snapshot):
32
+ return Client._from_read_snapshot(snapshot)
33
+
34
+
35
+ class Reads:
36
+ def __init__(self, snapshot, run_ids, *, allowance):
37
+ self._snapshot = snapshot
38
+ self._ids = tuple(run_ids)
39
+ self._deadline = time.monotonic() + allowance
40
+ self._condition = threading.Condition()
41
+ self._cancelled = threading.Event()
42
+ self._next = self._accepted = 0
43
+ self._results = {}
44
+ self._reserved = set()
45
+ self._invalidated = set()
46
+ self._launch_stopped = False
47
+
48
+ def remaining(self):
49
+ remaining = self._deadline - time.monotonic()
50
+ if remaining <= 0:
51
+ # Keep the primary timeout distinct from cleanup cancellation:
52
+ # RequestTimeout preserves verified checkpoints, WaitCancelled does not.
53
+ raise RequestTimeout()
54
+ if self._cancelled.is_set():
55
+ raise WaitCancelled()
56
+ return remaining
57
+
58
+ def start(self):
59
+ for _ in range(min(2, len(self._ids))):
60
+ threading.Thread(target=self._worker, name="evalrouter-chain-read", daemon=True).start()
61
+
62
+ def _worker(self):
63
+ client = None
64
+ try:
65
+ while True:
66
+ with self._condition:
67
+ while (
68
+ not self._cancelled.is_set()
69
+ and self._next < len(self._ids)
70
+ and (
71
+ self._launch_stopped
72
+ or self._next >= self._accepted + 2
73
+ or len(self._reserved) >= 2
74
+ )
75
+ ):
76
+ self._condition.wait(timeout=0.1)
77
+ if self._cancelled.is_set() or self._next == len(self._ids):
78
+ return
79
+ # A raced cache can be accepted before a worker claims it.
80
+ self._next = max(self._next, self._accepted)
81
+ if self._next == len(self._ids):
82
+ return
83
+ index = self._next
84
+ self._next += 1
85
+ self._reserved.add(index)
86
+ try:
87
+ if client is None:
88
+ client = _client(self._snapshot)
89
+ data = client.runs.chain_result(
90
+ self._ids[index],
91
+ options=RequestOptions(
92
+ timeout=self.remaining(), cancel_event=self._cancelled
93
+ ),
94
+ )
95
+ outcome = (data, datetime.now(UTC).isoformat())
96
+ del data
97
+ except BaseException as error:
98
+ outcome = error
99
+ with self._condition:
100
+ if self._cancelled.is_set():
101
+ return
102
+ if index < self._accepted:
103
+ # Another process's fresh checkpoint won this race.
104
+ # Its unused download/error cannot change the result.
105
+ self._reserved.remove(index)
106
+ else:
107
+ self._results[index] = outcome
108
+ if isinstance(outcome, BaseException):
109
+ self._launch_stopped = True
110
+ self._condition.notify_all()
111
+ del outcome
112
+ finally:
113
+ if client is not None:
114
+ with suppress(BaseException):
115
+ client.close()
116
+
117
+ def read(self, ref):
118
+ with self._condition:
119
+ assert ref == self._ids[self._accepted]
120
+ while self._accepted not in self._results:
121
+ self.remaining()
122
+ self._condition.wait(timeout=0.1)
123
+ self.remaining()
124
+ outcome = self._results[self._accepted]
125
+ if isinstance(outcome, BaseException):
126
+ raise outcome
127
+ return outcome
128
+
129
+ def received_at(self, ref):
130
+ return self.read(ref)[1]
131
+
132
+ def invalidate(self, ref):
133
+ """A raced checkpoint was rejected; speculative bytes are now too old."""
134
+ with self._condition:
135
+ assert ref == self._ids[self._accepted]
136
+ self._invalidated.add(self._accepted)
137
+
138
+ def refetch(self, ref, fetch):
139
+ """Caller-only replacement after the old worker settles, in the same slot."""
140
+ with self._condition:
141
+ assert ref == self._ids[self._accepted]
142
+ while self._accepted not in self._results:
143
+ self.remaining()
144
+ self._condition.wait(timeout=0.1)
145
+ self.remaining()
146
+ # Discard both stale success and unused failure. Keep the reservation
147
+ # throughout the fresh read, so it cannot become a third request.
148
+ del self._results[self._accepted]
149
+ self._invalidated.remove(self._accepted)
150
+ self._launch_stopped = any(
151
+ isinstance(value, BaseException) for value in self._results.values()
152
+ )
153
+ self._condition.notify_all()
154
+ data = fetch()
155
+ outcome = (data, datetime.now(UTC).isoformat())
156
+ with self._condition:
157
+ self.remaining()
158
+ self._results[self._accepted] = outcome
159
+ return outcome
160
+
161
+ def accept(self):
162
+ """Caller only, after successful validation and checkpoint publication."""
163
+ with self._condition:
164
+ self.remaining()
165
+ if self._accepted in self._results:
166
+ del self._results[self._accepted]
167
+ self._reserved.remove(self._accepted)
168
+ # With raced cache reuse, the worker still owns its occupied slot.
169
+ self._accepted += 1
170
+ self._launch_stopped = any(
171
+ isinstance(value, BaseException) for value in self._results.values()
172
+ )
173
+ self._condition.notify_all()
174
+
175
+ def source(self, client):
176
+ return SimpleNamespace(runs=_Runs(self, client), timeout=client.timeout)
177
+
178
+ def close(self):
179
+ with self._condition:
180
+ self._cancelled.set()
181
+ self._results.clear()
182
+ self._condition.notify_all()
183
+
184
+
185
+ class _Runs:
186
+ """Only the existing read operations used by series/checkpoint validation."""
187
+
188
+ def __init__(self, reads, client):
189
+ self._reads = reads
190
+ self._client = client
191
+
192
+ def chain_result(self, ref, *, options=None):
193
+ if self._reads._accepted in self._reads._invalidated:
194
+ return self._reads.refetch(
195
+ ref,
196
+ lambda: self._read(self._client.runs.chain_result, ref, options=options),
197
+ )[0]
198
+ return self._reads.read(ref)[0]
199
+
200
+ def _read(self, method, *args, options=None, **kwargs):
201
+ allowance = (
202
+ options.timeout
203
+ if options is not None and options.timeout is not None
204
+ else self._client.timeout
205
+ )
206
+ return method(
207
+ *args,
208
+ **kwargs,
209
+ options=RequestOptions(
210
+ timeout=min(allowance, self._reads.remaining()),
211
+ cancel_event=self._reads._cancelled,
212
+ ),
213
+ )
214
+
215
+ def export(self, *args, **kwargs):
216
+ return self._read(self._client.runs.export, *args, **kwargs)
217
+
218
+ def results(self, *args, **kwargs):
219
+ return self._read(self._client.runs.results, *args, **kwargs)
220
+
221
+ def get(self, *args, **kwargs):
222
+ return self._read(self._client.runs.get, *args, **kwargs)
223
+
224
+ def list(self, *args, **kwargs):
225
+ return self._read(self._client.runs.list, *args, **kwargs)
@@ -919,8 +919,16 @@ def build(
919
919
  else None
920
920
  )
921
921
  staging = Path(tempfile.mkdtemp(prefix=".evalrouter-comparison-", dir=destination.parent))
922
+ chain_reads = None
922
923
  try:
923
924
  (staging / SOURCES).mkdir(mode=0o700)
925
+ if chain:
926
+ from ._chain_prefetch import prepare
927
+
928
+ chain_reads = prepare(client, run_ids, checkpoint, CHAIN_TIMEOUT_SECONDS)
929
+ if chain_reads is not None:
930
+ checkpoint.client = chain_reads.source(client)
931
+ chain_reads.start()
924
932
  if _summary_reads is not None:
925
933
  _summary_reads.start()
926
934
  entries, parsed = [], {}
@@ -940,8 +948,18 @@ def build(
940
948
  now=now,
941
949
  ),
942
950
  chain_verify,
951
+ **(
952
+ {
953
+ "first_received_at": lambda ref=ref: chain_reads.received_at(ref),
954
+ "cache_rejected": lambda ref=ref: chain_reads.invalidate(ref),
955
+ }
956
+ if chain_reads is not None
957
+ else {}
958
+ ),
943
959
  )
944
960
  )
961
+ if chain_reads is not None:
962
+ chain_reads.accept()
945
963
  for run_id in [] if chain else run_ids:
946
964
  if _summary_reads is None:
947
965
  data = _source_export(client, run_id, evidence)
@@ -1065,6 +1083,8 @@ def build(
1065
1083
  path = staging / f"comparison.{extension}"
1066
1084
  _artifacts.write_new(path, render(document, parsed if needs_sources else {}))
1067
1085
  written[name] = path.name
1086
+ if chain_reads is not None:
1087
+ chain_reads.remaining()
1068
1088
  destination.publish(staging)
1069
1089
  except BaseException as error:
1070
1090
  if checkpoint is not None:
@@ -1074,6 +1094,8 @@ def build(
1074
1094
  if checkpoint is not None:
1075
1095
  checkpoint.discard()
1076
1096
  finally:
1097
+ if chain_reads is not None:
1098
+ chain_reads.close()
1077
1099
  if _summary_reads is not None:
1078
1100
  _summary_reads.close()
1079
1101
  shutil.rmtree(staging, ignore_errors=True)
@@ -146,14 +146,17 @@ class _Proxy:
146
146
  class _Clock:
147
147
  """Record the times a live chain is received, or return them again on reuse."""
148
148
 
149
- def __init__(self, times: list[str] | None = None):
149
+ def __init__(self, times: list[str] | None = None, *, first_received_at=None):
150
150
  self.replay = times is not None
151
151
  self.times = list(times or [])
152
152
  self._next = 0
153
+ self._first_received_at = first_received_at
153
154
 
154
155
  def __call__(self) -> str:
155
156
  if not self.replay:
156
- value = _now()
157
+ value = (
158
+ self._first_received_at() if not self.times and self._first_received_at else _now()
159
+ )
157
160
  self.times.append(value)
158
161
  return value
159
162
  if self._next >= len(self.times):
@@ -226,6 +229,16 @@ class Checkpoint:
226
229
  os.mkdir(self.path, 0o700)
227
230
  os.chmod(self.path, 0o700)
228
231
 
232
+ def prefetch_allowed(self) -> bool:
233
+ """Fresh only; candidate/partial/uncertain storage keeps serial verification."""
234
+ if not self._safe():
235
+ return True
236
+ try:
237
+ with os.scandir(self.path) as entries:
238
+ return next(entries, None) is None
239
+ except OSError:
240
+ return False
241
+
229
242
  def _slot(self, ref: str) -> Path:
230
243
  return self.path / _sha256(ref.encode())[:32]
231
244
 
@@ -359,8 +372,28 @@ class Checkpoint:
359
372
 
360
373
  # --- the one entry point --------------------------------------------------
361
374
 
362
- def series(self, ref: str, build: Callable, verify: Callable) -> dict:
375
+ def series(
376
+ self,
377
+ ref: str,
378
+ build: Callable,
379
+ verify: Callable,
380
+ *,
381
+ first_received_at=None,
382
+ cache_rejected=None,
383
+ ) -> dict:
363
384
  """``build(client, now)`` for ``ref`` from a verified checkpoint, else live."""
385
+
386
+ def candidate_present():
387
+ try:
388
+ os.lstat(self._slot(ref))
389
+ return True
390
+ except FileNotFoundError:
391
+ return False
392
+ except OSError:
393
+ return True # Uncertainty must not authorize stale prefetch reuse.
394
+
395
+ seen = cache_rejected is not None and candidate_present()
396
+ dropped = len(self.dropped)
364
397
  loaded = self._load(ref)
365
398
  if loaded is not None:
366
399
  record, files = loaded
@@ -381,7 +414,14 @@ class Checkpoint:
381
414
  )
382
415
  return entry
383
416
  self._drop(ref, reason)
384
- recorder, clock = _Recorder(self.client.runs), _Clock()
417
+ if cache_rejected is not None and (
418
+ seen or len(self.dropped) != dropped or candidate_present()
419
+ ):
420
+ # A source appeared after initial eligibility and was rejected by
421
+ # the ordinary load/current checks. Fetch after those checks, as
422
+ # the serial path does, never reuse its earlier speculative bytes.
423
+ cache_rejected()
424
+ recorder, clock = _Recorder(self.client.runs), _Clock(first_received_at=first_received_at)
385
425
  entry = build(_Proxy(self.client, recorder), clock)
386
426
  head = (entry.get("chain") or {}).get("members", [None])[-1] or entry.get("run_id")
387
427
  self._save(
@@ -15,7 +15,7 @@ from . import _report_charts as report_charts
15
15
  from . import _report_document_html as report_html
16
16
  from . import _report_pareto as pareto
17
17
  from . import _report_theme as theme
18
- from ._report_document import build_benchmark_report
18
+ from ._report_document import build_benchmark_report, projected_metric_rows
19
19
 
20
20
 
21
21
  def esc(value):
@@ -66,6 +66,9 @@ def native_metrics(profile):
66
66
  for key, metric in (score.get("metrics") or {}).items():
67
67
  value = number(metric.get("value") if isinstance(metric, dict) else metric)
68
68
  values[(scorer, str(score.get("reducer") or ""), str(key))] = value
69
+ if not values:
70
+ for row in projected_metric_rows(profile):
71
+ values[(row["task"], row.get("reducer", ""), row["name"])] = number(row.get("value"))
69
72
  return values
70
73
 
71
74
 
@@ -266,6 +269,8 @@ def evidence_files(entries, *, summary_scope=False):
266
269
 
267
270
  def diagnostic_sections(entries, *, summary_scope=False, chain_summary=False):
268
271
  rows, errors = [], []
272
+ aggregate_count = 0
273
+ invalid_aggregate = False
269
274
  for entry in entries:
270
275
  cov = entry.get("coverage") or {}
271
276
  graded, planned = cov.get("graded"), cov.get("planned")
@@ -280,44 +285,76 @@ def diagnostic_sections(entries, *, summary_scope=False, chain_summary=False):
280
285
  rows.append(
281
286
  f'<div class="coverage-row"><div>{named(entry)}</div>{track}<div class="num">{esc(graded)} / {esc(planned)}<small>{esc(missing)} ungraded</small></div></div>'
282
287
  )
288
+ chain = entry.get("chain") or {}
283
289
  codes = {}
284
- for sample in entry.get("samples") or []:
285
- if sample.get("error_code"):
286
- code = str(sample["error_code"])
287
- codes[code] = codes.get(code, 0) + 1
290
+ if chain.get("display_policy") == "aggregate_only":
291
+ aggregate_count += 1
292
+ supplied = chain.get("not_graded_by_code")
293
+ valid = (
294
+ known
295
+ and isinstance(supplied, dict)
296
+ and all(
297
+ isinstance(code, str) and bool(code) and type(count) is int and count >= 0
298
+ for code, count in supplied.items()
299
+ )
300
+ and sum(supplied.values()) == missing
301
+ )
302
+ if valid:
303
+ codes = {code: count for code, count in supplied.items() if count}
304
+ else:
305
+ invalid_aggregate = True
306
+ else:
307
+ for sample in entry.get("samples") or []:
308
+ if sample.get("error_code"):
309
+ code = str(sample["error_code"])
310
+ codes[code] = codes.get(code, 0) + 1
288
311
  for code, count in sorted(codes.items()):
289
312
  errors.append(
290
313
  f'<tr><td>{named(entry)}</td><td><code>{esc(code)}</code></td><td class="num">{count}</td></tr>'
291
314
  )
292
- error_table = (
293
- (
294
- '<div class="table-wrap"><table><thead><tr><th>Model</th><th>Recorded error or stop</th><th class="num">Rows</th></tr></thead><tbody>'
315
+ if errors:
316
+ error_table = (
317
+ '<div class="table-wrap"><table><thead><tr><th>Model</th><th>Recorded error or stop</th><th class="num">Count</th></tr></thead><tbody>'
295
318
  + "".join(errors)
296
319
  + "</tbody></table></div>"
297
320
  )
298
- if errors
299
- else (
321
+ elif aggregate_count == len(entries) and aggregate_count and not invalid_aggregate:
322
+ error_table = '<p class="muted">No unscored outcomes in the supplied chain aggregates.</p>'
323
+ elif invalid_aggregate:
324
+ error_table = ""
325
+ elif summary_scope and not chain_summary:
326
+ error_table = (
300
327
  '<p class="muted">Per-row error codes are not part of a summary report. Coverage '
301
328
  "above counts every ungraded row, and each native summary's outcome axes name the "
302
329
  "codes; run the same command with --evidence for per-code row counts.</p>"
303
- if summary_scope and not chain_summary
304
- else '<p class="muted">No per-row error codes recorded in this comparison.</p>'
305
330
  )
306
- )
307
- return (
308
- '<details class="fold" id="coverage"><summary><h2>Coverage and unfinished work</h2><span class="sum">A failed or missing answer is not a score of zero</span></summary><div class="fold-body"><p class="caption">Counts describe each saved selection.</p><div class="panel">'
309
- + "".join(rows)
310
- + '</div></div></details><details class="fold" id="errors"><summary><h2>Errors and stops</h2><span class="sum">Infrastructure outcomes remain separate from model quality</span></summary><div class="fold-body"><p class="caption">'
311
- + (
331
+ else:
332
+ error_table = '<p class="muted">No per-row error codes recorded in this comparison.</p>'
333
+ if invalid_aggregate:
334
+ error_table += '<p class="muted">Some per-code aggregate counts are unavailable or do not match recorded coverage.</p>'
335
+ if aggregate_count == len(entries) and aggregate_count:
336
+ evidence_note = (
337
+ "Sample identities are withheld; error counts come from saved chain aggregates."
338
+ )
339
+ elif aggregate_count:
340
+ evidence_note = (
341
+ "Aggregate-only chains supply counts with sample identities withheld. "
342
+ "Row-level counts appear only when sample rows are present."
343
+ )
344
+ elif chain_summary:
345
+ evidence_note = (
312
346
  "The saved chain document supplies per-row identities; its cells were not checked "
313
347
  "against member exports."
314
- if chain_summary
315
- else (
316
- "Summary exports carry no per-row identities."
317
- if summary_scope
318
- else "Saved source evidence contains the per-row identities."
319
- )
320
348
  )
349
+ elif summary_scope:
350
+ evidence_note = "Summary exports carry no per-row identities."
351
+ else:
352
+ evidence_note = "Saved source evidence contains the per-row identities."
353
+ return (
354
+ '<details class="fold" id="coverage"><summary><h2>Coverage and unfinished work</h2><span class="sum">A failed or missing answer is not a score of zero</span></summary><div class="fold-body"><p class="caption">Counts describe each saved selection.</p><div class="panel">'
355
+ + "".join(rows)
356
+ + '</div></div></details><details class="fold" id="errors"><summary><h2>Errors and stops</h2><span class="sum">Unscored outcomes remain separate from model quality</span></summary><div class="fold-body"><p class="caption">'
357
+ + evidence_note
321
358
  + "</p>"
322
359
  + error_table
323
360
  + "</div></details>"
@@ -492,9 +529,13 @@ def render(document: dict, sources: Mapping[str, dict]) -> bytes:
492
529
  warning_items = [f"<li>{esc(w.get('detail'))}</li>" for w in document.get("differences") or []]
493
530
  protocol_note = (
494
531
  "SOB @6 includes 5,000 text, 209 OCR and 115 audio transcript records. "
495
- "Displayed native metrics are pooled row diagnostics; the author combined formula "
532
+ "Native means below are pooled row diagnostics. "
533
+ "The headline is unweighted Value accuracy over each model’s graded rows, not all planned rows. "
534
+ "Unscored outcomes remain separate; they are not silently assigned zero. "
535
+ "Weighted metrics are labeled separately. The author combined formula "
496
536
  "requires all 5,324 rows graded and is retained separately in the native report. "
497
- "The recorded EvalRouter generation settings differ from the published reference."
537
+ "The recorded @6 generation variant differs from the published reference; "
538
+ "this is not a paper-score reproduction."
498
539
  if all_sources
499
540
  else "SOB Text uses the recorded EvalRouter protocol and each route’s recorded generation "
500
541
  "settings. This report is not a reproduction of the published Interfaze leaderboard."
@@ -796,9 +837,10 @@ def render(document: dict, sources: Mapping[str, dict]) -> bytes:
796
837
  <p class="meta">Native scores, coverage and settled charges, preserved together.</p></header>
797
838
  {report_html.intro(authored)}<nav class="toc" aria-label="Sections">{nav}</nav><div class="kpis boarded">{kpis}</div>
798
839
  <section class="major" id="overview"><div class="section-head"><h2>Results at a glance</h2></div>
840
+ <p class="caption">{esc(protocol_note)}</p>
799
841
  <div class="panel table-wrap"><table><thead><tr><th scope="col">Model</th><th scope="col" class="numeric">Native score</th><th scope="col" class="numeric">Graded / planned</th><th scope="col" class="numeric">Errors</th><th scope="col" class="numeric">Run charge</th>{'<th scope="col">Status</th>' if not complete else ""}</tr></thead><tbody>{"".join(rows)}</tbody></table></div>
800
842
  <p class="caption">Charges shown are settled EvalRouter totals recorded in these saved results, not provider token prices. Missing final costs are not shown as zero. For multiple profiles, the overview shows the first profile’s headline; all profiles follow below.</p></section>
801
- <aside class="callout"><strong>How to read this comparison</strong><p>{esc(protocol_note)}</p><p>{esc(document["statistics"]["reason"])}</p><ul>{"".join(warning_items)}</ul></aside>
843
+ <aside class="callout"><strong>How to read this comparison</strong><p>{esc(document["statistics"]["reason"])}</p><ul>{"".join(warning_items)}</ul></aside>
802
844
  {report_html.findings(authored)}{report_html.examples(authored)}{report_html.next_steps(authored)}
803
845
  <div id="charts">{chart_library or chart or '<section class="major"><h2>Charts</h2><p class="caption">No metric and sample chart met its data eligibility rules. Recorded values remain in the native metric tables.</p></section>'}{"" if chart_library else quality_charts(entries, profiles)}</div>
804
846
  {"" if chart_library else tradeoffs}