Skip to content

[DQ-06] Add data quality center - #2402

Merged
Asherlc merged 5 commits into
mainfrom
codex/issue-2079
Aug 2, 2026
Merged

Asherlc merged 5 commits into
mainfrom
codex/issue-2079

Conversation

@Asherlc

@Asherlc Asherlc commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add a server-owned processing.dataQuality overview combining existing coverage, source-overlap, processing freshness, anomaly, and journal signals.
  • Add cross-platform Data Quality centers with direct navigation on web and iOS.
  • Add inline source-overlap indicators to activity and nutrition surfaces.

Validation

  • pnpm test — 1,029 files passed; 15,735 tests passed; 21 skipped.
  • pnpm typecheck — passed.
  • pnpm --dir packages/server exec tsc --noEmit — passed.
  • pnpm --dir packages/web typecheck — passed.
  • pnpm --dir packages/mobile typecheck — passed.
  • Sandbox lint and policy checks — passed.
  • Analytics SQL lint requires local ClickHouse; the workspace service could not start because Docker reported exhausted predefined network pools.

Closes #2079
Fixes #2079

Summary by Sourcery

Introduce a server-composed data quality overview and surface it across web and mobile for users to review data reliability over the last 30 days.

New Features:

  • Add a processingRouter dataQuality endpoint that aggregates coverage, source overlap, sync freshness, anomalies, and manual edits into a single server-owned overview.
  • Add Data Quality center screens/components on web and mobile, with navigation entries from headers and More menus and per-check review actions.
  • Add inline source-overlap indicators on activity and nutrition views to highlight records needing attention.

Enhancements:

  • Ensure provider registration before serving data quality, reusing existing processing and analytics repositories.
  • Standardize data quality messaging and status labels (healthy, attention, informational) across platforms, with accessibility-friendly loading and empty states.

Tests:

  • Add unit tests for the server data-quality repository composition and the new processingRouter dataQuality endpoint.
  • Add web and mobile tests verifying Data Quality center rendering, navigation links, and source overlap pills in activity and nutrition surfaces.
  • Add Storybook stories for web and mobile Data Quality center components to document and exercise common states.

Summary by cubic

Adds a cross-platform Data Quality Center that rolls up coverage, source overlap (including activities), sync freshness, outliers, and manual edits into a server-owned overview with new web and iOS screens and a /data-quality route. Delivers #2079 so users can trust data before interpreting metrics.

  • New Features

    • Server: DataQualityRepository composes signals and exposes cached processing.dataQuality with runtime validation; ensures providers are registered; tests for composition and router output.
    • Web: Data Quality page and DataQualityCenter with loading/empty states and per-check review links; header and More page link to /data-quality; activity cards show a “Source overlap” pill; nutrition panel adds “Source overlap to review”; stories and tests.
    • Mobile (iOS): /data-quality screen and DataQualityCenter with loading/empty states and per-check review actions; More menu link; activities show a “Source overlap” pill; nutrition panel adds “Source overlap to review”; stories and tests.
  • Bug Fixes

    • Shared: @dofek/format/data-quality unifies status labels, review destinations, and stable detail keys across web and iOS; adds activity_source_overlap routed to Activities; tests added.
    • Server: Overview window honors entitlement limits; counts activity overlaps across full history and filters to the quality window.
    • Web: Patched @tanstack/router-generator to fix route type generation in routeTree.gen.ts.

Written for commit 4605d6d. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added a Data Quality dashboard to web and mobile.
    • Highlights coverage gaps, source overlaps, sync freshness, unusual observations, and manual edits.
    • Provides status details, reporting windows, loading/empty states, retry actions, and review links.
    • Added access through the More menu and shared navigation.
    • Added “Source overlap” indicators to activity and nutrition views.
  • Tests

    • Added coverage for dashboard states, review navigation, data-quality results, and source-overlap indicators.

Copilot AI review requested due to automatic review settings August 2, 2026 10:41
@Asherlc Asherlc linked an issue Aug 2, 2026 that may be closed by this pull request
@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @Asherlc, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a server data-quality overview for five check types, exposes it through tRPC, and adds web and mobile review centers. Adds navigation routes, inline source-overlap indicators, tests, and Storybook states.

Changes

Data quality feature

Layer / File(s) Summary
Data-quality contracts and overview aggregation
packages/format/src/data-quality.ts, packages/server/src/repositories/data-quality-repository.ts, related tests
Defines data-quality types and aggregates nutrition, activity, processing, anomaly, and journal signals into five checks.
Protected data-quality API
packages/server/src/routers/processing.ts, packages/server/src/routers/processing.test.ts
Adds the validated, cached dataQuality query and returns the structured overview.
Cross-platform data-quality centers
packages/web/src/components/DataQualityCenter.tsx, packages/mobile/components/DataQualityCenter.tsx, related tests and stories
Renders overview status, check cards, details, loading states, empty states, and review actions.
Web and mobile data-quality routes
packages/web/src/pages/DataQualityPage.tsx, packages/web/src/routes/data-quality.tsx, packages/web/src/routeTree.gen.ts, packages/mobile/app/data-quality.tsx, navigation files
Adds web and mobile screens, query handling, retry behavior, navigation entries, and review routing.
Inline source-overlap indicators
packages/web/src/components/ActivityCardContent.tsx, packages/mobile/app/(tabs)/activities.tsx, nutrition panels and tests
Shows source-overlap badges when overlap data is present.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant DataQualityPage
  participant DataQualityScreen
  participant processingRouter
  participant DataQualityRepository
  participant DataQualityCenter
  User->>DataQualityPage: open web data-quality route
  User->>DataQualityScreen: open mobile data-quality screen
  DataQualityPage->>processingRouter: query dataQuality
  DataQualityScreen->>processingRouter: query dataQuality
  processingRouter->>DataQualityRepository: request overview
  DataQualityRepository-->>processingRouter: return DataQualityOverview
  processingRouter-->>DataQualityPage: return validated overview
  processingRouter-->>DataQualityScreen: return validated overview
  DataQualityPage->>DataQualityCenter: render checks and review links
  DataQualityScreen->>DataQualityCenter: render checks and review actions
Loading

Assessment against linked issues

