openai / gpt-6.1-sol / high / high 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
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.
openai / gpt-6.1-sol / high / high effort answer
Independent, read-only assessment of the supplied snapshot.
## Findings
### 1. Nonterminal QA reviews have no completion-refresh mechanism
**Evidence:** `[REDACTED: private project name]/frontend/src/api/qaReview.ts:39–47,57–59`; `[REDACTED: private project name]/frontend/src/components/qa-review/QAReviewPanel.tsx:66–75`.
- **Trigger → transition:** Triggering a review invalidates its query once. If that refetch returns `pending` or `running`, the panel displays “in progress,” but neither the hook nor panel schedules another fetch when the server completes.
- **Impact:** The panel can remain on an obsolete in-progress state until an unrelated refetch occurs.
- **Smallest safe fix:** Poll only while the fetched status is `pending` or `running`; stop on `completed` or `failed`.
- **Regression:** Return `pending`, then `running`, then `completed`; verify automatic progression and polling termination. Repeat with `failed`.
- **Confidence:** High for the missing local mechanism. An externally configured polling/invalidation mechanism could compensate; none is supplied.
### 2. Review mutations leave summary queries uninformed
**Evidence:** `[REDACTED: private project name]/frontend/src/api/qaReview.ts:57–59,83–91`.
- **Trigger → transition:** A mounted `['qa-summary', submissionId]` query contains an earlier aggregate. A successful review run changes review coverage or scores, but the mutation invalidates only `['qa-review', inspectionId]`.
- **Impact:** Inspection detail refreshes while its submission summary can retain old counts, scores, and bands.
- **Smallest safe fix:** Also invalidate affected summary queries. Without an inspection-to-submission mapping, invalidating the `['qa-summary']` prefix is the smallest safe change. For asynchronous runs, refresh summaries when completion is observed as well.
- **Regression:** Cache a summary, successfully complete a review with changed aggregate values, and verify that the mounted summary refetches.
- **Confidence:** High for the invalidation omission; observable staleness requires the run to change the aggregate and no external refresh to intervene. Dismissal effects on summary scoring are not established.
### 3. Keyboard revalidation permits repeated submissions while pending
**Evidence:** `[REDACTED: private project name]/frontend/src/pages/QAQCPage.tsx:106–109,164–166,229–230`.
- **Trigger → transition:** Select an inspection, press `r`, then press it again while revalidation remains pending. Every press invokes `revalidate.mutate` with a fresh UUID; `runRevalidate` checks only whether an inspection is selected.
- **Impact:** The parent submits overlapping revalidation commands instead of treating pending revalidation as a guarded transition. Fresh idempotency keys do not identify these submissions as retries of one operation.
- **Smallest safe fix:** Return immediately when revalidation is pending. If immediate repeated events must be excluded before a render, use a synchronous in-flight ref released on settlement.
- **Regression:** Dispatch repeated `r` events while the mutation is unresolved; assert one invocation. After settlement, assert another invocation is allowed.
- **Confidence:** High for repeated mutation invocation. Request serialization and any resulting backend corruption cannot be determined without `../api/qaqc`.
### 4. Dismissing findings produces an unsupported “passed QA” conclusion
**Evidence:** `[REDACTED: private project name]/frontend/src/components/qa-review/QAReviewPanel.tsx:15–19,83,142–145`.
- **Trigger → transition:** A completed review contains findings, and all their IDs appear in `dismissed_flags`. Filtering makes `activeFlags.length` zero, so the panel displays “No issues found. This inspection passed QA.”
- **Impact:** The UI conflates **findings dismissed** with **no findings generated**. It can simultaneously display a RED health badge and the pass message; dismissal does not change the supplied review’s score or band.
- **Smallest safe fix:** Distinguish “No issues found” from “All findings dismissed.” Do not derive a QA-pass decision solely from the active-flag count.
- **Regression:** Render a completed RED review with every finding dismissed; assert the pass/no-findings message is absent. Preserve appropriate empty-state messaging for a genuinely empty review.
- **Confidence:** High for the incorrect no-findings statement. Whether dismissal is permitted to confer formal approval requires policy evidence not supplied.
## Boundaries and discarded hypotheses
- **No edit/save data-loss defect is established.** `QaQcEditPanel` and its save implementation are outside the packet. Clearing `focusedField` on selection (`QAQCPage.tsx:75–79`) alone does not prove draft destruction.
- `nextUnresolvedInspection` traverses the current queue and wraps (`94–99`), while filter/page changes retain selection (`205–216`). These behaviors deserve targeted tests, but the supplied evidence does not establish whether wrapping or retaining an off-queue selection violates the intended navigation contract.
- Refresh-related error-index changes alone do not prove incorrect editor targeting: highlighting an error and explicitly opening it are separate actions in this page.
**Next useful action:** Add the targeted regressions above, then audit the editor/save and QA/QC hooks for dirty-draft ownership, request ordering, and refresh reconciliation.
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`.
Primary judge's stated reason
B is preferable for an evidence-only audit: it reduces the risk of implementing unestablished navigation requirements and provides a grounded dismissed-findings messaging correction. A's useful fetch-error finding prevents treating B as exhaustive, but the comparative advantage in defect qualification is substantive rather than merely a forced slight preference.
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_f8ccdd432c6683e164be8eb2932472a3356cc3598f7c0655232f212afec92377. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.