Skip to content

[mobile] Migrate processing status surfaces (6/7) - #1870

Merged
Asherlc merged 21 commits into
mainfrom
Asherlc/issue-1852-mobile
Jul 23, 2026
Merged

Asherlc merged 21 commits into
mainfrom
Asherlc/issue-1852-mobile

Conversation

@Asherlc

@Asherlc Asherlc commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Part 6 of the #1852 processing-status stack.

Migrates mobile dashboard, activity, recovery, strain, sleep, and provider surfaces to the processing-status API. Adds the mobile processing-status widget and removes the legacy mobile readiness banner.

Previous: #1869. Next: #1872.

Changed files: 27.

Summary by CodeRabbit

  • New Features

    • Added processing-status widgets across activity, sleep, recovery, strain, provider, and dashboard screens.
    • Displays processing progress, delays, failures, timelines, and actionable error states.
    • Processing status now refreshes automatically while the app is active.
    • Added expanded Storybook coverage for processing states.
  • Bug Fixes

    • Refresh and data-deletion flows now reliably update processing status.
    • Updated messaging to clearly indicate when processing needs attention.

@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.

@cursor

cursor Bot commented Jul 22, 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.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@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

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Asherlc, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dd851a6d-14e7-44ec-8b87-f5e622005fa2

📥 Commits

Reviewing files that changed from the base of the PR and between 1764b3b and 93b74ca.

📒 Files selected for processing (12)
  • packages/mobile/app/(tabs)/recovery.test.tsx
  • packages/mobile/app/(tabs)/recovery.tsx
  • packages/mobile/app/(tabs)/strain.test.tsx
  • packages/mobile/app/(tabs)/strain.tsx
  • packages/mobile/components/ProcessingStatusWidget.test.tsx
  • packages/mobile/components/ProcessingStatusWidget.tsx
  • packages/mobile/lib/useProcessingStatus.test.ts
  • packages/mobile/lib/useProcessingStatus.ts
  • packages/providers-meta/src/processing-status.test.ts
  • packages/providers-meta/src/processing-status.ts
  • packages/web/src/components/ProcessingStatusWidget.test.tsx
  • packages/web/src/components/ProcessingStatusWidget.tsx
📝 Walkthrough

Walkthrough

Mobile screens now use processing.status and ProcessingStatusWidget instead of sync.dataHealth and DataReadinessBanner. A foreground-aware polling hook, updated refresh invalidation, provider-scoped status handling, tests, and Storybook coverage are added.

Changes

Processing status presentation

