← Model losses

Head-to-head comparison

openai / gpt-6-astra / low / low effort preferred over openai / gpt-6-luna / none / none effort · clear win.

Primary judge: Sol 6.1, requested Low. Effective provider effort and internal attempts were not verified. A close win is still a scored preference; it does not establish a material defect.

Reviewed public evidence

Task goal

Qualify whether a safe, bounded whole-revision cohort batch can replace the per-ancestor cohort SELECT inside readActiveCombinedSeason, or whether the honest result is no source change. Planning qualification only. Do not propose the rejected exact-key/index-page design. Do not claim a production or remote latency win.

## Current reader (src/combined-season-store.js readActiveCombinedSeason)
- One fresh pointer read: SELECT season_id,revision FROM combined_season_active WHERE id=1. Null pointer returns null. No cross-request cache.
- Active version: SELECT * WHERE season_id=? AND revision=?. Missing throws 'Missing active combined version'.
- Active cohorts: SELECT public_id,cohort_id,cohort_sha256,public_json WHERE season_id=? AND revision=? ORDER BY public_id. Validate board.season id/revision, rows.length===cohort_count, board.waves===rows.length, digest({board,battles:parsed public_json in that order})===manifest_sha256. Else 'Invalid active combined snapshot'. Active battles are retained in the return value.
- Ancestry walk from the active version, not from all season rows. seen revision or seen.size>=10000 throws 'Invalid combined history chain'. Missing parent row throws 'Missing combined history ancestor'. For each ancestor revision ≠ active: SELECT public_json WHERE season_id=? AND revision=? ORDER BY public_id; validate season id/revision, length===cohort_count, digest===manifest_sha256; else 'Invalid combined history snapshot'. Historical battles are used only for digest and then dropped. History retains only {revision,sourceRevision,recordedAt,board}. Returned history is reversed (root first).
- Queries for N versions (1 active + N-1 ancestors): 2N+1. Fixture N=25 → 51 reads.
- Staged/abandoned/rollback descendants are excluded because they are not on the parent_revision chain from the fresh pointer. Season scoping is the bound season_id. Tenant isolation is that season_id plus board.season.id check.
- Corrupt JSON.parse throws SyntaxError today (not remapped). Manifest/count mismatch uses the Error strings above. Preserve those fail-closed outcomes. Do not skip proofs.
- Schema (migrations/0008_combined_seasons.sql): cohorts PK (season_id,revision,public_id). No CHECK on cohort_count or public_json length. Triggers block UPDATE/DELETE of versions and cohorts, not INSERT of an additional cohort row. D1 max bound parameters = 100. D1 max row = 2,000,000 bytes. D1 has no published max response-byte limit; query execution and result serialization run inside Workers CPU/memory limits. Workers isolate memory is 128 MB per isolate, shared across concurrent requests, not a per-query budget. events.js already chunks IN lists at 100 bindings and that pattern is not a byte bound.

## Evidence (do not treat fixture sizes as maxima)
- Clean base 2f91cf6997ae45284f7049251f94651f42d34e8f. Fixture SHA256 88e5ebd008f06153f53e57c6b85e811d72778d1d27a1b78fc79296d1e44c7a90. 25 versions, 1017 cohort rows, max public_json 14204 bytes, max revision public_json sum 467929 bytes / 52 rows, sum of all public_json 8392192, sum of board_json 524262.
- Integrity-viable prototype batches ancestor cohorts with revision IN (≤99) plus season_id, ORDER BY revision, public_id, then groups and validates count/digest. It does not use exact public_id keys. Local results: exact fixture output, 28 reads vs 51, max 25 bindings, and 8 integrity cases passed including extra-row-before-batch (error 'Invalid combined history snapshot'). It is distinct from the rejected exact-key proposal (67 reads, slower, and an isolated-copy extra-row insert was omitted so the candidate accepted a snapshot the baseline rejected).
- Prototype defects that must not be copied: fixed 99-revision batch with no byte/row budget; parsed ancestor battles accumulated in a Map until return; no prompt release. Sampled process heapUsed peak was 55690136 prototype vs 23530272 baseline. Those samples are not a platform guarantee.
- Local median 72.88 ms vs 73.47 ms (~0.8%). Not a meaningful latency improvement. Remote D1 round-trip value is unmeasured. Do not claim a speedup. Query-count reduction is the only established mechanism.
- Binding boundaries already shown on empty synthetic cohorts: 0/1/98/99/100/198/199 ancestors split 99+remainder, max 100 bindings. That does not validate response bytes or heap.