Objective Addressed Explanation
Add a cross-product Data Quality center and inline badges for missing days, source overlap, stale sync, outliers, and manual edits [#2079]

Possibly related PRs

Suggested labels: area/server, area/web, area/mobile, type/feature

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses imperative mood, clearly describes the data-quality center change, stays under 70 characters, and has no trailing punctuation.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Implements a server-owned data quality overview endpoint and wires it into new cross-platform Data Quality centers on web and mobile, plus inline source-overlap indicators on activity and nutrition surfaces, with tests and stories for the new behavior.

Sequence diagram for processingRouter.dataQuality end-to-end flow

sequenceDiagram
  actor User
  participant WebApp as Web_or_Mobile_UI
  participant TRPC as trpc.processing.dataQuality
  participant Router as processingRouter.dataQuality
  participant Sync as ensureProvidersRegistered
  participant DQRepo as DataQualityRepository
  participant ProcRepo as ProcessingRepository
  participant NutRepo as NutritionAnalyticsRepository
  participant ActRepo as ActivitiesCalendarRepository
  participant AnomRepo as AnomalyDetectionRepository
  participant JournalRepo as JournalRepository

  User->>WebApp: Navigate to data quality
  WebApp->>TRPC: useQuery({ endDate })
  TRPC->>Router: dataQuality({ endDate })
  Router->>Sync: ensureProvidersRegistered()
  Sync-->>Router: undefined
  Router->>DQRepo: overview(endDate)
  par Processing status
    DQRepo->>ProcRepo: status({})
    ProcRepo-->>DQRepo: processing status
  and Nutrition quality
    DQRepo->>NutRepo: getMicronutrientDataQuality(DATA_QUALITY_WINDOW_DAYS)
    NutRepo-->>DQRepo: nutrition quality
  and Activity overlap
    DQRepo->>ActRepo: getWeekList({ weeks: 1, endDate, includeProviderAbsent: true })
    ActRepo-->>DQRepo: activityDays
  and Anomalies
    DQRepo->>AnomRepo: getHistory(DATA_QUALITY_WINDOW_DAYS, endDate)
    AnomRepo-->>DQRepo: anomalies
  and Journal entries
    DQRepo->>JournalRepo: listEntries(DATA_QUALITY_WINDOW_DAYS)
    JournalRepo-->>DQRepo: journalEntries
  end
  DQRepo-->>Router: DataQualityOverview
  Router-->>TRPC: DataQualityOverview
  TRPC-->>WebApp: DataQualityOverview
  WebApp-->>User: Render DataQualityCenter with checks
Loading

File-Level Changes

Change Details Files
Add server-owned data quality overview computation and TRPC endpoint.
  • Introduce DataQualityRepository to compose nutrition, activity, processing, anomaly, and journal signals into a unified DataQualityOverview over the last 30 days.
  • Define DataQualityOverview and DataQualityCheck types and helper functions (coverage, source overlap, sync freshness, outliers, manual edits) to compute per-check status, messages, counts, and details.
  • Expose a new processingRouter.dataQuality cachedProtectedQuery that validates input endDate, applies a runtime zod output schema, ensures providers are registered, and delegates to DataQualityRepository.overview.
  • Update processing router tests to mock DataQualityRepository and ensureProvidersRegistered, and add a test that validates the dataQuality endpoint’s runtime shape and output.
packages/server/src/repositories/data-quality-repository.ts
packages/server/src/repositories/data-quality-repository.test.ts
packages/server/src/routers/processing.ts
packages/server/src/routers/processing.test.ts
Add web Data Quality center UI, page, route, navigation entries, and inline source-overlap indicators.
  • Create DataQualityCenter component that renders overall data quality status and individual check cards with server-authored messages, evidence lines, and navigation links to nutrition, dashboard, and journal destinations.
  • Add DataQualityPage that queries processing.dataQuality via trpc, shows loading/error/empty states via QueryStatePanel, and renders DataQualityCenter with the latest overview while handling refresh errors.
  • Register /data-quality route in TanStack router routeTree, wire it into RootRouteChildren, FileRouteTypes, and module augmentation metadata, and add navigation links from AppHeader (top nav) and MorePage (secondary nav).
  • Surface source-overlap inline pills on ActivityCardContent and NutritionDataQualityPanel when overlap data is present, including tests asserting visibility and updated copy.
  • Add tests and Storybook stories for DataQualityCenter, exercising attention, loading, and empty states, and validating rendered content and review links.
packages/web/src/components/DataQualityCenter.tsx
packages/web/src/components/DataQualityCenter.test.tsx
packages/web/src/components/DataQualityCenter.stories.tsx
packages/web/src/pages/DataQualityPage.tsx
packages/web/src/routes/data-quality.tsx
packages/web/src/routeTree.gen.ts
packages/web/src/components/AppHeader.tsx
packages/web/src/pages/MorePage.tsx
packages/web/src/pages/MorePage.test.tsx
packages/web/src/components/ActivityCardContent.tsx
packages/web/src/components/ActivityCardContent.test.tsx
packages/web/src/components/NutritionDataQualityPanel.tsx
packages/web/src/components/NutritionDataQualityPanel.test.tsx
Add mobile Data Quality center UI, screen, navigation, and inline source-overlap indicators.
  • Create mobile DataQualityCenter component that presents overall data quality, per-check cards with server-authored messages and evidence, and review actions wired via an onReview callback to appropriate destinations (nutrition analytics, dashboard tab root, journal).
  • Introduce DataQualityScreen that queries processing.dataQuality using trpc with today’s endDate, wraps the center in scrollable layout, and uses QueryStatePanel for loading, error, and empty states as well as refresh failure messaging.
  • Register the data-quality screen in the authenticated stack navigator and MoreScreen destinations, including copy describing what the Data Quality center covers, and ensure navigation tests validate the new link and route.
  • Show inline “Source overlap” pills on ActivitiesScreen cards and NutritionDataQualityPanel when overlap data is present, including updated styles and tests asserting presence of the pill.
  • Add tests and Storybook stories for the mobile DataQualityCenter component to validate rendered checks, review actions, loading state, and visual examples of attention, loading, and empty scenarios.
packages/mobile/components/DataQualityCenter.tsx
packages/mobile/components/DataQualityCenter.test.tsx
packages/mobile/components/DataQualityCenter.stories.tsx
packages/mobile/app/data-quality.tsx
packages/mobile/app/_layout.tsx
packages/mobile/app/more.tsx
packages/mobile/app/more.test.tsx
packages/mobile/app/(tabs)/activities.tsx
packages/mobile/app/(tabs)/activities.test.tsx
packages/mobile/components/NutritionDataQualityPanel.tsx
packages/mobile/components/NutritionDataQualityPanel.test.tsx

Assessment against linked issues

Issue Objective Addressed Explanation
#2079 Add a cross-product, server-owned Data Quality center in the main UI (web and mobile) that surfaces checks for missing days, source overlap, sync freshness, outliers, and manual edits.
#2079 Add inline badges/indicators on core product surfaces (e.g., activity and nutrition) for all data quality categories: missing days, source overlap, stale sync, outliers, and manual edits. The PR adds inline source-overlap pills on activity cards and nutrition data quality panels (web and mobile), but there are no inline badges for missing days, sync freshness, outliers, or manual edits. Those categories are only surfaced in the Data Quality center overview, not as inline UI badges.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add server-owned Data Quality center across server, web, and mobile

✨ Enhancement 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Add server-composed data-quality overview endpoint aggregating multiple existing health signals.
• Add Data Quality center screens on web and iOS with navigation entry points.
• Surface inline source-overlap indicators on activity and nutrition views.
Diagram

graph TD
  M["Mobile screens"] --> T["tRPC processing.dataQuality"] --> R["Server processingRouter"] --> D["DataQualityRepository"] --> S["Existing signal repos"]
  W["Web pages"] --> T
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Client-composed overview (web/mobile aggregate existing endpoints)
  • ➕ No new server repository type to maintain
  • ➕ Allows platform-specific weighting/messaging
  • ➖ Duplicates aggregation logic across platforms
  • ➖ Harder to keep messaging/status consistent
  • ➖ More network calls and higher failure surface area
2. Fold data-quality into existing processing.status response
  • ➕ One less endpoint to document and cache
  • ➕ Keeps "processing" concerns under one API surface
  • ➖ Overloads processing.status with non-processing signals (nutrition overlap, anomalies, journal)
  • ➖ Harder to evolve independently (cache TTL, access windows, UI consumers)
3. Registry-based check framework (pluggable checks with shared schema)
  • ➕ Easier to add/remove checks without editing a monolithic composer
  • ➕ Encourages consistent status/messaging rules
  • ➖ More abstraction than needed for the initial rollout
  • ➖ Higher upfront complexity for minimal immediate benefit

Recommendation: The PR’s server-owned composition approach is the best tradeoff here: it centralizes definitions of checks/status/messaging and ensures web/mobile stay consistent while keeping the client implementation lightweight. Consider a registry-based check framework only if the number of checks grows substantially or needs feature-flagging/extensibility.

Files changed (28) +1332 / -5

Enhancement (15) +809 / -0
activities.tsxShow source-overlap pill in activity provenance row +15/-0

Show source-overlap pill in activity provenance row

• Adds conditional rendering for a "Source overlap" pill next to the primary source label when overlapSummary exists. Introduces styling for the new pill.

packages/mobile/app/(tabs)/activities.tsx

_layout.tsxRegister Data Quality route in mobile stack navigator +6/-0

Register Data Quality route in mobile stack navigator

• Adds a new Stack.Screen entry for the "data-quality" route with the "Data Quality" title.

packages/mobile/app/_layout.tsx

data-quality.tsxAdd mobile Data Quality center screen backed by TRPC query +67/-0

Add mobile Data Quality center screen backed by TRPC query

• Introduces a new DataQualityScreen that fetches processing.dataQuality for the current endDate and renders loading/error/empty states. Provides per-check review navigation via expo-router routes.

packages/mobile/app/data-quality.tsx

more.tsxAdd Data quality entry to More destinations list +7/-0

Add Data quality entry to More destinations list

• Adds a new More menu destination pointing to /data-quality with icon and description text.

packages/mobile/app/more.tsx

DataQualityCenter.tsxIntroduce mobile DataQualityCenter UI component and check cards +205/-0

Introduce mobile DataQualityCenter UI component and check cards

• Implements a reusable center component rendering overall status/window and per-check cards with status chips, evidence details, and review actions. Standardizes status labeling (Needs review/Info/Ready) and adds accessible loading/summary semantics.

packages/mobile/components/DataQualityCenter.tsx

NutritionDataQualityPanel.tsxAdd overlap review pill to mobile nutrition data quality panel +16/-0

Add overlap review pill to mobile nutrition data quality panel

• Adds a conditional pill indicating overlap requires review when overlapDays > 0 and defines pill styling.

packages/mobile/components/NutritionDataQualityPanel.tsx

data-quality-repository.tsAdd DataQualityRepository composing multi-signal overview for 30-day window +261/-0

Add DataQualityRepository composing multi-signal overview for 30-day window

• Implements a server-owned DataQualityOverview schema and a DataQualityRepository that aggregates processing freshness, nutrition coverage/overlap, activity overlap, anomaly detection, and manual journal entries into consistent checks and messaging.

packages/server/src/repositories/data-quality-repository.ts

processing.tsExpose cached processing.dataQuality endpoint with runtime output validation +40/-0

Expose cached processing.dataQuality endpoint with runtime output validation

• Adds output schema for DataQualityOverview, wires a cached protected query taking endDate, ensures providers are registered, and delegates to DataQualityRepository.overview.

packages/server/src/routers/processing.ts

ActivityCardContent.tsxShow source-overlap badge in web activity card header +5/-0

Show source-overlap badge in web activity card header

• Adds conditional rendering of an amber "Source overlap" badge alongside the primary source label when overlapSummary exists.

packages/web/src/components/ActivityCardContent.tsx

AppHeader.tsxAdd Data quality to top-level web navigation +1/-0

Add Data quality to top-level web navigation

• Adds a new nav item linking to /data-quality in the header navigation list.

packages/web/src/components/AppHeader.tsx

DataQualityCenter.tsxIntroduce web DataQualityCenter component with review links per check +127/-0

Introduce web DataQualityCenter component with review links per check

• Implements the center UI and check cards with status badges, details list, and TanStack Router review links. Standardizes status labels and styling to match server statuses.

packages/web/src/components/DataQualityCenter.tsx

NutritionDataQualityPanel.tsxAdd overlap review pill to web nutrition data quality panel +5/-0

Add overlap review pill to web nutrition data quality panel

• Adds a conditional amber pill indicating overlap requires review when overlapDays > 0.

packages/web/src/components/NutritionDataQualityPanel.tsx

DataQualityPage.tsxAdd Data quality page fetching overview and handling query states +42/-0

Add Data quality page fetching overview and handling query states

• Introduces a new page that queries processing.dataQuality for the current endDate, renders DataQualityCenter, and shows loading/error/empty and refresh-failure states within PageLayout.

packages/web/src/pages/DataQualityPage.tsx

MorePage.tsxAdd Data quality entry to web More destinations list +6/-0

Add Data quality entry to web More destinations list

• Adds a new destination item linking to /data-quality with descriptive copy.

packages/web/src/pages/MorePage.tsx

data-quality.tsxAdd TanStack file route for DataQualityPage +6/-0

Add TanStack file route for DataQualityPage

• Registers the /data-quality route pointing to the new DataQualityPage component.

packages/web/src/routes/data-quality.tsx

Tests (10) +365 / -5
activities.test.tsxAssert overlap pill appears for activities with matched sources +1/-0

Assert overlap pill appears for activities with matched sources

• Extends the ActivitiesScreen test to expect a visible "Source overlap" label when overlapSummary is present.

packages/mobile/app/(tabs)/activities.test.tsx

more.test.tsxTest More screen includes Data quality destination link +4/-0

Test More screen includes Data quality destination link

• Adds an accessibility-link test case to ensure "Data quality" opens the /data-quality route.

packages/mobile/app/more.test.tsx

DataQualityCenter.test.tsxAdd unit tests for mobile DataQualityCenter rendering and loading state +50/-0

Add unit tests for mobile DataQualityCenter rendering and loading state

• Validates that server-authored checks render correctly and that review buttons are present. Adds coverage for the loading state text.

packages/mobile/components/DataQualityCenter.test.tsx

NutritionDataQualityPanel.test.tsxUpdate nutrition panel test for overlap review pill +1/-0

Update nutrition panel test for overlap review pill

• Adds an assertion that "Source overlap to review" appears when overlapDays is non-zero.

packages/mobile/components/NutritionDataQualityPanel.test.tsx

data-quality-repository.test.tsAdd unit test for server data-quality overview composition +158/-0

Add unit test for server data-quality overview composition

• Introduces a repository test that mocks dependent repositories and verifies that coverage, overlap, freshness, outliers, and manual edits are combined into a single overview with expected counts/details.

packages/server/src/repositories/data-quality-repository.test.ts

processing.test.tsAdd processingRouter test coverage for dataQuality endpoint and provider registration +58/-5

Add processingRouter test coverage for dataQuality endpoint and provider registration

• Mocks DataQualityRepository and ensureProvidersRegistered and adds a test ensuring the router returns a validated server-owned overview.

packages/server/src/routers/processing.test.ts

ActivityCardContent.test.tsxAssert overlap pill appears for web activity card content +1/-0

Assert overlap pill appears for web activity card content

• Extends ActivityCardContent tests to expect a "Source overlap" badge when overlapSummary is present.

packages/web/src/components/ActivityCardContent.test.tsx

DataQualityCenter.test.tsxAdd web unit tests for DataQualityCenter rendering and loading state +88/-0

Add web unit tests for DataQualityCenter rendering and loading state

• Tests that server-authored checks render, evidence details appear, and review links are present. Includes a loading-state assertion.

packages/web/src/components/DataQualityCenter.test.tsx

NutritionDataQualityPanel.test.tsxUpdate nutrition panel test for overlap review pill (web) +1/-0

Update nutrition panel test for overlap review pill (web)

• Adds an assertion that "Source overlap to review" is displayed when overlapDays is non-zero.

packages/web/src/components/NutritionDataQualityPanel.test.tsx

MorePage.test.tsxTest More page includes Data quality link +3/-0

Test More page includes Data quality link

• Adds a test assertion that the "Data quality" destination links to /data-quality.

packages/web/src/pages/MorePage.test.tsx

Documentation (2) +137 / -0
DataQualityCenter.stories.tsxAdd Storybook stories for mobile DataQualityCenter states +55/-0

Add Storybook stories for mobile DataQualityCenter states

• Creates sample overview data and adds Attention/Loading/Empty stories to document component behavior and styling.

packages/mobile/components/DataQualityCenter.stories.tsx

DataQualityCenter.stories.tsxAdd Storybook stories for web DataQualityCenter states +82/-0

Add Storybook stories for web DataQualityCenter states

• Creates sample overview data and adds Attention/Loading/Empty stories for documentation and visual regression workflows.

packages/web/src/components/DataQualityCenter.stories.tsx

Other (1) +21 / -0
routeTree.gen.tsRegenerate route tree to include /data-quality route +21/-0

Regenerate route tree to include /data-quality route

• Updates generated TanStack Router route definitions and types to include the new /data-quality file route.

packages/web/src/routeTree.gen.ts

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Mobile Preview

Scan to open on device:

QR code for dofek://preview/pr-2402

Channel pr-2402
Deep Link dofek://preview/pr-2402
Commit bfebd87

To test on device:

  1. Build and install the preview client: PREVIEW_CHANNEL=pr-2402 pnpm expo prebuild --clean -p ios
  2. Or tap deep link on an existing preview build: dofek://preview/pr-2402

Each PR gets its own channel. Build a preview client with PREVIEW_CHANNEL=pr-{N} to test.

@qodo-code-review

qodo-code-review Bot commented Aug 2, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 194 rules

Grey Divider


Action required

1. Activity overlap window mismatch ✓ Resolved 🐞 Bug ≡ Correctness
Description
DataQualityRepository.overview presents a 30-day overview but only queries 1 week of activity data
(weeks: 1) for the activity source-overlap portion, so overlaps outside the last 7 days are
omitted while still being implied by the 30-day window. This makes the new server-owned overview
internally inconsistent and undercounts activity overlap.
Code

packages/server/src/repositories/data-quality-repository.ts[R209-216]

+    const activityPromise = new ActivitiesCalendarRepository(
+      this.#database,
+      this.#userId,
+      this.#timezone,
+      this.#sensorStore,
+      this.#accessWindow,
+    ).getWeekList({ weeks: 1, endDate, includeProviderAbsent: true });
+    const [processing, nutrition, activityDays, anomalies, journalEntries] = await Promise.all([
Relevance

●● Moderate

Potential window inconsistency, but may be intentional for performance; unclear expected
activity-overlap scope.

PR-#2386

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The overview uses a 30-day window constant for other signals, but activity overlap is sourced via a
1-week query, and the calendar repository defines a week query as weeks * 7 days.

packages/server/src/repositories/data-quality-repository.ts[208-216]
packages/server/src/repositories/activities-calendar-repository.ts[226-230]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The data quality overview is defined over `DATA_QUALITY_WINDOW_DAYS` (30) but activity overlap detection only fetches `weeks: 1` from `ActivitiesCalendarRepository.getWeekList`, which is `7` days of activity rows.

### Issue Context
`ActivitiesCalendarRepository` computes the requested day window as `input.weeks * 7`. As a result, the activity overlap count/lastObservedDate can be incomplete relative to the advertised 30-day window.

### Fix
Change the activity query to cover the full 30-day window (e.g. `weeks: Math.ceil(DATA_QUALITY_WINDOW_DAYS / 7)`), and ensure the computed overlap dates/count align with `window.days`.

### Fix Focus Areas
- packages/server/src/repositories/data-quality-repository.ts[208-216]
- packages/server/src/repositories/activities-calendar-repository.ts[226-230]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. statusLabel duplicated cross-platform ✓ Resolved 📘 Rule violation ⌂ Architecture
Description
statusLabel/review-destination logic is implemented separately in both web and mobile Data Quality
centers instead of being centralized in a shared domain package, increasing the risk of divergence.
This violates the requirement to centralize shared feature/business logic in domain packages when
the feature exists on both platforms.
Code

packages/mobile/components/DataQualityCenter.tsx[R15-18]

+function statusLabel(status: DataQualityCheck["status"]): string {
+  switch (status) {
+    case "attention":
+      return "Needs review";
Relevance

●●● Strong

Team often centralizes cross-platform duplicated logic into shared/domain packages to prevent drift.

PR-#2395
PR-#2150

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 773501 requires centralizing shared logic for features implemented on both web and
mobile into domain packages; the diff adds near-identical status-label and review-destination logic
in both platform implementations.

Rule 773501: Mirror web and mobile changes and centralize shared logic in domain packages
packages/mobile/components/DataQualityCenter.tsx[15-47]
packages/web/src/components/DataQualityCenter.tsx[13-40]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Data Quality center duplicates shared mapping logic (status labels + review destinations) in both `packages/web` and `packages/mobile`.

## Issue Context
Compliance requires shared feature logic to live in a domain package so web/mobile import it rather than re-implementing separately.

## Fix Focus Areas
- packages/mobile/components/DataQualityCenter.tsx[15-47]
- packages/web/src/components/DataQualityCenter.tsx[13-40]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Duplicate detail list keys ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
Both mobile and web DataQualityCenter render qualityCheck.details with key={detail}, so repeated
detail strings will produce duplicate React keys and make reconciliation ambiguous (and trigger
warnings) when details change over time. This is avoidable by using an index/composite key or
server-provided stable IDs.
Code

packages/mobile/components/DataQualityCenter.tsx[R75-78]

+          {qualityCheck.details.map((detail) => (
+            <Text key={detail} style={styles.detail}>
+              {detail}
+            </Text>
Relevance

●●● Strong

Duplicate React keys from key={string} collisions were previously fixed; likely to be addressed
again.

PR-#2301

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Both implementations use the detail string as the list key, which can collide if two details are
identical.

packages/mobile/components/DataQualityCenter.tsx[73-80]
packages/web/src/components/DataQualityCenter.tsx[63-68]
PR-#2301

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`qualityCheck.details.map(...)` uses the detail string as the React key in both mobile and web DataQualityCenter components. If the server returns duplicate detail strings, React will see duplicate keys, leading to warnings and potentially unstable reconciliation when the list updates.

### Issue Context
This mirrors a previously accepted bug pattern in similar list rendering.

### Fix
Use an index-based or composite key (e.g. `${qualityCheck.key}-${idx}`) for these purely-presentational lists, or have the server provide unique IDs per detail item.

### Fix Focus Areas
- packages/mobile/components/DataQualityCenter.tsx[73-80]
- packages/web/src/components/DataQualityCenter.tsx[63-68]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. DataQualityRoute uses as any ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new DataQualityRoute entry in the generated route tree was added using an as any type
assertion, introducing an explicit any in a changed TypeScript file. This violates compliance
policy and weakens type safety by potentially masking real type errors in the routing tree.
Code

packages/web/src/routeTree.gen.ts[R157-160]

+  id: '/data-quality',
+  path: '/data-quality',
+  getParentRoute: () => rootRouteImport,
+} as any)
Relevance

●● Moderate

as any is in a generated route tree; policy concern exists but generated-code exceptions are
common.

PR-#2280

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance IDs 773537 and 773514 prohibit explicit any usages in changed TypeScript code,
including as any assertions. The diff for the new Data Quality / DataQualityRoute route tree
entry includes the snippet } as any), which is an explicit any assertion and therefore directly
triggers the rule.

Rule 773537: Disallow use of the any type in TypeScript
Rule 773514: Avoid unsafe as casts in TypeScript; prefer type narrowing
packages/web/src/routeTree.gen.ts[156-160]
packages/web/src/routeTree.gen.ts[160-160]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
An explicit `any` was introduced via an `as any` assertion in the generated route tree for `DataQualityRoute`, which is disallowed and undermines type safety.

## Issue Context
Compliance policy (per PR Compliance IDs 773537 and 773514) prohibits explicit `any` in changed TypeScript files, including `as any` assertions. Exceptions are only acceptable when they are tightly scoped and well-documented (e.g., interop shims); otherwise the code should be typed properly to avoid masking real type errors.

## Fix Focus Areas
- packages/web/src/routeTree.gen.ts[156-160]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (1)
5. Coverage ignores access window ✓ Resolved 🐞 Bug ≡ Correctness
Description
Coverage messaging and missing-day math always assume a full 30-day window, but nutrition rows are
filtered by dateAccessPredicate when accessWindow is limited, so users with restricted
entitlements can be told they are “missing” days they cannot access. The overview’s window.days
and the per-check coverage denominator can therefore be incorrect for non-full access windows.
Code

packages/server/src/repositories/data-quality-repository.ts[R59-70]

+  const missingDays = Math.max(DATA_QUALITY_WINDOW_DAYS - daysWithNutritionData, 0);
+  const status: DataQualityCheckStatus = missingDays > 0 ? "attention" : "healthy";
+
+  return check({
+    key: "coverage",
+    label: "Missing days",
+    status,
+    title: missingDays > 0 ? "Coverage gaps" : "Coverage is complete",
+    message:
+      missingDays > 0
+        ? `Nutrition data is missing for ${missingDays} of the last ${DATA_QUALITY_WINDOW_DAYS} days.`
+        : `Nutrition data is present for all ${DATA_QUALITY_WINDOW_DAYS} days in the selected window.`,
Relevance

●● Moderate

Access-window correctness is important, but changing coverage math/copy may be debated or deferred.

PR-#1188

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The coverage check hardcodes 30 days, while the nutrition query it relies on is filtered by access
window predicates, meaning daysWithData can be capped below 30 for entitlement reasons.

packages/server/src/repositories/data-quality-repository.ts[58-75]
packages/server/src/repositories/nutrition-analytics-repository.ts[830-840]
packages/server/src/lib/base-repository.ts[50-54]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`coverageCheck` computes missing days using `DATA_QUALITY_WINDOW_DAYS` (30) while the underlying nutrition query applies `dateAccessPredicate` from `BaseRepository`, which can exclude older dates for restricted users. This can inflate missing-day counts and produce misleading “last 30 days” copy.

### Issue Context
`BaseRepository.dateAccessPredicate` enforces access windows by adding date bounds to SQL queries. `NutritionAnalyticsRepository.getMicronutrientDataQuality` includes this predicate.

### Fix
Compute an *effective* window (days + displayed messaging) that reflects the intersection of the last 30 days with `ctx.accessWindow` (when not full), and use that effective window consistently across:
- `DataQualityOverview.window.days`
- coverage check denominator/messages
- any repositories invoked with a day-window argument (nutrition/anomaly/journal)

### Fix Focus Areas
- packages/server/src/repositories/data-quality-repository.ts[58-75]
- packages/server/src/repositories/nutrition-analytics-repository.ts[820-840]
- packages/server/src/lib/base-repository.ts[50-54]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

6. Incorrect singular grammar ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
DataQualityRepository always emits "need review" in overallMessage, producing "1 data quality
check need review." when exactly one check is in attention. This is user-visible copy and conflicts
with the client-side examples/tests using "needs review."
Code

packages/server/src/repositories/data-quality-repository.ts[R255-257]

+      overallMessage: hasAttention
+        ? `${attentionCount} data quality ${pluralize(attentionCount, "check")} need review.`
+        : "Your recent data is ready to interpret.",
Relevance

●●● Strong

User-visible singular/plural grammar fixes are routinely accepted; easy, low-risk change.

PR-#1875

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The message template hardcodes "need review" while pluralize only affects the noun, so the
singular case is grammatically incorrect.

packages/server/src/repositories/data-quality-repository.ts[251-257]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`overallMessage` uses "need review" regardless of whether `attentionCount` is 1 or plural.

### Issue Context
`pluralize(attentionCount, "check")` correctly returns "check" for 1, but the verb remains plural.

### Fix
Use a conditional verb (e.g. `${attentionCount === 1 ? "needs" : "need"}`) or pluralize the full phrase.

### Fix Focus Areas
- packages/server/src/repositories/data-quality-repository.ts[251-257]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Comment thread packages/mobile/components/DataQualityCenter.tsx Outdated
Comment thread packages/web/src/routeTree.gen.ts Outdated
Comment thread packages/mobile/components/DataQualityCenter.tsx Outdated
Comment thread packages/server/src/repositories/data-quality-repository.ts
Comment thread packages/server/src/repositories/data-quality-repository.ts Outdated
Comment thread packages/server/src/repositories/data-quality-repository.ts
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Storybook previews for bfebd874 are ready:

This comment updates automatically on each PR push.

Asherlc commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

CI diagnosis (run 30744242217): Test / Stryker (0) job 91487217155 failed in packages/server/src/repositories/data-quality-repository.ts with mutation score 45.57% (72 killed, 73 survived, 13 no-coverage), below the 75% break threshold. The aggregate Test / Mutation Testing job 91487596054 only propagated that failure. No threshold or CI workaround is appropriate; the follow-up is focused public-behavior coverage for the status/detail branches and edge cases, followed by a fresh exact-scope mutation run.

@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 17

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/mobile/components/DataQualityCenter.stories.tsx`:
- Around line 53-55: Add local Storybook stories in
DataQualityCenter.stories.tsx that use fixture data containing healthy and
informational check statuses, so both statusStyle and statusLabel branches are
rendered. Keep the existing default, Loading, and Empty stories unchanged, and
define the new fixtures within this file rather than sharing them with the web
story.

In `@packages/mobile/components/DataQualityCenter.test.tsx`:
- Around line 35-50: Extend the DataQualityCenter test suite to cover the !data
empty state and the onReview interaction path. Add the appropriate vi mock and
renderer-compatible user-event helper, render with a review callback, activate
the existing “Review nutrition” button, and assert the callback receives the
expected check; also verify the empty-state output when data is omitted.

In `@packages/mobile/components/DataQualityCenter.tsx`:
- Around line 68-72: Both clients incorrectly construct count text from the
non-countable server label; update
packages/mobile/components/DataQualityCenter.tsx lines 68-72 and
packages/web/src/components/DataQualityCenter.tsx lines 58-62 to remove those
count Text blocks or render the server-authored grammatical message/countable
label, keeping both platforms consistent and server-owned.
- Around line 82-89: Conditionally render the review Pressable in
DataQualityCenter only when onReview is provided, while preserving its current
label, styles, and callback behavior. Update the corresponding test to supply an
onReview spy and assert it is invoked instead of expecting a button without a
handler.
- Around line 2-6: Remove the direct server-source type import from
DataQualityCenter and obtain DataQualityCheck, DataQualityCheckKey, and
DataQualityOverview from an appropriate shared domain package or the tRPC router
output type. Update all usages in DataQualityCenter to reference the new shared
or inferred types while preserving their existing shapes and behavior.
- Around line 184-193: Update the healthy and attention styles in the
data-quality status configuration to use the existing themed colors. Map healthy
to colors.positiveSubtle and colors.positive, and attention to
colors.warningSubtle and colors.warning, then update the matching web badge
classes to use the same theme tokens for mobile/web parity.

In `@packages/server/src/repositories/data-quality-repository.test.ts`:
- Around line 101-146: Expand the DataQualityRepository test suite with cases
covering sourceOverlapCheck for nutrition-only overlap and exactly one nutrition
overlap day, coverageCheck when daysWithData exceeds the selected window,
latestDate with empty date lists returning null for manual_edits and outliers,
and check() filtering empty detail strings. Assert each branch’s public result
so the mutation score reaches the configured threshold.

In `@packages/server/src/repositories/data-quality-repository.ts`:
- Around line 255-257: Verb agreement is inconsistent across data-quality
messages. In packages/server/src/repositories/data-quality-repository.ts:157-159
and 255-257, add a small verb-selection helper beside pluralize and use it to
select “was/were” for anomalies.length and “needs/need” for attentionCount;
update the corresponding expected overallMessage assertions in
packages/server/src/repositories/data-quality-repository.test.ts:349-352 and the
same assertion at line 455 to use “needs” for a count of one.
- Around line 115-147: Update processingMessage and syncFreshnessCheck so the
message category is derived from the non-ready dataset statuses, including
failed or blocked datasets even when overallStatus is "ready"; retain
delayed/cancelled and still-updating behavior for their respective cases. Type
overallStatus with the existing ProcessingRepository.status return type (or its
shared status type) instead of string to preserve exhaustiveness, and update the
failed-dataset regression assertion in the related test to expect “could not be
updated.”
- Around line 209-215: The activity query in the source-overlap flow must cover
the same 30-day period reported by overview() and used by
DATA_QUALITY_WINDOW_DAYS. Update the getWeekList call on
ActivitiesCalendarRepository to request an equivalent 30-day window, using the
existing API’s week-based input or its supported day-based alternative, while
preserving endDate and includeProviderAbsent.
- Around line 58-77: Update coverageCheck and its caller in
getMicronutrientDataQuality to use nutrition.selectedWindowDays as the effective
window instead of DATA_QUALITY_WINDOW_DAYS, including missing-day calculation,
messages, and details while preserving the existing status behavior.

In `@packages/server/src/routers/processing.test.ts`:
- Around line 133-150: Add a second test for caller.dataQuality({}) that
verifies the procedure invokes ensureProvidersRegistered(), passes the resolved
YYYY-MM-DD default end date to mockDataQuality/overview(), and preserves the
expected response shape. Keep the existing explicit-endDate assertion while
covering the omitted-input default path.

In `@packages/server/src/routers/processing.ts`:
- Around line 103-123: Update dataQualityOutputSchema to reuse dateStringSchema
for window.endDate and checks.lastObservedDate, and timestampStringSchema for
generatedAt, removing the duplicated regex and deprecated z.string().datetime()
validation. Preserve the existing nullable behavior for lastObservedDate and
ensure the shared schemas are imported from src/lib/typed-sql.ts.

In `@packages/web/src/components/DataQualityCenter.test.tsx`:
- Around line 73-81: Update the test case “renders server-authored checks,
evidence, and review links” to assert each review link’s destination href, using
the Link mock’s rendered href and the routes defined by reviewDestinations. Keep
the existing label assertions, and verify that the nutrition review link points
to its expected route rather than only checking its accessible name.

In `@packages/web/src/components/DataQualityCenter.tsx`:
- Around line 89-97: Update the empty-state section in DataQualityCenter so it
is labelled by the existing “Data quality” heading rather than the
developer-facing aria-label. Use the appropriate heading-reference accessibility
attribute on the section and preserve the current heading and empty-state
content.

In `@packages/web/src/pages/DataQualityPage.tsx`:
- Around line 7-42: Add colocated tests for
packages/web/src/pages/DataQualityPage.tsx lines 7-42 covering loading, initial
error with retry, empty, successful data, and refresh failure while retaining
data; exercise the query state and retry behavior around DataQualityPage. Also
add a colocated screen test for packages/mobile/app/data-quality.tsx lines 18-61
covering the same query states and verifying each DataQualityCheckKey navigates
to its review destination.

In `@packages/web/src/routeTree.gen.ts`:
- Around line 156-160: Remove the `as any` suppression from the generated
`DataQualityRoute` definition and fix the generator or route-tree plugin
responsible for emitting these `update(...).update(...)` casts, so regenerated
route trees are correctly typed without `as any`. Apply the fix consistently to
the generator output rather than editing only `routeTree.gen.ts`, and regenerate
the file to verify the casts are gone.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: df1972f4-dcb1-4e11-97f6-dc1d65d2019a

📥 Commits

Reviewing files that changed from the base of the PR and between 9a9a271 and a496267.

📒 Files selected for processing (28)
  • packages/mobile/app/(tabs)/activities.test.tsx
  • packages/mobile/app/(tabs)/activities.tsx
  • packages/mobile/app/_layout.tsx
  • packages/mobile/app/data-quality.tsx
  • packages/mobile/app/more.test.tsx
  • packages/mobile/app/more.tsx
  • packages/mobile/components/DataQualityCenter.stories.tsx
  • packages/mobile/components/DataQualityCenter.test.tsx
  • packages/mobile/components/DataQualityCenter.tsx
  • packages/mobile/components/NutritionDataQualityPanel.test.tsx
  • packages/mobile/components/NutritionDataQualityPanel.tsx
  • packages/server/src/repositories/data-quality-repository.test.ts
  • packages/server/src/repositories/data-quality-repository.ts
  • packages/server/src/routers/processing.test.ts
  • packages/server/src/routers/processing.ts
  • packages/web/src/components/ActivityCardContent.test.tsx
  • packages/web/src/components/ActivityCardContent.tsx
  • packages/web/src/components/AppHeader.tsx
  • packages/web/src/components/DataQualityCenter.stories.tsx
  • packages/web/src/components/DataQualityCenter.test.tsx
  • packages/web/src/components/DataQualityCenter.tsx
  • packages/web/src/components/NutritionDataQualityPanel.test.tsx
  • packages/web/src/components/NutritionDataQualityPanel.tsx
  • packages/web/src/pages/DataQualityPage.tsx
  • packages/web/src/pages/MorePage.test.tsx
  • packages/web/src/pages/MorePage.tsx
  • packages/web/src/routeTree.gen.ts
  • packages/web/src/routes/data-quality.tsx

Comment thread packages/mobile/components/DataQualityCenter.stories.tsx
Comment thread packages/mobile/components/DataQualityCenter.test.tsx
Comment thread packages/mobile/components/DataQualityCenter.tsx Outdated
Comment thread packages/mobile/components/DataQualityCenter.tsx Outdated
Comment thread packages/mobile/components/DataQualityCenter.tsx Outdated
Comment thread packages/server/src/routers/processing.ts
Comment thread packages/web/src/components/DataQualityCenter.test.tsx
Comment thread packages/web/src/components/DataQualityCenter.tsx
Comment thread packages/web/src/pages/DataQualityPage.tsx
Comment thread packages/web/src/routeTree.gen.ts Outdated

Asherlc commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

Hosted run 30744850810 also had a shard-4 integration failure (job 91488810479), independent of the mutation changes: packages/server/src/routers/sleep.integration.test.ts failed at lines 135 and 239. First test expected row.source_name null but received Overlap Device; second expected averageEfficiencyPercent 86.3 but received 87.8. The same job logged repeated ClickHouse ECONNRESET warnings before the failures. Please reproduce/diagnose whether this is shared-fixture isolation or a regression on the new branch; do not merge or suppress it without evidence.

@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

Asherlc commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

Fresh CI run 30745584488 surfaced two distinct blockers: Integration shard 1 failed while Docker attempted to pull docker.io with HTTP 500 ... request canceled while awaiting headers, and shard 4 still has the real sleep.integration.test.ts failures ('Overlap Device' vs null, 87.8 vs 86.3). The shard-1 failure is hosted-registry infrastructure and will be rerun after the code/test remediation; shard 4 still needs root-cause diagnosis.

@Asherlc

Asherlc commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

Addressed the actionable CodeRabbit review items in 6b17970.\n\n- Centralized status/destination mappings in the shared format domain package and kept web/mobile rendering in parity.\n- Removed client-authored count grammar; the server overview owns count/message text, including singular attention grammar and failed-dataset wording.\n- Added duplicate-detail key regressions, full 30-day overlap coverage, restricted-window intersection coverage, typed date/timestamp schema coverage, processing forwarding/default coverage, and repository mutation-focused boundary coverage.\n- Added web/mobile Data Quality screen query-state tests, review href/destination assertions, empty-state accessibility coverage, optional mobile review-button coverage, and Healthy/Informational mobile Storybook variants.\n- Patched both installed TanStack router-generator versions and regenerated routeTree.gen.ts with typed route assertions; no generated unsafe any assertions remain.\n\nFocused validation: 41 unit tests, 10 mobile tests, package typechecks, lint:sandbox, Biome, and focused Stryker (191/196 effective mutants killed; 0 no-coverage/errors; 97.45%).

@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

2 similar comments
@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/server/src/repositories/data-quality-repository.ts (1)

188-209: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a shared Dofek provider-id constant for manual-entry checks.

DOFEK_PROVIDER_ID is not exported from journal-repository.ts, and packages/server/src/repositories/ contains several independent local "dofek" constants. Move the canonical provider id to a shared constants module and import it here, then replace "dofek" with that constant so this check cannot drift from the manual-entry writer.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/server/src/repositories/data-quality-repository.ts` around lines 188
- 209, Move the canonical Dofek provider ID into a shared constants module,
export it, and update the manual-entry writer and manualEntriesCheck to import
and reuse DOFEK_PROVIDER_ID. Replace the local "dofek" comparison in
manualEntriesCheck while preserving the existing filtering behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/format/src/data-quality.ts`:
- Around line 50-55: Update DATA_QUALITY_REVIEWS so source_overlap findings have
a review action that covers both nutrition and activity, or split the check into
domain-specific keys. Extend DataQualityReviewDestination and update the
corresponding web and mobile route maps to resolve the new shared contract,
ensuring activity-only overlaps navigate to affected records instead of the
nutrition review.

In `@packages/mobile/components/DataQualityCenter.test.tsx`:
- Around line 67-82: Update the duplicate-key regression assertions in
DataQualityCenter.test.tsx for
packages/mobile/components/DataQualityCenter.test.tsx:67-82 and
packages/web/src/components/DataQualityCenter.test.tsx:110-125 to inspect all
console.error call arguments by flattening consoleError.mock.calls before
checking for “same key”; preserve the existing repeated-detail rendering
assertions and cleanup.

---

Outside diff comments:
In `@packages/server/src/repositories/data-quality-repository.ts`:
- Around line 188-209: Move the canonical Dofek provider ID into a shared
constants module, export it, and update the manual-entry writer and
manualEntriesCheck to import and reuse DOFEK_PROVIDER_ID. Replace the local
"dofek" comparison in manualEntriesCheck while preserving the existing filtering
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1ce734db-43d2-4502-a9af-2e0dc84038e1

📥 Commits

Reviewing files that changed from the base of the PR and between a496267 and 150ea3f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (20)
  • packages/format/package.json
  • packages/format/src/data-quality.test.ts
  • packages/format/src/data-quality.ts
  • packages/mobile/app/data-quality.test.tsx
  • packages/mobile/app/data-quality.tsx
  • packages/mobile/components/DataQualityCenter.stories.tsx
  • packages/mobile/components/DataQualityCenter.test.tsx
  • packages/mobile/components/DataQualityCenter.tsx
  • packages/server/src/repositories/data-quality-repository.test.ts
  • packages/server/src/repositories/data-quality-repository.ts
  • packages/server/src/routers/processing.test.ts
  • packages/server/src/routers/processing.ts
  • packages/web/src/components/DataQualityCenter.stories.tsx
  • packages/web/src/components/DataQualityCenter.test.tsx
  • packages/web/src/components/DataQualityCenter.tsx
  • packages/web/src/pages/DataQualityPage.test.tsx
  • packages/web/src/routeTree.gen.ts
  • patches/@tanstack__router-generator@1.167.17.patch
  • patches/@tanstack__router-generator@1.167.18.patch
  • pnpm-workspace.yaml

Comment thread packages/format/src/data-quality.ts
Comment thread packages/mobile/components/DataQualityCenter.test.tsx
@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

1 similar comment
@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

Asherlc commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

Addressed the review feedback in 34aec45. Data-quality source overlap is now split into nutrition_source_overlap and activity_source_overlap so each finding maps to the correct destination and review copy; shared format types, server schema, web route, mobile route, tests, and stories were updated. Duplicate-key assertions now flatten all console.error arguments on both platforms. Validation: 47 focused tests passed, Biome passed, and server/web/mobile typechecks passed.

@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

Asherlc added 4 commits August 2, 2026 07:45
Share review metadata and detail keys across clients while making the overview window honor access limits and full activity history.\n\nCloses #2079
@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

@Asherlc
Asherlc merged commit 2baa862 into main Aug 2, 2026
103 checks passed
@Asherlc
Asherlc deleted the codex/issue-2079 branch August 2, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DQ-06] Data quality and conflicts not part of main UI

2 participants