← Model losses

Head-to-head comparison

openai / gpt-6.1-sol / low / low effort preferred over cursor / composer-2.5 / Composer 2.5 default / unknown 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

MVP source audit; taskCategory=ux; module category=ux, difficulty=high, expectedTests=none. Dashboard layout, widget/query state and API/schema contracts, including their focused tests. Source review only; no tests run. Use only exact supplied files and cite file plus original line. Do not run tests, use shell/globs/root traversal, live services, databases, customer data, or edit source. Report concrete source-proven issues with impact and confidence, otherwise state no findings. Identify every excluded boundary explicitly; do not infer production readiness. This source-only audit packet is bound to verified merged main commit 9dab4e99d3bfadf995dbaa031b9b6a365970e1e3; it does not verify runtime or production behavior.

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

## Conclusion

Direct, independent review of all 32 supplied files found **seven source-proven issues**. No tools, tests, runtime checks, or edits were performed.

### Findings

1. **High — Switching dashboard URLs can retain the previous dashboard’s widgets.**  
   `[REDACTED: private project name]/frontend/src/pages/DashboardPage.tsx:145–155` resolves widgets using `urlConfigId`, but its memo dependency list at **line 191** omits that ID. Navigating between named dashboards without changing preferences/config caches updates the header and active filter context (**lines 119–136**) while retaining the previous widget layout.  
   **Impact:** Dashboard name, filters, sharing target, and displayed metrics can disagree.  
   **Recommendation:** Include `urlConfigId` in the memo dependencies.  
   **Confidence:** 0.99.

2. **High — Dashboard filter connectors are lost or applied to the wrong group.**  
   `[REDACTED: private project name]/frontend/src/store/useDashboardFilterStore.ts:99–103` supports an OR connector, but **lines 141–149** return only flattened conditions. `[REDACTED: private project name]/frontend/src/components/dashboard/WidgetCard.tsx:44–57` merges those conditions with local/cross-filters using the *base query’s* connector instead.  
   **Impact:** Global `A OR B` becomes `A AND B` on a normal query; an OR base query instead makes cross/local constraints optional alternatives, potentially widening results.  
   **Recommendation:** Preserve filter-group semantics; do not flatten differently connected groups into one condition array.  
   **Confidence:** 0.99.

3. **High — Relation-query construction ignores OR between root conditions.**  
   `[REDACTED: private project name]/frontend/src/lib/semanticQueryBuilder.ts:351–354` accepts a root connector, but **lines 376–385** put every root condition and the relation into a single AND group. The ordinary builder correctly honors OR at **lines 220–224**.  
   **Impact:** `(A OR B) AND relation` becomes `A AND B AND relation`, excluding valid matches.  
   **Recommendation:** Group root conditions using their connector, then AND that group with the relation.  
   **Confidence:** 0.99.

4. **Medium — “Reset to default” does not recover several invalid-layout cases.**  
   `[REDACTED: private project name]/frontend/src/pages/DashboardPage.tsx:427–432` only clears `default_dashboard_id`. A URL-addressed corrupt dashboard still wins resolution (**lines 145–152**), and a corrupt persona clone still wins over the valid persona pack (**lines 173–185**).  
   **Impact:** The advertised recovery action can leave the same error displayed indefinitely.  
   **Recommendation:** Handle URL and persona-clone recovery explicitly, rather than only clearing the preference.  
   **Confidence:** 0.99.

5. **Medium — Forecast and risk widgets receive incompatible query-result shapes.**  
   `[REDACTED: private project name]/frontend/src/components/dashboard/WidgetCard.tsx:248–365` has no transform cases for `forecast_summary` or `risk_heatmap`; both receive `{ rows }` through **lines 363–364**. Their renderers read top-level `at_risk_5y`/`critical_5y` and `distribution` in `[REDACTED: private project name]/frontend/src/components/dashboard/WidgetRenderer.tsx:233–251`. Both types are explicitly allowed at **lines 35–37**.  
   **Impact:** Query-backed forecast widgets show placeholders, and risk heatmaps show zero counts despite returned rows.  
   **Recommendation:** Establish and implement matching transform/renderer contracts.  
   **Confidence:** 0.98.

