openai / gpt-6.1-sol / high / high 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 / high / high effort answer
## Finding: whitespace-only operators break matching parity
**High confidence; independently assessed from the supplied snapshot.** The Python matcher accepts an existing inspection whose operator is spaces-only, but the SQL matcher rejects it when the incoming operator is named.
In `[REDACTED: private project name]/backend/app/services/inspection_match.py`:
- `normalize_operator()` strips whitespace and converts an empty result to `None` (lines 48–55).
- `InspectionKeys.matches_row()` accepts a match when either normalized operator is missing (lines 129–134).
- `find_existing_inspection()` normalizes the incoming operator, but its SQL considers the stored operator missing only when it is `NULL` or exactly `''` (lines 213, 244–249).
**Reproducible trigger:** use identical municipality, project, asset, UTC timestamp and direction; stored `performed_by = ' '`; incoming operator `'Alice'`.
| Path | Result |
|---|---|
| Python `matches_row()` | `True`: stored operator normalizes to `None`. |
| SQL `find_existing_inspection()` | No match: spaces are neither `NULL` nor `''`, and `LOWER(TRIM(' ')) != 'alice'`. |
The reverse ordering accepts the match: incoming spaces normalize to `None`, satisfying SQL’s `:op IS NULL` branch. Thus record order and sequential-versus-batched matching can change the matching result. A caller that inserts after a miss could produce duplicate canonical inspections, affecting displayed rows and counts; that insertion/display linkage is **not established by this packet**.
## Request-to-predicate trace—and its limit
`[REDACTED: private project name]/frontend/src/hooks/useInspectionData.ts` does **not** issue an inspection-filter request. It fetches:
1. `/inspections/{id}/review-boot`, enabled only for positive IDs (lines 17–29).
2. `/review-pack/{id}/inspection.json`, gated by a fetched boot payload and nonempty trimmed pack path (lines 74–90).
Consequently, this snapshot cannot establish how frontend filter controls become `InspectionFilterSpec`.
Once a spec reaches `apply_inspection_filters()` in `[REDACTED: private project name]/backend/app/services/inspection_filter_pipeline.py`, predicates are composed in this order:
- Tenant scope and archival filtering (line 130).
- Project filtering: explicit `project_id` takes precedence over `in_project` (lines 133–138).
- Asset types and asset IDs; an empty asset-ID list explicitly matches nothing (lines 141–150).
- Saved filters, observation-parent filters, then transient NL conditions (lines 155–175).
- Search (line 178).
- Viewport: non-null coordinates and inclusive longitude/latitude bounds (lines 181–190).
Successive `.where()` calls intersect these dimensions. The internal semantics of the imported compilers and parent-filter helper remain outside the packet.
## Smallest correction and regression cases
For the demonstrated spaces-only defect, replace SQL’s:
```sql
OR performed_by = ''
```
with:
```sql
OR TRIM(performed_by) = ''
```
Keep the existing `performed_by IS NULL` branch.
Add SQL-versus-Python differential tests, holding all other keys equal:
- Stored operator `NULL`, `''`, and `' '` against `'Alice'`: all match.
- Reverse each pair: all match.
- `' Alice '` against `'alice'`: match.
- `'Alice'` against `'[REDACTED: person name]'`: no match.
- Repeat the whitespace case with both directions `NULL`, midnight/non-midnight timestamps, and unequal non-midnight timestamps; operator normalization must not bypass direction or time restrictions.
**Remaining boundary:** Python `.strip()` also removes tabs, newlines and other whitespace; PostgreSQL’s default `TRIM()` removes spaces. Test these explicitly. Full whitespace parity requires the SQL and Python paths to use the same normalization definition; the minimal patch above fixes only the demonstrated space case.
## Uncertainty and next action
No frontend-to-filter transport, schema validation, compiler internals, bulk-probe implementation or insert-on-miss caller is supplied. Therefore, antimeridian ranges, combined-filter transport bugs and nullable bulk-key failures are hypotheses—not established defects.
Next action: reproduce the operator mismatch with a database-backed differential test, then apply the narrow SQL correction and define broader whitespace handling.
MATERIAL_EVIDENCE_CONFLICT: `inspection_match.py:99–107` claims Python/SQL predicate equivalence, but `48–55,129–134` treat stored whitespace-only operators as missing while `244–249` do not.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
A gives a slightly more useful regression prescription for ensuring that fixing missing-operator semantics preserves the surrounding direction and time constraints. This is a forced, weak preference between near-equivalent answers, not an established material quality difference; an independent review could reasonably prefer B's path explanation.
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_0ab190e457560076393e77d3be02d8f4186293fc58179965424f4490df5b41d6. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.