## Candidate under test (attack this; do not rubber-stamp)
Only batch whole ancestor revisions, never the active revision's retained payload (different columns; battles must remain in the return value). Keep the version walk one row at a time so board_json (up to the 2 MB row cap) is not itself batched. After a window of at most 99 ancestor revisions:
1. Size probe: SELECT revision, COUNT(*) n, COALESCE(SUM(LENGTH(public_json)),0) bytes FROM combined_season_cohorts WHERE season_id=? AND revision IN (...) GROUP BY revision. Absent revision means 0 rows. Response is integers only.
2. Pack whole revisions into payload groups whose sum(bytes) + n*per-row allowance ≤ a raw budget. A revision over budget is fetched alone, same shape as today's one-revision SELECT, and is not failed solely for size (that would change currently successful reads). Never LIMIT/truncate rows. Never look up exact public_ids.
3. Payload: SELECT revision, public_json WHERE season_id=? AND revision IN (group) ORDER BY revision, public_id. Group by revision preserving public_id order. Validate season, count, digest. On mismatch throw the existing error. Then drop that revision's strings and parsed battles before the next revision. Do not retain historical battles.
4. History order remains ancestry order, not SQL revision sort. Only walked revisions are queried, so staged/rollback siblings stay excluded. Pointer is read once per call, not cached.
5. Extra same-revision INSERT between probe and payload must be visible to the payload IN query and fail closed on count/digest. A size/count mismatch between probe and payload also fails closed. Deletes cannot happen (trigger). Other seasons cannot match the bound season_id.

Worst case to bound explicitly: 99 revisions × one ~2 MB public_json already exceeds 128 MB before parse, so a fixed 99 cap is unsafe. Also bound row-object overhead, D1 JSON escaping of the result (quotes in stored JSON), Worker-side JSON.parse + stable()/TextEncoder copies during digest, and the fact that sibling revisions' raw strings stay live until the result array is released.

## Decide
1. Is this strategy integrity-safe if implemented exactly, or is there a remaining omission/order/tenant/staged/rollback/pointer/fail-open hole?
2. Is the windowed SUM(LENGTH()) probe safe on SQLite/D1 (row-at-a-time, blobs not accumulated), or can the probe itself exceed isolate memory? If the probe is unsafe, is any multi-revision batch provably safe? If not, the result is no-change.
3. Give an exact raw-byte budget, per-row allowance, and max revisions (≤99) with arithmetic showing peak D1 serialization and Worker heap stay strictly inside 128 MB with shared-isolate margin, including parse and canonical copies. State what is pre-existing single-revision risk versus new batch risk.
4. Say whether a genuine source candidate is warranted. If yes, list the minimum code/test/doc delta. Tests must exercise 0/1/24/99/100/198+ revisions, binding cap 100, insertion race, public_id order, tenant/season, missing/corrupt/count/hash, cycle/depth, rollback/staged exclusion, pointer refresh, and batch boundaries. If no, state the exact limiting evidence for no-change.
5. Do not recommend cross-request cache, skipped proofs, scoring/UI/ingestion/schema/runtime changes, or production calls.

Return a concise verdict: IMPLEMENT with exact constants and non-negotiable constraints, or NO-CHANGE with the limiting evidence. Flag uncertainty instead of guessing platform behavior.

openai / gpt-6-astra / low / low effort answer

## NO-CHANGE

Independent, read-only assessment of the supplied snapshot. **Integrity is conditionally viable; bounded memory is not established. No source candidate is warranted.**

### 1. Integrity

Whole-revision, season-bound `IN` queries preserve completeness and `public_id` ordering. With every walked revision validated—including absent groups as empty arrays—there is no identified tenant, staged-sibling, rollback-descendant, or pointer-cache hole.

Non-negotiable qualifications:

- Validate in ancestry order, not SQL revision order.
- Preserve existing count/hash errors and unwrapped `SyntaxError`. Walking ahead can encounter a missing parent/cycle before a nearer corrupt snapshot that the baseline would reject first; exact error precedence is therefore not automatically preserved.
- An inserted row **visible to the payload statement** is included and rejected by count/hash validation. Separate statements alone do not establish D1 visibility guarantees.
- A probe/payload mismatch check is an integrity check **after materialization**, not a memory bound.

These conclusions follow from `src/combined-season-store.js:19–28` and the insertion-permitting schema at `migrations/0008_combined_seasons.sql:18–34`.

### 2. The probe does not establish a byte bound

`LENGTH(public_json)` on SQLite TEXT counts Unicode characters, not UTF-8 bytes, and stops at an embedded NUL. Calling its sum `bytes` is incorrect. Corrupt text with a short prefix and large NUL-delimited suffix can substantially defeat that estimate before `JSON.parse` rejects it.

`COUNT`/`SUM` aggregate state does not inherently accumulate payload blobs. The existing primary-key order offers a plausible streaming grouping plan. However, the packet supplies no D1 execution-plan or allocator guarantee proving total query memory is row-bounded; sorting, buffering, and serialization remain uncertain. **This is not evidence that the probe necessarily exhausts memory.**

