← Model losses

Head-to-head comparison

xai / grok-4.7-efficient / low / low 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

Trace inspection filtering and matching from frontend request through backend predicate construction. Identify a concrete parity or data-integrity risk (including nulls, ranges, or combined filters) where the visible result set can diverge from intended semantics; show the precise path and propose a minimal correction and boundary regression cases.

xai / grok-4.7-efficient / low / low effort answer

The operator-match predicate is not null/whitespace-safe across the two in-packet match implementations, so the same inspection can merge on one path and duplicate on the other. The supplied frontend hook never builds an inspection filter request.

**Primary risk (high confidence).** `InspectionKeys.matches_row` and `find_existing_inspection` disagree on whitespace-only `performed_by`.

Intended semantics, stated in `inspection_match.py` and implemented by `normalize_operator` (lines 48–55, 129–134): an operator is missing when it is null, empty, or whitespace-only; missing on either side accepts; otherwise compare case-insensitively after trim.

- Python path: `normalize_operator('   ')` is `None`, so `matches_row` returns `True` against a real operator such as `'Alice'`.
- SQL path (`find_existing_inspection`, lines 244–249): `performed_by IS NULL OR performed_by = ''` does not treat `'   '` as missing. `LOWER(TRIM(performed_by))` becomes `''`, which is not equal to `'alice'`, so the row is rejected when `:op` is non-null.

Incoming operators are normalized before bind (`op_norm` at line 213), so the reverse case (whitespace only on the candidate) already matches in SQL via `CAST(:op AS text) IS NULL`. Only a whitespace-only stored `performed_by` diverges. Chunk dedup and the sequential probe can therefore disagree, and the strict-match invariant (one canonical row) fails. `LIMIT 2` also undercounts that warning; it does not change the chosen id.

Minimal correction — make the SQL missing-check the same as `normalize_operator`:

```sql
AND (
  NULLIF(BTRIM(performed_by), '') IS NULL
  OR CAST(:op AS text) IS NULL
  OR LOWER(BTRIM(performed_by)) = LOWER(BTRIM(CAST(:op AS text)))
)
```

Boundary cases (same muni/project/asset/UTC date/direction; both times non-midnight and equal unless noted):

1. DB `performed_by='   '`, candidate `'Alice'` → both paths match (today: Python matches, SQL does not).
2. DB `'Alice'`, candidate `'   '` / `None` / `''` → both match.
3. DB `'  Alice  '`, candidate `'alice'` → both match.
4. DB `'Alice'`, candidate `'[REDACTED: person name]'` → both reject.
5. DB `NULL` or `''`, candidate `'[REDACTED: person name]'` → both match.
6. Direction `NULL`/`NULL` matches; `NULL`/`'U'` does not.
7. Both times non-midnight and unequal → reject; either side midnight UTC → accept.

**Second filter risk (medium confidence; reachability not in packet).** `asset_id_in` treats `[]` as match-nothing because SQLAlchemy `in_([])` drops the clause (lines 144–150). `asset_type_ids` does not (lines 141–142). If an empty list is accepted by `InspectionFilterSpec`, the grid returns every asset type in scope instead of none. Same sentinel as `asset_id_in` (`sa_false()` when the list is empty). Regress `[]` → empty set, `None` → no predicate, `[id]` → that type only. Schema validation is outside this packet.

**Discarded or weaker.** Viewport bounds are inclusive and drop null centroids; antimeridian behavior is unspecified here. `project_id` wins over `in_project` by `if/elif`; whether both can be set is outside the packet. `useInspectionData.ts` only gates review-boot and `inspection.json`; it does not construct filter predicates, so it is not on this path. Nullable `direction` inside `hard_key` is unsafe for SQL `IN` (`NULL` never matches `NULL`) even though sequential SQL uses `IS NOT DISTINCT FROM`; the bulk `IN` caller is not in this packet. `matches_row` uses `astimezone` on a naive datetime (local zone), while `parse_inspection_datetime` uses `replace(tzinfo=UTC)`; that diverges only if a naive value reaches `matches_row`.

**Missing.** `InspectionFilterSpec`, `compile_filters`, `apply_search`, `archival_filter`, and the bulk probe that consumes `hard_key` are outside the packet. Consequence: empty `asset_type_ids` and null-direction bulk `IN` cannot be confirmed as live callers from this snapshot alone. The operator whitespace split does not depend on those files.

**Next action.** Add a differential test for case 1 above (whitespace-only DB operator vs named candidate) against both `matches_row` and the SQL text, then align the SQL `NULLIF(BTRIM(...))` check. Separately, mirror the `asset_id_in` empty-list sentinel on `asset_type_ids` if the spec allows `[]`.

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

**Conclusion:** The snapshot does not establish a frontend-to-backend filtering or matching parity defect. The supplied frontend hook fetches review-pack enrichment, not an inspection-filter request, so it provides no evidence about how filter parameters are sent. The backend pipeline does show a concrete boundary risk: if `viewport_bbox` permits `min_lon > max_lon` (or `min_lat > max_lat`), its inclusive lower-and-upper-bound predicates cannot match any centroid (pipeline lines 180–189). Whether such bounds are rejected earlier is unknown because the filter-spec schema is outside the packet.

**Recommendation:** Validate bbox ordering when constructing the filter spec, or normalize/explicitly support antimeridian-crossing longitude ranges if those are intended. Add boundary tests for equal bounds, reversed longitude and latitude bounds, and points exactly on each inclusive edge. Also test combined bbox and asset-type filters to confirm both narrow the result set.

**Alternative / uncertainty:** Empty `asset_id_in` is explicitly handled as match-none (lines 144–150), and nullable centroids are explicitly excluded when bbox filtering (lines 184–185); neither alone demonstrates unintended behavior. `inspection_match.py` compares UTC date/time and uses NULL-safe direction matching, but it is import deduplication logic, not the inspection-filter request path. The frontend request construction, bbox validation, and relevant dependencies are not present, so end-to-end parity cannot be confirmed.

**Next useful action:** Inspect the schema/route that parses `viewport_bbox` and the frontend code that builds `/inspections/query` requests; verify reversed-range handling and add request-to-SQL regression coverage.

Primary judge's stated reason

B provides the more actionable demonstrated parity finding, whereas A offers only a validation-dependent range risk and misses the visible matching discrepancy. Given B's erroneous secondary finding and overly broad normalization claim, this is a weak preference, not an established material quality gap; an independent review could reasonably weigh A's restraint more heavily.

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

Battle wave: 1a629e2d-f9fa-4128-8962-e007165c19b0. Pair: brp1_336ff6ff98bd0313275509e6e310d93153aa2ab5607734b894b99d9c67d39190. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.