openai / gpt-6-luna / low / low effort preferred over openai / gpt-6-luna / medium / medium 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 / 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.
openai / gpt-6-luna / medium / medium effort answer
**NO-CHANGE.** The query-count reduction is established, but no exact constants can be justified that guarantee the proposed batch’s serialized response and Worker heap remain strictly below 128 MB with shared-isolate margin.
The size probe’s grouped `SUM(LENGTH(public_json))` returns integers, so it does not itself accumulate cohort blobs into its result. But the packet does not establish a bound on the number of groups/rows returned, SQLite/D1 memory during aggregation, or Worker memory for D1 result serialization. Nor does it give a platform guarantee converting a raw-byte budget and per-row allowance into a strict bound covering JSON escaping, row-object overhead, simultaneously live sibling strings, `JSON.parse`, and canonicalization/`TextEncoder` digest copies. Therefore I cannot supply the required byte budget, per-row allowance, and max revisions with defensible peak-memory arithmetic. A fixed 99-revision window is expressly unsafe; singleton fallback for an oversized revision does not bound the response for a revision containing many individually valid rows.
Integrity-wise, batching only walked ancestors with season-scoped revision queries can preserve the existing ancestry, staged/rollback exclusion, fresh pointer, ordering, and digest/count proofs. The insert race must be caught by validating payload counts and hashes against the version manifest, not by trusting probe counts. These safeguards do not resolve the resource-bound gap.
The evidence supports fewer reads, not a meaningful latency gain: local median improvement is about 0.8%, and remote D1 latency is unmeasured. The minimum next step is obtaining defensible platform/result-memory bounds or redesigning the read path under separately approved constraints; until then, retain the existing per-ancestor reads.
Primary judge's stated reason
B provides a slightly more reliable explanation of why no source candidate is warranted without confusing bounded probe output with unbounded execution memory or inherited risk with new risk. This is a weak, forced preference between substantially equivalent recommendations, not an established material quality gap; 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_ccd19f7f740c43c31eef1dfea07d3ca47cf6804ed2ab6b3a3669e4c28cc886d5. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.