ALL-1873 PR-4: DRC UI — Run Data Audit button + source-type label
queued## ALL-1873 PR-4: DRC UI entrypoint
**Linear issue:** ALL-1873 — Feature: Data audit entrypoint for Data Review Center
**Branch:** wilbo/all-1873-drc-ui-entrypoint
**Depends on:** PR-3 (triggerDataAudit mutation must exist in the schema for the frontend to call)
### What to do
#### 1. Add useTriggerDataAudit hook in apps/dashboard/lib/staging/client.ts (or hooks/useDataReview.ts)
Look at how existing mutations are wired (e.g. useReviewActions in hooks/useDataReview.ts or lib/staging/client.ts). Add a hook:
function useTriggerDataAudit(): { trigger: () => Promise<void>; loading: boolean }
Internally calls the triggerDataAudit GraphQL mutation with the current workspace ID from useWorkspace().
#### 2. Add the "Run Data Audit" button to DataReviewPage.tsx
File: apps/dashboard/components/pages/DataReviewPage.tsx
- Add the button near the page header / batch selector controls (study the layout of the existing SourceTypeFilter + BatchSelector controls around lines 100-200).
- On click: call trigger() from useTriggerDataAudit(). Show a loading spinner while in flight.
- On success: show a useNotice toast (useNotice is already imported from @texturehq/edges): "Data audit started — results will appear in the queue when ready"
- On error: show a useNotice error toast with the error message.
- The button copy: "Run Data Audit"
#### 3. Regenerate GraphQL types
After the backend schema change lands (PR-3), regenerate the @generated types:
cd apps/dashboard && pnpm run codegen
or the equivalent command in the dashboard package. Commit the regenerated files.
#### 4. Add DATA_AUDIT to the frontend source type filter (if not already done in PR-1)
If PR-1 already added DATA_AUDIT to SOURCE_TYPE_OPTIONS in DataReviewPage.tsx, verify it's present. If not, add it:
{ value: "DATA_AUDIT", label: "Data audit" }
#### 5. Light test coverage
Add a test to DataReviewPage.test.tsx (or a new DataReviewPage.audit.test.tsx) that:
- Renders the "Run Data Audit" button
- Mocks useTriggerDataAudit
- Asserts clicking the button calls trigger()
- Asserts the success notice fires
### Acceptance test
- "Run Data Audit" button renders on the DRC page
- Clicking it fires the triggerDataAudit mutation
- Success state shows a toast
- Error state shows an error toast
- TypeScript compiles, all tests pass
- CI green
### Key files
- apps/dashboard/components/pages/DataReviewPage.tsx — main page
- apps/dashboard/components/pages/DataReviewPage/ — sub-components
- apps/dashboard/hooks/useDataReview.ts — existing review hooks (pattern match here)
- apps/dashboard/lib/staging/client.ts — existing staging client (may also be a good place for the hook)
- apps/dashboard/lib/@generated/ — generated GraphQL types (regenerate after PR-3 merges)
### Gotchas
- This PR should NOT merge until PR-3 is merged and the triggerDataAudit mutation is deployed to the backend. Use a feature flag if you need to ship the UI before the backend is ready.
- useWorkspace() from @/providers/WorkspaceProvider provides currentWorkspace.id — use that as workspaceId.
- The DATA_AUDIT source type label in SOURCE_TYPE_OPTIONS (PR-1) ensures audit batches show up correctly in the batch filter dropdown after the audit runs.
### Out of scope
- Any custom resolution UI for audit-specific anomaly types (Phase 3)
- Scheduled audit controls (Phase 2)
- Audit history / audit-specific tab (Phase 2)
Event Timeline
created