6. **Medium — Aging-bucket, exception-feed, and action-queue click payloads cannot supply the selected filter value.**  
   `[REDACTED: private project name]/frontend/src/components/dashboard/WidgetCard.tsx:117–124` requires `payload[dimension]` or `payload.name`. Its transforms instead produce `range` (**lines 322–330**) or `title`/`status` (**lines 304–313, 332–340**), discarding the original dimension key. `[REDACTED: private project name]/frontend/src/components/dashboard/WidgetRenderer.tsx:90–99` forwards those items/buckets to the click handler.  
   **Impact:** Filter/drill-through actions return early when callbacks forward these transformed records.  
   **Recommendation:** Preserve a canonical dimension value in transformed click payloads.  
   **Confidence:** 0.94; exact interaction emission remains outside the packet.

7. **Medium — Layout validation accepts positions incompatible with the layout consumers.**  
   `[REDACTED: private project name]/frontend/src/lib/parseLayout.ts:22–27` accepts any finite numeric position, including zero/negative dimensions and fractional coordinates. `[REDACTED: private project name]/frontend/src/pages/DashboardPage.tsx:551–569` inserts these directly into CSS grid spans/lines. Builder limits establish positive widget sizes in `[REDACTED: private project name]/frontend/src/components/dashboard/BuilderCanvas.tsx:20–23, 48–51`.  
   **Impact:** Malformed saved layouts can pass validation yet produce invalid or unintended placement instead of the explicit layout-error surface.  
   **Recommendation:** Validate integral coordinates, positive dimensions, and supported grid bounds.  
   **Confidence:** 0.97.

### Focused-test evidence

`[REDACTED: private project name]/frontend/src/__tests__/DashboardLayout.test.tsx:19–45` checks parsing only; the UI/default round-trip cases are TODOs at **lines 50–62**.  
`[REDACTED: private project name]/frontend/src/lib/semanticQueryBuilder.test.ts:264–328` checks nested relation construction but does not exercise OR root composition. These are coverage observations, not test results.

### Alternatives and discarded hypotheses

- No backend authorization, tenant-isolation, or schema-enforcement defect is asserted: backend evidence is excluded.
- Cache-detail invalidation concerns cannot be conclusively resolved without the excluded query-key registry.
- No production failure frequency or browser-specific rendering outcome is inferred.
- Click-payload finding is limited to the supplied transformation/forwarding contract; excluded widget implementations could alter emitted payloads.

### Explicit excluded boundaries

All source outside the declared packet is excluded, including:

- **Auth/session/reset dependencies:** `hooks/useUppy.js`, `lib/crossTabReset.js`, `store/useToastStore.js`, `api/csrf.js`, `api/mediaTokens.js`, `api/queryKeys.js`, `api/uploadConfig.js`, `api/auth.js`, `hooks/useLogout.js`, `lib/resetRegistry.js`, `store/orgScopedResets.js`, `types/auth.js`.
- **Onboarding API dependencies:** `api/consultant.js`, `api/inspections.js`, `api/media.js`.
- **Interaction/coaching dependencies:** `hooks/useDrillThrough.js`, `components/dashboard/UnknownDataCoachingBanner.js`.
- **Excluded widget implementations:** `components/dashboard/widgets/ActionQueueWidget.js`, `AgingBucketsWidget.js`, `DataHealthWidget.js`, `ExceptionFeedWidget.js`, `MapWidget.js`, `NarrativeTextWidget.js`, `StackedAreaWidget.js`, `StackedBarWidget.js`, `TimelineWidget.js`.
- **Parser dependency:** `lib/nlParser.js`.

These dependency paths are relative to `[REDACTED: private project name]/frontend/src/`. Also excluded: dashboard-builder page/catalog/editor source, backend routes/schemas/SQL, dependency versions and library internals, application routing/bootstrap, styling outside supplied files, all other tests, live services, databases, customer data, browser/accessibility execution, and deployment behavior.

**Next useful action:** Correct the URL memo dependency and connector composition first, then add narrowly targeted regression checks under separately authorized implementation work.

This assessment is bound to supplied commit `9dab4e99d3bfadf995dbaa031b9b6a365970e1e3` and packet digest `8eeba499cd2025a06ff6502c2a374ac1e3c297292422678220e03a780752cb0d`; it does **not** establish runtime behavior or production readiness.

cursor / composer-2.5 / Composer 2.5 default / unknown effort answer

# Dashboard MVP UX — source-only audit

**Commit bound:** `9dab4e99d3bfadf995dbaa031b9b6a365970e1e3`  
**Lens:** layout, widget/query state, API/schema contracts, in-scope tests  
**Method:** supplied files only; no runtime, tests, or out-of-packet source.