Also, the response includes TEXT `revision`, not integers only; the schema does not constrain revision length.

### 3. Exact safe constants cannot be justified

No defensible raw-byte budget, per-row allowance, or multi-revision cap can satisfy the requested strict shared-isolate guarantee from this evidence.

- The stated counterexample is approximately `99 × 2,000,000 = 198,000,000` raw bytes, already above even 128 MiB (`134,217,728` bytes).
- Inserts between probe and payload can increase payload size without an established bound. Rejecting afterward cannot prevent allocation failure.
- D1 response escaping and buffering, JS string/row-object allocation, parsed-object expansion, recursive canonical copies, JSON serialization, and `TextEncoder` allocation lack supported peak-memory constants. The copying path is explicit at `src/combined-season-profile.js:13–15`.
- Dropping references does not guarantee immediate collection; sibling strings remain live while the batch result retains them.
- Fetching version rows individually does not prevent a window implementation from retaining many raw `board_json` strings.
- Retained active data, growing history, and concurrent requests have no established shared-isolate headroom.

**Pre-existing risks:** an arbitrarily large single revision, retained history boards, parsing/canonicalization, and concurrent requests.  
**New risks:** simultaneously live sibling payloads, window metadata/raw boards, and reliance on a stale size estimate. Single-revision fallback preserves compatibility but cannot turn these into an absolute memory guarantee.

### 4. Recommendation

Leave source unchanged. The prototype establishes query-count reduction only; its timing and heap samples establish neither latency benefit nor platform safety. Its 28-read result also excludes the newly proposed probes.

Requalification would require trustworthy byte accounting, a bound effective **before payload materialization despite inserts**, and supported allocation/concurrency assumptions. Boundary and integrity tests alone cannot supply those guarantees. No code/test delta is justified under the present scope.

openai / gpt-6-luna / none / none effort answer

**NO-CHANGE.** The query-count reduction is real evidence, but the candidate cannot be qualified as safely bounded from the supplied evidence.

1. **Integrity:** Whole-revision batching can preserve the current proof if it fetches every row for only the walked ancestor revisions, orders by `(revision, public_id)`, validates each revision’s season, count, and digest, and releases historical payloads before continuing. The extra-row race is caught when the payload query sees the inserted row and count/digest validation fails. This preserves active payload retention, ancestry order, fresh-pointer semantics, and exclusion of staged or rollback siblings. No integrity hole is evident under those constraints; JSON parse errors must remain fail-closed as they are today.

2. **Probe and memory:** `SUM(LENGTH(public_json))` aggregates integer lengths, not blobs, so the probe’s result is small; the packet provides no evidence that it accumulates payload values in isolate memory. That does **not** establish a bound for the payload query’s result serialization or Worker heap. D1 publishes no response-byte cap, and the 2 MB row cap plus 128 MB shared isolate limit do not bound total rows per revision or concurrent memory use.

3. **No defensible constants:** No raw-byte budget, per-row allowance, or revision count can be proven strictly within 128 MB from these facts. A payload group’s raw stored bytes do not bound D1 JSON escaping, row-object overhead, simultaneous sibling strings, parsed objects, or `stable()`/`TextEncoder` digest copies. Choosing constants would require unprovided bounds for those representations and shared-isolate headroom. A one-revision oversized fallback preserves existing successful reads but retains the baseline’s unbounded single-revision risk; grouping revisions adds a new aggregate risk. A fixed 99-revision cap is not a byte bound.

4. **Source candidate:** Not warranted without those bounds or platform measurements/contracts. The fixture’s 25 revisions and 467,929-byte largest revision are observations, not maxima. Local medians (72.88 vs 73.47 ms) do not establish a latency win; only the query-count mechanism is supported. The prototype’s ~55.7 MB sampled heap versus ~23.5 MB baseline reinforces that heap cost is material, not that either is safe.

**Next useful action:** Establish enforceable limits for result serialization and Worker peak memory—including concurrency, escaping, parse and digest copies—or retain the current per-ancestor reads. Do not claim a production or remote latency improvement. Confidence: high on the no-change qualification given the stated evidence; platform-specific peak-memory behavior remains unmeasured.

Primary judge's stated reason

B provides a clearer substantive advantage: it explains why the specific probe cannot certify the proposed budget and why post-materialization mismatch detection cannot enforce that budget. This makes the limiting evidence and prerequisites for requalification more actionable. The advantage is in the qualification reasoning, not a different verdict or proof of observed production failure.

This reason is the judge's assessment. No independent factual-defect finding is asserted by this record.

Battle wave: 83b6dfa9-59af-4543-9e30-bcd15553ccf9. Pair: brp1_bb5610f7018fd9ed576760a67a8cee0dfb379bf6d4d3b513c0318f3ea88ae7c2. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.