openai / gpt-6-luna / none / none effort preferred over openai / gpt-6-luna / low / low effort · close 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-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.
openai / gpt-6-luna / low / low effort answer
**NO-CHANGE.** The proposal’s integrity shape appears preservable: walking parents from the one fresh pointer, querying only walked revisions in the bound season, retaining active battles, and validating each ancestor’s count and digest can preserve ancestry order and fail-closed behavior. Whole-revision payload queries would also expose an extra same-revision insert between probe and fetch, provided payload validation checks the fetched count and digest. No exact-key lookup or skipped proof is warranted.
The limiting evidence is memory, not an identified integrity hole. A 99-revision payload cap is unsafe: 99 rows near D1’s 2 MB row limit already exceed 128 MB before accounting for row objects, D1 result serialization/escaping, parsed objects, and canonicalization/digest copies. A byte-aware payload grouping improves this but does not establish a safe bound: D1 publishes no response-byte limit, and the evidence supplies no conservative bound for serialization expansion, Worker heap amplification, concurrent-isolate headroom, or memory used by the SUM probe itself. SQLite’s aggregate need not accumulate JSON blobs, but returned counts and byte sums do not prove that query execution/result handling is memory-safe under the stated platform limits.
Therefore I cannot give defensible raw-byte and per-row constants, a maximum revision count, or arithmetic proving both D1 serialization and Worker heap stay strictly below 128 MB with shared-isolate margin. A single oversized revision fetched alone preserves today’s success behavior but remains a pre-existing risk; batching multiple revisions adds the unquantified aggregate-response and sibling-string retention risks. The fixture and local heap samples are not maxima or platform guarantees, and the ~0.8% local median difference does not establish a latency win.
**Next useful action:** retain the current reader until platform-specific worst-case bounds—including probe/result memory, serialized response expansion, and Worker parse/digest amplification under concurrency—are evidenced. Then reassess a byte-bounded whole-revision design with the specified integrity and regression tests. No production or remote latency claim is supported.
Primary judge's stated reason
B receives a forced, weak preference for slightly clearer separation of known probe behavior and unresolved payload-memory assurance, which helps identify what evidence would permit reconsideration. This is not an established material quality gap; A's explicit worst-case arithmetic counterbalances it, and an independent review could reasonably reject the preference.
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_e60767d1ac5ba3132513364fadf6a61f571a056a56d3c9349af815cf32d47541. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.