---

## 1. Conclusion (high-confidence issues)

### F1 — URL dashboard resolution can stay stale after route change  
**Severity:** High (wrong layout/widgets on `/dashboards/:id`)  
**Confidence:** 0.92  

`resolvedDashboard` reads `urlConfigId` but the `useMemo` dependency list omits it, so switching between URL-addressed dashboards (or from default to URL) can reuse a prior resolution until `prefs` / `configs` / `personas` change.

```140:191:[REDACTED: private project name]/frontend/src/pages/DashboardPage.tsx
  const resolvedDashboard = useMemo((): {
    widgets: (WidgetConfig & { query?: DashboardQuery })[]
    layoutError: 'invalid_json' | 'not_array' | 'invalid_widget' | null
  } => {
    // 0. URL explicitly names a dashboard (e.g. /dashboards/49) — always wins.
    if (urlConfigId != null && configs) {
      ...
    }
    ...
  }, [prefs, configs, personas])
```

**Impact:** Wrong widgets, missing layout error UI, or stale empty state after navigation via the switcher (`navigate(\`/dashboards/${cfg.id}\`)` at 309–310).

---

### F2 — Dashboard global filter `connector` (AND/OR) is never applied to widget queries  
**Severity:** Medium–High (incorrect query semantics when OR is ever set)  
**Confidence:** 0.88  

The store persists `FilterGroup.connector` (`useDashboardFilterStore.ts` 18–21, 99–103), but `WidgetCard` only merges `filters.conditions` and keeps the widget/base connector, never `filters.connector` from the store.

```40:58:[REDACTED: private project name]/frontend/src/components/dashboard/WidgetCard.tsx
  const effectiveQuery = useMemo<DashboardQuery | null>(() => {
    ...
    const effectiveConditions = getEffectiveFilters(widget.id)
    ...
    return {
      ...baseQuery,
      filters: {
        connector: baseQuery.filters?.connector ?? 'AND',
        conditions: [...existingConditions, ...allConditions],
      },
    }
  }, [widget.query, widget.id, widget.config, getEffectiveFilters, globalFilters, crossFilters])
```

```141:149:[REDACTED: private project name]/frontend/src/store/useDashboardFilterStore.ts
  getEffectiveFilters: (excludeWidgetId) => {
    const { filters, crossFilters } = get()
    const effective = [...filters.conditions]
    ...
    return effective
  },
```

**Impact:** Any UI that sets OR on the dashboard filter group still sends AND semantics to `POST /dashboard-data/query` unless the widget’s own `query.filters.connector` overrides.

---

### F3 — Server `filter_config` on dashboard config is not wired to filter state  
**Severity:** Medium (saved server filters vs local-only behavior)  
**Confidence:** 0.85  

API type includes `filter_config`; switching dashboards only loads `localStorage` keyed by id, with no use of `activeConfig.filter_config` in `DashboardPage` or `setDashboardId`.

```16:28:[REDACTED: private project name]/frontend/src/api/dashboards.ts
export interface DashboardConfigResponse {
  ...
  filter_config: FilterConfigPayload | null
  ...
}
```

```74:76:[REDACTED: private project name]/frontend/src/store/useDashboardFilterStore.ts
  setDashboardId: (id) => {
    const filters = loadPersistedFilters(id)
    set({ dashboardId: id, filters, crossFilters: new Map() })
  },
```

```132:136:[REDACTED: private project name]/frontend/src/pages/DashboardPage.tsx
  useEffect(() => {
    setDashboardId(activeConfig?.id ?? null)
  }, [activeConfig?.id, setDashboardId])
```

**Impact:** Org/translated filters from the backend (`FilterConfigPayload`) never hydrate the bar or widget queries; users only see `[REDACTED: private project name]-dashboard-filters-${id}` local state. `UserPreferencesResponse.dashboard_filter_presets` (userPreferences.ts 228) is likewise unused in this packet.

---

### F4 — Duplicate widget titles in the live dashboard path  
**Severity:** Medium (visual/clutter, especially print)  
**Confidence:** 0.95  

`WidgetCard` renders a title row; `WidgetRenderer` always renders another title inside the same card.

```168:179:[REDACTED: private project name]/frontend/src/components/dashboard/WidgetCard.tsx
      <div ...>
        <span>{widget.title}</span>
```

