xai / grok-4.7-efficient / 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
Audit [REDACTED: private project name] QA/QC flag review and correction flow for data-loss, stale-state, and invalid-transition defects across queue selection, edit/save, and refresh. Report only defects demonstrable from supplied code, with exact trigger and state transition, smallest safe fix, and targeted regression scenarios.
xai / grok-4.7-efficient / low / low effort answer
The supplied files contain six demonstrable defects. The edit/save persistence and query invalidation inside `useRevalidate`, `useQaqcQueue`, and `useInspectionValidation` are outside the packet, so those paths are not treated as proven.
## Defects
1. **QA review `pending`/`running` is a sink (stale state).**
Trigger: `useQAReview` returns `status: 'pending' | 'running'`, including after `useTriggerQAReview` succeeds and invalidates once (`qaReview.ts` 57–59).
Transition: any review → `QAReviewPanel.tsx` 67–75 spinner. That branch has no poll, no error, and no re-run control. Nothing in these files schedules another fetch.
Fix: while status is `pending` or `running`, set `refetchInterval` (about 2s) and a timeout/failure exit that restores re-run. Do not early-return without a refresh path.
Regression: POST/GET returns `running`, then a later GET returns `completed` with flags; UI must leave the spinner without a remount. A still-`running` result after the timeout must show failure + re-run, not spin forever.
2. **Initial QA fetch failure is shown as “no review” (invalid transition).**
Trigger: `useQAReview` errors (`isLoading === false`, `data` undefined). `isError` is never read (`QAReviewPanel.tsx` 32–41).
Transition: fetch error → “No QA review has been run” + Run.
Fix: if `isError`, render the error and retry; only the success-null case may show “no review”.
Regression: 404/null still shows Run; 500 does not, and Run is not offered as if no review exists.
3. **Failed QA run is rendered as a normal completed review.**
Trigger: `review.status === 'failed'` after the `pending`/`running` check (`QAReviewPanel.tsx` 78–146).
Transition: `failed` → health badge, summary, and flags, with no failed banner. Empty flags do not show the pass line (that requires `completed`), but the layout is still the success layout.
Fix: explicit `failed` branch with the server summary and re-run; do not render health/flags as a finished pass.
Regression: `failed` with leftover flags must not look like a completed review; `completed` + no active flags still shows the pass line.
4. **Keyboard revalidate allows overlapping runs (invalid transition).**
Trigger: `r` calls `runRevalidate` (`QAQCPage.tsx` 106–109, 164–166) with a new `crypto.randomUUID()` and no `revalidate.isPending` check. The pending flag is only passed to the child button (230).
Transition: in-flight revalidate → second mutate for the same inspection, different idempotency key. Completion order is unconstrained here.
Fix: return immediately in `runRevalidate` when `selectedInspectionId === null` or `revalidate.isPending`.
Regression: double `r` and button + `r` send one request; a new `r` after settle sends one new request.
5. **Error index survives a same-length validation refresh (stale selection).**
Trigger: `errors` is replaced (revalidate/refetch) with the same length. The only resync is the shrink clamp (`QAQCPage.tsx` 115–119). `Enter` then uses that index (`88–92`, `161–163`).
Transition: selected error A at index i → list replaced, index i still selected → `Enter` focuses a different error.
Fix: when the validation result identity changes (`dataUpdatedAt` or an error-id fingerprint), reset `selectedErrorIdx` to 0 and clear `focusedField` unless the focused error id is still present.
Regression: length shrink still clamps; same-length reorder does not `Enter` into the old index’s new row; switching inspection still starts at 0.
6. **Refresh drops the correction position; `n` / `gg` do not move through the queue (data-loss + invalid transition).**
Trigger A: open an error (`applyFocusedParams` writes `tab`/`obs`/`focus` only, `QAQCPage.tsx` 36–48), then reload. Init state is `selectedInspectionId === null` and `focusedField === null` (59–61). No effect reads those params, and inspection id is never written.
Transition A: focused correction → refresh → empty error list and editor.
Trigger B: `n` uses only `queueQuery.data.items` and `items[currentIdx + 1] ?? items[0]` (94–98). Missing id (`findIndex === -1`) or last row selects `items[0]` on this page. `gg` selects `items[0]` of the current page (101–104), not page 1.
Transition B: last row or page > 1 → first row of the same page, not the next unresolved inspection or the top of the queue.
Fix: persist `inspection_id` in the query string; hydrate selection and focus from the URL when the queue/validation data contains that id. For `n`, if the current id is last or absent, request the next page instead of wrapping; for `gg`, set `page=1` and select the first item of that result.
Regression: reload restores the same inspection and field; `n` on the last row of page 1 loads page 2 rather than row 0; `gg` on page 3 lands on page 1 row 0.
## Discarded
- The default React Query behavior does not prove that the validation `data` from inspection A is shown after selecting B. These files never check `data.inspection_id === selectedInspectionId`, but the mismatch is not established without `qaqc.js`.
- Unsaved editor loss on `selectInspection` is not established; `QaQcEditPanel` is outside the packet. The page does clear `focusedField` with no dirty check.
- Flag-id reuse across QA runs hiding new flags is not established; only client filtering is visible (`QAReviewPanel.tsx` 15–19).
- Dismiss/trigger `onSuccess` invalidates the mutated `inspectionId`, not a stale prop. That part is correct.
## Missing evidence
`client.js`, `qaqc.js`, `QaQcEditPanel`, `QaQcErrorList`, `QaQcQueueList`, and `FlagCard` are outside the packet. Whether revalidate or dismiss actually refreshes server state, and whether the editor saves, cannot be judged here. The defects above are client state-machine bugs visible without those files.
## Next action
Add regression tests for the six transitions above, then apply the four local guards: poll/exit for `pending`/`running`, separate `isError` and `failed`, single-flight `runRevalidate`, and URL hydration plus non-wrapping `n`/`gg`.
openai / gpt-6-luna / xhigh / xhigh effort answer
## Demonstrable issues
1. **QA review can remain stuck on “in progress” after an asynchronous run completes.**
`useQAReview` has no polling option (`qaReview.ts:39–47`). After a successful trigger, it invalidates the query (`qaReview.ts:57–59`), which causes a refresh, but `QAReviewPanel` renders `pending`/`running` as a terminal loading view with no retry control (`QAReviewPanel.tsx:66–75`). If that refresh reads `pending` or `running`, and the server completes the review while the page stays mounted, this code schedules no further refresh. The panel can keep showing the stale in-progress state.
**Smallest safe fix:** poll while the fetched status is `pending` or `running`, stopping once it is terminal.
**Regression:** trigger a review; return `running` from the first GET and `completed` from a later GET without remounting or changing focus; verify the panel updates.
**Caveat:** application-wide query defaults are outside the packet and could provide polling.
2. **Refreshing loses the page’s selected inspection and focused-error state, despite writing focus details to the URL.**
`QAQCPage` initializes `selectedInspectionId` and `focusedField` to `null` (`QAQCPage.tsx:59–61`). Opening an error writes focus-related parameters to the URL and sets local focus state (`:82–86`), but the page never reads those parameters to restore state. It also does not serialize the selected inspection ID in `applyFocusedParams` (`:36–48`). After refresh, the page therefore passes `inspectionId={null}` and `focused={null}` to its child panels (`:221–237`), even if the URL still contains `tab`, `obs`/`obs_idx`, and `focus`.
**Smallest safe fix:** persist the inspection ID with the focus parameters and hydrate selection/focus from them on page load.
**Regression:** select an inspection, open one of its errors, reload the same URL, and verify the inspection and focused field are restored. This is a navigation/state-restoration defect; the supplied code does **not** establish loss of saved edits.
## Limits of the evidence
No edit/save implementation or QA/QC API hooks are included, so I cannot establish data loss during save, save/revalidation ordering defects, or invalid status transitions. Those dependencies are explicitly outside the packet. The shown queue navigation and mutation invalidation do not by themselves demonstrate such defects.Primary judge's stated reason
Weak, forced preference for A: its concrete error-versus-empty-state finding helps prevent users being told no review exists when retrieval actually failed. B offers a cleaner, more restrained audit, making the overall tradeoff close rather than a proven material quality gap. An independent review could reasonably prioritize B's restraint.
This reason is the judge's assessment. No independent factual-defect finding is asserted by this record.
Battle wave: 73088e6c-242b-4408-960f-d09feaae160d. Pair: brp1_ad103ab0c946850db42758d684949f31afdcc12528589bb2ca2a495e3ecb32a1. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.