← Model losses

Head-to-head comparison

openai / gpt-6.1-sol / low / low effort preferred over openai / gpt-6-luna / low / low 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

Review persisted dashboard-layout parsing and its DashboardBuilderPage/BuilderCanvas consumers for a reproducible runtime crash caused by malformed widget shapes. Use only the supplied source files and the linked read-only reproduction. Establish the exact malformed shapes accepted by parseLayout and the resulting consumer failure; distinguish established behavior from assumptions. Recommend the smallest compatible correction that preserves valid stored layouts and custom widget data, plus focused regression tests. If the evidence does not establish the defect or a safe correction, state that clearly. Do not edit source or run tests.

Exact read-only reproduction stdout:
{"input":"[null]","parserOk":true,"canvasProjectionError":"TypeError: Cannot read properties of null (reading 'position')"}
{"input":"[{\"id\":\"w1\",\"type\":\"kpi_card\"}]","parserOk":true,"canvasProjectionError":"TypeError: Cannot read properties of undefined (reading 'x')"}
{"input":"[{\"id\":\"w1\",\"type\":\"kpi_card\",\"position\":{\"x\":0,\"y\":0,\"w\":4,\"h\":2}}]","parserOk":true,"canvasProjection":[0]}

openai / gpt-6.1-sol / low / low effort answer

## Conclusion — defect established

Independent, read-only analysis of the supplied snapshot; no tests run or files changed.

`[REDACTED: private project name]/frontend/src/lib/parseLayout.ts:15–17` accepts **every syntactically valid JSON array**, without validating its elements. The `WidgetConfig[]` assertion performs no runtime checks. Accepted malformed shapes therefore include:

- Nulls, primitives, nested arrays, and arbitrary objects.
- Widgets with missing or incorrectly typed `id`, `type`, `title`, or `config`.
- Missing/null `position`, or positions with missing, null, string, or otherwise invalid coordinates.
- Mixtures of valid and malformed widgets.

Acceptance does **not** establish that every such shape crashes.

### Established failure paths

| Input | Established behavior |
|---|---|
| `[null]` | Supplied reproduction reports `parserOk: true` and a null-`position` projection error. In the actual page, `widgets.find((w) => w.id …)` at `DashboardBuilderPage.tsx:49` would throw **earlier**, reading null’s `id`. Likewise, the canvas mapping reads `w.id` before `w.position` (`BuilderCanvas.tsx:43–44`). |
| `[{"id":"w1","type":"kpi_card"}]` | Accepted; the page’s `find` can complete, but canvas construction dereferences absent `position.x` (`BuilderCanvas.tsx:44`). The supplied reproduction confirms this undefined-`x` error. |
| Widget with `{x:0,y:0,w:4,h:2}` position | Supplied reproduction confirms successful projection `[0]`. This does not prove complete rendering succeeds without `title` and `config`. |

Both persisted loading routes pass accepted widgets directly into state (`DashboardBuilderPage.tsx:59–65,132–138`), clear the error, and render the canvas for nonempty layouts (`459–479`). Thus malformed arrays bypass the existing corrupt-layout handling and Save blocking.

The reproduction’s null error identifies an unsafe projection, **not the exact first exception in the supplied page/component**.

## Smallest compatible correction

Validate widget structure at the parsing boundary and reject the **whole layout** on failure:

- Require non-null, non-array widget objects.
- Require string `id` and `type`.
- Require non-null, non-array `position` objects with finite numeric `x`, `y`, `w`, and `h`.
- Return the original parsed objects unchanged on success.

Add an explicit error such as `invalid_widgets` to `LayoutResult` and the page’s `layoutError` type (`DashboardBuilderPage.tsx:32`). Existing failure branches already clear widgets, display the generic unexpected-format banner, and disable Save.

Do **not** filter malformed entries, reconstruct widgets from selected fields, restrict types to the drop allowlist, or impose canvas min/max values on persisted data. Those approaches risk silent data loss or rejecting custom/previously valid layouts. Preserve unknown fields and opaque custom configuration/query data.