Layer / File(s) Summary
Processing status widget and coverage
packages/mobile/components/ProcessingStatusWidget.tsx, packages/mobile/components/ProcessingStatusWidget.test.tsx, packages/mobile/components/ProcessingStatusWidget.stories.tsx
Adds the processing snapshot contract, status card, progress and timeline rendering, error handling, tests, and Storybook variants.
Screen status integration
packages/mobile/lib/useProcessingStatus.ts, packages/mobile/app/(tabs)/*
Adds foreground-only polling and replaces readiness banners with processing status widgets across activity, dashboard, recovery, strain, and sleep screens.
Provider status and lifecycle invalidation
packages/mobile/app/providers/*, packages/mobile/lib/useAutoSync.ts
Adds provider-scoped processing status, refresh invalidation, and post-deletion cache invalidation. The previous DataReadinessBanner component and its tests and stories are removed.
Query and test contract updates
packages/mobile/lib/*test.ts, packages/mobile/app/_layout.cleanup.test.tsx
Updates mocked query paths, split-link expectations, query hashes, fetch diagnostics, and invalidation assertions to use processing.status.

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

Sequence Diagram(s)

sequenceDiagram
  participant MobileScreen
  participant useProcessingStatus
  participant ProcessingStatusQuery
  participant ProcessingStatusWidget
  MobileScreen->>useProcessingStatus: request datasets or providerId
  useProcessingStatus->>ProcessingStatusQuery: call processing.status
  ProcessingStatusQuery-->>useProcessingStatus: return status data
  useProcessingStatus-->>MobileScreen: expose data, error, loading
  MobileScreen->>ProcessingStatusWidget: render processing status
Loading

Possibly related PRs

  • Asherlc/dofek#1869: Migrates the corresponding web surfaces from data health to processing status.
  • Asherlc/dofek#1418: Updates the earlier DataReadinessBanner syncing behavior replaced by this change.
  • Asherlc/dofek#1679: Overlaps with provider deletion invalidation changes.

Suggested labels: area/mobile, area/providers, type/feature

Suggested reviewers: copilot

🚥 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 is imperative, clearly matches the mobile processing-status migration, and stays under the 70-character limit with the required area prefix.

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.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Mobile Preview

Scan to open on device:

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

Channel pr-1870
Deep Link dofek://preview/pr-1870
Commit 9799c12

To test on device:

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

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

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Storybook previews for 9799c127 are ready:

This comment updates automatically on each PR push.

@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.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@Asherlc Asherlc changed the title Processing status 6/7: migrate mobile surfaces [mobile] Migrate processing status surfaces (6/7) Jul 22, 2026
@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.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

Base automatically changed from Asherlc/issue-1852-web to main July 23, 2026 13:54
Copilot AI review requested due to automatic review settings July 23, 2026 17:20

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.

@codereviewbot-ai

codereviewbot-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Pull Request Review Summary

The migration from DataReadinessBanner / trpc.sync.dataHealth to ProcessingStatusWidget / useProcessingStatus (trpc.processing.status) is well structured across screens, hooks, and test suites.

Key Observations & Recommendations:

  1. Defensive Progress Percentage Handling (ProcessingStatusWidget.tsx): Filter progressPercentage using typeof === "number" and Number.isFinite rather than !== null to avoid NaN values resulting in invalid CSS styles like width: "NaN%".
  2. Safe Timeline Traversal (ProcessingStatusWidget.tsx): Default operation.timeline to [] when mapping or flattening to prevent runtime TypeError if an operation object omits timeline.
  3. Optional Chaining in Polling Callback (useProcessingStatus.ts): Safely inspect query?.state?.data?.overallStatus in refetchInterval.

🤖 Reviewed by codereviewbot.ai - Catch bugs before your team does.

Comment thread packages/mobile/components/ProcessingStatusWidget.tsx Outdated
Comment thread packages/mobile/components/ProcessingStatusWidget.tsx
Comment thread packages/mobile/lib/useProcessingStatus.ts Outdated
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown

Greptile Summary

This PR moves mobile processing surfaces to the processing-status API. The main changes are:

  • Adds the mobile processing-status widget and shared display helpers.
  • Migrates dashboard, activity, recovery, strain, sleep, and provider screens.
  • Adds foreground polling and refresh invalidation for processing status.
  • Removes the legacy mobile readiness banner.
  • Keeps mobile and web error, progress, and failure handling aligned.

Confidence Score: 5/5

This looks safe to merge.

  • The foreground transition now starts an immediate status refetch.
  • Cached status remains visible after a background refresh error.
  • Unknown progress and historical failure handling are covered by shared logic and tests.
  • No blocking issues remain in the reviewed fixes.

Important Files Changed

Filename Overview
packages/mobile/lib/useProcessingStatus.ts Adds app-state-aware polling and an immediate refetch when the app returns to the foreground.
packages/mobile/components/ProcessingStatusWidget.tsx Adds the mobile status widget while preserving usable cached data after refresh errors.
packages/providers-meta/src/processing-status.ts Adds shared progress and current-failure helpers used by mobile and web.
packages/web/src/components/ProcessingStatusWidget.tsx Uses the shared helpers and preserves cached status after a background refresh error.

Reviews (3): Last reviewed commit: "fix: refresh processing status on pull" | Re-trigger Greptile

Comment thread packages/mobile/lib/useProcessingStatus.ts
Comment thread packages/mobile/components/ProcessingStatusWidget.tsx
Comment thread packages/mobile/components/ProcessingStatusWidget.tsx
Comment thread packages/mobile/components/ProcessingStatusWidget.tsx Outdated

@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: 4

Caution

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

⚠️ Outside diff range comments (1)
packages/mobile/app/providers/[id].tsx (1)

813-822: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Invalidate processing status on disconnect.

The new processing.status cache is invalidated for pull-to-refresh here, but the disconnect success path above still invalidates only sync.providers and sync.providerStats before router.back(). Returning to ProvidersScreen can therefore show the pre-disconnect account-wide status until a later poll or manual refresh. Add trpcUtils.processing.status.invalidate() to the disconnect success path as well.

🤖 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/mobile/app/providers/`[id].tsx around lines 813 - 822, Update the
disconnect success path in the provider flow to also call
trpcUtils.processing.status.invalidate() alongside the existing sync.providers
and sync.providerStats invalidations, before router.back().
🤖 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/app/`(tabs)/recovery.tsx:
- Line 184: Add processing status invalidation to the pull-to-refresh handlers:
update packages/mobile/app/(tabs)/recovery.tsx at lines 184-184 to call
utils.processing.status.invalidate() alongside
utils.mobileDashboard.recovery.invalidate(), and
packages/mobile/app/(tabs)/strain.tsx at lines 186-186 to call it alongside
utils.mobileDashboard.training.invalidate().

In `@packages/mobile/components/ProcessingStatusWidget.test.tsx`:
- Line 47: Remove the unnecessary “as const” assertion from the ready fixture in
ProcessingStatusWidget tests, and type the ready object using the existing
snapshot fixture contract so overallStatus remains type-checked without
bypassing the compiler.

In `@packages/mobile/components/ProcessingStatusWidget.tsx`:
- Around line 72-80: Update the error branch in ProcessingStatusWidget so it
renders the full unavailable state only when data is absent; when cached data
exists, keep rendering that snapshot and surface the refetch error
non-blockingly without replacing the status. Preserve the server-provided
error.message and retain the existing ready/alwaysVisible visibility behavior.
- Line 71: Replace the early null return in ProcessingStatusWidget’s initial
loading branch with the component’s explicit loading UI, so loading && !data
renders a visible state. In
packages/mobile/components/ProcessingStatusWidget.stories.tsx at lines 63-63,
retain the existing loading scenario unchanged to verify that rendered state.

---

Outside diff comments:
In `@packages/mobile/app/providers/`[id].tsx:
- Around line 813-822: Update the disconnect success path in the provider flow
to also call trpcUtils.processing.status.invalidate() alongside the existing
sync.providers and sync.providerStats invalidations, before router.back().
🪄 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: d736ac4b-d463-4ef9-b00d-f921f249597d

📥 Commits

Reviewing files that changed from the base of the PR and between a87b099 and 1764b3b.

📒 Files selected for processing (27)
  • packages/mobile/app/(tabs)/activities.test.tsx
  • packages/mobile/app/(tabs)/activities.tsx
  • packages/mobile/app/(tabs)/index.test.tsx
  • packages/mobile/app/(tabs)/index.tsx
  • packages/mobile/app/(tabs)/recovery.test.tsx
  • packages/mobile/app/(tabs)/recovery.tsx
  • packages/mobile/app/(tabs)/strain.test.tsx
  • packages/mobile/app/(tabs)/strain.tsx
  • packages/mobile/app/_layout.cleanup.test.tsx
  • packages/mobile/app/providers/[id].test.tsx
  • packages/mobile/app/providers/[id].tsx
  • packages/mobile/app/providers/index.test.tsx
  • packages/mobile/app/providers/index.tsx
  • packages/mobile/app/providers/provider-data-delete-control.tsx
  • packages/mobile/app/sleep.tsx
  • packages/mobile/components/DataReadinessBanner.stories.tsx
  • packages/mobile/components/DataReadinessBanner.test.tsx
  • packages/mobile/components/DataReadinessBanner.tsx
  • packages/mobile/components/ProcessingStatusWidget.stories.tsx
  • packages/mobile/components/ProcessingStatusWidget.test.tsx
  • packages/mobile/components/ProcessingStatusWidget.tsx
  • packages/mobile/lib/query-client.test.ts
  • packages/mobile/lib/trpc-fetch.test.ts
  • packages/mobile/lib/useAutoSync.test.ts
  • packages/mobile/lib/useAutoSync.ts
  • packages/mobile/lib/useProcessingStatus.ts
  • packages/mobile/lib/useRefresh.test.ts
💤 Files with no reviewable changes (3)
  • packages/mobile/components/DataReadinessBanner.tsx
  • packages/mobile/components/DataReadinessBanner.stories.tsx
  • packages/mobile/components/DataReadinessBanner.test.tsx

Comment thread packages/mobile/app/(tabs)/recovery.tsx
Comment thread packages/mobile/components/ProcessingStatusWidget.test.tsx Outdated
Comment thread packages/mobile/components/ProcessingStatusWidget.tsx
Comment thread packages/mobile/components/ProcessingStatusWidget.tsx Outdated
@codereviewbot-ai

codereviewbot-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown

LGTM! The refactoring from DataReadinessBanner (sync.dataHealth) to ProcessingStatusWidget (processing.status) across the mobile app and test suites is clean, well-structured, and consistent. Existing comments already capture all edge cases in the status hook and widget.


🤖 Reviewed by codereviewbot.ai - Catch bugs before your team does.

@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.

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.

2 participants