```107:122:[REDACTED: private project name]/frontend/src/components/dashboard/WidgetRenderer.tsx
  return (
    <div ...>
      <div style={{ fontSize: 13, fontWeight: 600, ... marginBottom: 8 }}>
        {widget.title}
      </div>
```

**Impact:** Double headings on every widget; builder preview (`BuilderCanvas` 138–142 + 163) adds a third chrome layer with its own header.

---

### F5 — Documented “show PersonaSelector on no preference” vs implementation  
**Severity:** Medium (first-run UX)  
**Confidence:** 0.80  

File-level comment promises a modal when there is no preference; empty state does not open `showPersonaSelector`, and a separate effect auto-assigns `persona: 'engineer'` for non-consultants.

```4:8:[REDACTED: private project name]/frontend/src/pages/DashboardPage.tsx
 * Resolution logic:
 * ...
 * 3. No preference → show PersonaSelector modal (muni/contractor orgs only)
```

```450:456:[REDACTED: private project name]/frontend/src/pages/DashboardPage.tsx
          <DashboardEmptyState
            title="No dashboard configured"
            description="Select a persona to get started with a dashboard tailored to your role."
```

`showPersonaSelector` is only toggled from the persona settings control when `prefs?.persona` already exists (358–377), not from the empty state. Auto-migration (198–227) can bypass manual persona choice.

**Impact:** New users may see a static empty state or silent default to engineer without the modal described in the module comment.

---

### F6 — Layout/test contract gap: `invalid_widget` and builder checkbox behavior untested  
**Severity:** Medium (regression risk on corrupt layouts / default flag)  
**Confidence:** 0.90  

`parseLayout` can return `invalid_widget` (parseLayout.ts 21–26); `DashboardPage` surfaces it (422–424). Tests cover only `invalid_json` and `not_array`; builder `is_default` cases are `it.todo`.

```21:26:[REDACTED: private project name]/frontend/src/lib/parseLayout.ts
    if (!parsed.every((widget: unknown) => {
      ...
    })) return { ok: false, error: 'invalid_widget' }
```

```50:62:[REDACTED: private project name]/frontend/src/__tests__/DashboardLayout.test.tsx
describe('DashboardBuilderPage — set-as-default checkbox', () => {
  it.todo('shows corrupt-layout error banner when urlConfig has invalid JSON')
  ...
  it.todo('loads is_default=true from urlConfig and renders checkbox as checked')
```

**Impact:** Plan 5 cases 3–4 and DOM-level corrupt-layout banners have no pinned behavior in this packet.

---

### F7 — Unknown-data coaching banner latched across refetches/filter changes  
**Severity:** Low–Medium (misleading coaching after cross-filter)  
**Confidence:** 0.75  

Banner state is fixed after first data load per `widget.id`; it does not reset when `effectiveQuery` or filter store changes (only `widget.id` resets the latch).

```71:85:[REDACTED: private project name]/frontend/src/components/dashboard/WidgetCard.tsx
  // Reset latch when widget changes identity
  const prevWidgetId = useRef<string>(widget.id)
  if (prevWidgetId.current !== widget.id) {
    ...
    bannerLatch.current = BANNER_UNSET
  }
```

```88:110:[REDACTED: private project name]/frontend/src/components/dashboard/WidgetCard.tsx
  if (bannerLatch.current === BANNER_UNSET && widgetData !== undefined) {
    ...
    bannerLatch.current = ...
  }
```

**Impact:** After cross-filtering away “Unknown” dominance, banner can remain; conversely a first load without banner won’t appear after filters widen unknown share.

---

### F8 — Share dialog: active option is not actionable (only the inactive side toggles)  
**Severity:** Low (UX confusion)  
**Confidence:** 0.85  

Personal row calls `handleToggle` only when already published; published row calls toggle only when not published. Selected state uses `cursor: 'default'`.

```69:77:[REDACTED: private project name]/frontend/src/components/dashboard/ShareDialog.tsx
          <button
            onClick={() => { if (isPublished) handleToggle() }}
            ...
              cursor: isPublished ? 'pointer' : 'default',
```

```86:94:[REDACTED: private project name]/frontend/src/components/dashboard/ShareDialog.tsx
          <button
            onClick={() => { if (!isPublished) handleToggle() }}
            ...
              cursor: !isPublished ? 'pointer' : 'default',
```

**Impact:** Users may think the highlighted option is disabled; they must click the non-selected row to change visibility.

---

### F9 — Onboarding banner: client-side `.filter` on consultant client list  
**Severity:** Low for UX audit; Medium for architecture alignment  
**Confidence:** 0.70 (`needs_verification` for product intent)  

