openai / gpt-6-luna / xhigh / xhigh effort preferred over xai / grok-4.7-efficient / 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
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-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.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 `[]`.Primary judge's stated reason
A is preferable because its actionable diagnosis remains focused on the demonstrated mismatch rather than adding a false empty-list widening diagnosis. This is a clear task-relevant correctness advantage, not a preference based on presentation or length. B's useful regression matrix does not offset its unsupported additional repair recommendation.
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_85588313b321efe45204c7341c26e49a994b7b84f6802f88202b9825b122a9f3. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.