This is a supported correction for the demonstrated page/canvas failures—not proof of complete renderer safety. Mandatory `title`/`config` validation or defaults require compatibility evidence beyond their API declarations (`api/dashboards.ts:40–55`); the supplied projection-valid example omits both.

## Focused regression tests

Extend `[REDACTED: private project name]/frontend/src/lib/parseLayout.test.ts` to cover:

1. Rejection of `[null]`, primitive/array elements, absent/null/non-object positions.
2. Rejection of missing or nonnumeric coordinates, and non-finite numbers from valid JSON such as `1e400`.
3. Rejection of one malformed element among valid widgets, without partial success.
4. Preservation of `[]`, existing valid layouts, custom type strings, unknown fields, nested custom configuration, and query data.
5. Preservation of the current `invalid_json` and `not_array` classifications.

Add page-level regressions for **both URL loading and saved-dashboard selection**: malformed layouts must not throw, must show the error banner, must disable Save, and must recover through “Start fresh.”

## Limits and next action

`WidgetRenderer`, `WidgetConfigEditor`, and grid-library implementation are outside the supplied packet. Invalid field values may cause additional failures there, but those are not established. Template loading also bypasses `parseLayout` (`DashboardBuilderPage.tsx:121–124`); that is a separate input path, not evidence of persisted-parser protection.

Next useful action: implement the boundary guard and focused regressions, then verify renderer requirements before broadening validation.

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

**Conclusion (high confidence):** The supplied reproduction and source establish a runtime crash when persisted JSON is an array containing either `null` or a widget without `position`.

- `parseLayout` checks only that the parsed value is an array, then casts its elements to `WidgetConfig[]` without validating them (`parseLayout.ts:13–18`). Thus both `[null]` and `[{"id":"w1","type":"kpi_card"}]` are accepted.
- `DashboardBuilderPage` installs any successful parse as `widgets` (`DashboardBuilderPage.tsx:55–74, 130–146`). Nonempty widgets render `BuilderCanvas` (`:451–480`).
- `BuilderCanvas` projects every item by reading `w.position.x` and the other position fields (`BuilderCanvas.tsx:40–54`). The supplied reproduction confirms the resulting errors for `null` and missing `position`. A widget with the shown complete position projects successfully.
- The evidence does **not** establish that every malformed widget shape crashes, nor does the third reproduction establish validation of position values or the rest of a widget’s fields.

**Smallest compatible correction:** Validate the parsed array’s structural requirements before returning success, while preserving each valid widget object unchanged—including unknown/custom fields. Reject malformed entries through an explicit error result so the existing page’s invalid-layout banner and save block apply. Avoid rebuilding widgets from a whitelist, which could discard custom data. The packet does not establish the full minimum valid widget schema; requiring only non-null objects and a usable `position` object with `x`, `y`, `w`, and `h` addresses these demonstrated crashes, but numeric/range requirements need an explicit compatibility decision.

**Focused regression tests:** Add parser cases for `[null]` and a widget missing `position`, asserting they are rejected; keep a valid positioned widget case asserting success and preservation of an extra custom field. Add or retain a consumer-level regression showing rejected persisted data does not reach the canvas. Existing tests cover JSON syntax and top-level array shape only (`parseLayout.test.ts:12–61`).

**Uncertainty:** `WidgetConfig` declares required fields (`dashboards.ts:40–55`), but the supplied evidence does not show backend layout contracts or all widget/custom-data conventions. The exact read-only reproduction establishes the two failures, not broader schema constraints.

Primary judge's stated reason

B provides a more accurate account of the actual first consumer failure and a more actionable correction, including the required error-union update and regressions for both loading routes. This supports a clear comparative advantage in evidence tracing and practical coverage, not a claim that A's core diagnosis is wrong or that B proves universal compatibility.

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

Battle wave: 1ac788c7-8a93-4502-8b1a-e4734c703741. Pair: brp1_7cc32bf442d9e44c0f6a4d70d8731dc0b08d37f146cc0ba0e7736eb7a53e5c9b. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.