```63:64:[REDACTED: private project name]/frontend/src/components/dashboard/OnboardingBanner.tsx
    const realClientCount = (consultantClients ?? []).filter((c) => !c.is_sandbox).length
```

Contrasts with `DATA_OWNERSHIP.md` rule that list-like domain views should not use client `.filter()` on server-owned arrays (lines 17–19, 54). May be acceptable as UI grouping; not provable as bug without backend contract for `is_sandbox`.

---

### F10 — Split `WidgetConfig` shapes (dashboards API vs renderer)  
**Severity:** Low (contract drift)  
**Confidence:** 0.82  

`dashboards.ts` includes optional `query`; `WidgetRenderer`’s exported `WidgetConfig` omits `query` (types 25–32 vs 40–55 in dashboards.ts). `parseLayout` casts parsed JSON to `dashboards` `WidgetConfig` without validating `query` or widget `type` against `WIDGET_TYPE_ALLOWLIST`.

**Impact:** Invalid types render placeholder in renderer; missing `query` yields null `effectiveQuery` and loading/disabled data path without layout parse error.

---

## 2. Alternatives / likely false positives

- **Consultant bounce** (`DashboardPage` 107–110): Brief flash of dashboard chrome before `navigate('/consultant')` is possible; severity depends on router timing (not provable here).
- **`JSON.stringify(query)` cache key** (`dashboardData.ts` 55–57): Key instability from key order is a performance concern, not a functional bug in this packet.
- **`useUpdateDashboard` invalidates only list key** (`dashboards.ts` 107–109): Stale detail cache is plausible but `queryKeys.dashboardConfigs.detail` is **outside** the packet — cannot confirm.
- **DATA_OWNERSHIP vs `transformQueryResult`**: Chart shaping in `WidgetCard` (221–365) is presentation of aggregate query rows, not Explorer domain arrays; flagging as full SoT violation would overstate vs dashboard API design.

---

## 3. Excluded boundaries and missing evidence

**Explicitly out of packet (per scope JSON + missing-deps list):**  
`queryKeys.js/ts`, `csrf.js`, `mediaTokens.js`, `useDrillThrough.js`, `UnknownDataCoachingBanner.js`, all unstated widget modules (`MapWidget`, `DataHealthWidget`, etc.), `nlParser.js`, dashboard **builder page** (only `BuilderCanvas.tsx` in scope), backend `/dashboards` and `/dashboard-data` handlers, `resetRegistry` / org-switch interaction with dashboard filters.

**Not inferred:** production readiness, CI arch-check allowlist, runtime TanStack Query behavior, whether `queryKeys.dashboardData.all` prefix matches all widget queries (`DashboardHeader` 47–48).

**Consequence:** Cannot verify manual refresh coverage, drill-through URLs, or server acceptance of merged filter DTOs.

---

## 4. Next useful action

1. Fix **F1** by adding `urlConfigId` (and likely `configs` stability) to `resolvedDashboard` deps.  
2. Wire **F2**: pass `filters.connector` from `useDashboardFilterStore` into `DashboardQuery.filters.connector` when merging global conditions.  
3. Hydrate **F3**: on `setDashboardId`, call `resetToDefaults` from `activeConfig.filter_config` when present (and define precedence vs localStorage).  
4. Remove duplicate title in **F4** (renderer title only in builder preview, or `WidgetCard`-only on dashboard).  
5. Align first-run UX (**F5**) with either auto-engineer migration or PersonaSelector + tests in `DashboardLayout.test.tsx` (**F6**).

---

**Overall:** Multiple source-proven UX/state contract issues; the highest-impact fix in-packet is **F1** (stale URL dashboard resolution). No claim that the dashboard is production-ready or that backend contracts match frontend types beyond what is typed in the supplied API modules.

Primary judge's stated reason

B is clearly preferable for directing corrective work toward demonstrated query and recovery contract defects while avoiding A's unsupported characterization of normal visibility selection as a defect. This is a supported substantive advantage, not a forced slight preference, though neither answer establishes runtime failures.

This reason is the judge's assessment. No independent factual-defect finding is asserted by this record.

Battle wave: a74ee767-4b32-4c9f-aba3-8297b9f8fec4. Pair: brp1_c11fbcdc5346b402c2ea6f40ac5b7959c4ebf9e055e05642a139984b8de94edd. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.