← Model losses

Head-to-head comparison

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

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

## Finding: operator normalization differs between matching paths

**Confirmed predicate-parity defect; high confidence.** In `inspection_match.py`, Python accepts an existing whitespace-only operator as missing, but SQL does not.

Reproducible trigger:
- Existing inspection: `performed_by = '   '`.
- Incoming inspection: operator `"Alice"`.
- Municipality, project, asset, UTC date, time, and direction otherwise match; existing row is not deleted.

**Precise path**
- Incoming operator becomes `"Alice"` through `normalize_operator()` (lines 48–55, 213).
- Python `InspectionKeys.matches_row()` normalizes the existing operator to `None`, so accepts it (lines 129–134).
- SQL `find_existing_inspection()` accepts existing operators only when NULL, exactly `''`, or normalized-equal to the incoming operator (lines 244–249). Spaces are neither NULL nor empty, and `LOWER(TRIM('   '))` differs from `"alice"`, so SQL rejects the row.

Consequently, bulk/chunk matching can merge a record that sequential matching rejects. Rejection can lead to duplicate canonical inspections **if the caller inserts after a nonmatch**; that caller is outside this packet. Such duplicates can subsequently appear in filtered result sets.

### Minimal correction and regressions

Replace SQL’s `performed_by = ''` missing-value branch with `NULLIF(TRIM(performed_by), '') IS NULL`. This fixes the demonstrated spaces-only case.

Python `str.strip()` also handles tabs, newlines, and broader whitespace that PostgreSQL’s default `TRIM` does not. For complete parity, explicitly define and implement the same whitespace-normalization contract on both sides.

Differential SQL/Python regression cases:
- Existing operator NULL, `''`, spaces-only, tabs-only, and newline-only against incoming `"Alice"`.
- Reverse those missing-value cases.
- `" Alice "` against `"alice"`; `"Alice"` against `"[REDACTED: person name]"`.
- Hold other keys equal, then vary NULL/non-NULL direction, midnight versus non-midnight time, unequal non-midnight times, and UTC date boundaries to ensure independent predicates still constrain matching.

## Frontend-to-filter trace: evidence limitation

`useInspectionData.ts` requests `/inspections/{id}/review-boot` (lines 17–29), then conditionally requests `/review-pack/{id}/inspection.json` (lines 74–90). **It does not construct a filtering request.** An end-to-end frontend filter serialization trace cannot be established from this snapshot.

Once an `InspectionFilterSpec` reaches `apply_inspection_filters()`, the visible construction is:
tenant/archive → project → asset type → asset IDs → saved filters → observation-parent filters → transient NL → search → viewport (lines 129–190).

Successive `.where()` calls combine these dimensions conjunctively. Explicit empty asset IDs match nothing (lines 146–150); viewport bounds are inclusive and exclude NULL coordinates (lines 181–190). No concrete range or combined-filter defect is established here. Spec validation, router assembly, and delegated compiler semantics remain outside the packet.

**Next useful action:** add the operator differential regression and normalization fix first; independently verify frontend filter serialization against the router/spec contract when that evidence is available.

MATERIAL_EVIDENCE_CONFLICT: `inspection_match.py:99–107` claims Python/SQL predicate parity, but Python treats whitespace-only existing operators as missing at lines 129–134 while SQL rejects them against a named incoming operator at lines 244–249.

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

## Evidence packet

**Conclusion — concrete matching parity defect.** In `inspection_match.py`, the Python mirror treats whitespace-only `performed_by` as missing: `normalize_operator()` calls `.strip()` and returns `None` for an empty result (lines 48–55), and `matches_row()` accepts a row when its normalized operator is `None` (lines 129–134). The SQL predicate does not: it accepts only `NULL`, the exact empty string, a missing candidate operator, or a case-insensitive trimmed equality (lines 243–249). For a stored value of `'   '` and candidate operator `"Alice"`, Python matches but SQL rejects. This contradicts the stated 1:1 parity at lines 99–107.

**Risk and path.** The batch path uses `matches_row()` to filter bulk-probe results and deduplicate incoming records (lines 99–103); the sequential path uses `find_existing_inspection()`’s SQL predicate (lines 167–177, 215–263). Thus the same inspection can match in the batch path but fail to match in the sequential path. If the failed match leads to a new insert, it can create a duplicate inspection and diverge in visible results. That final persistence/display consequence depends on callers not included in the packet.

**Filtering trace.** The supplied frontend hook requests `/inspections/{id}/review-boot` and, when a review pack exists, `/review-pack/{id}/inspection.json` (`useInspectionData.ts`, lines 17–29 and 74–91). It does not show a grid-filter request or construction of an `InspectionFilterSpec`, so the frontend-to-filter-spec mapping cannot be established from this snapshot. The backend pipeline applies tenant/archive predicates, project and asset restrictions, saved and observation filters, transient NL filters, search, and then viewport bounds (`inspection_filter_pipeline.py`, lines 129–190). Viewport filtering requires non-null centroids and uses inclusive min/max bounds. No defect in those bounds is established by the supplied code.

**Minimal correction and regression cases.** Make SQL treat a trimmed-empty stored operator as missing, e.g. add `NULLIF(BTRIM(performed_by), '') IS NULL` to the missing-operator branch. This fixes the demonstrated spaces-only case. PostgreSQL’s default `BTRIM` does not necessarily match Python’s broader `str.strip()` behavior for tabs or Unicode whitespace; either align that normalization contract or test and handle those characters explicitly.

Add a differential regression test comparing SQL and `matches_row()` for candidate `"Alice"` against stored `NULL`, `''`, `'   '`, `'alice'`, and `'[REDACTED: person name]'`; also test a whitespace-only candidate. For the separate time predicate, retain boundary cases where either side is UTC midnight (accepted) versus two different non-midnight times on the same UTC date (rejected).

**Uncertainty / next useful action.** The filter schema, inspection router, filter compiler, frontend client, and `inspection_match` callers are outside the packet; their behavior and the final route from a failed match to a displayed duplicate are unverified. The next useful check is a SQL-vs-Python differential test for operator normalization, followed by checking the caller behavior on a SQL miss.

Primary judge's stated reason

B receives a slight forced preference because its explicit bidirectional normalization matrix and independent-key boundary cases offer a somewhat more usable regression plan. This is not an established material quality difference; the core diagnosis, correction, and evidentiary limits are near-equivalent, and an independent review could reasonably reject this preference.

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_77dc1b330f8559188d96b2a07ec529571655cae7dc2e4bcd335edfd6b56df6cd. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.