Skip to content

STUDYU-95: fix(app): preserve offline study progress - #954

Open
johannesvedder wants to merge 2 commits into
fix/pr906-offline-completionfrom
fix/studyu-906-offline-safety
Open

johannesvedder wants to merge 2 commits into
fix/pr906-offline-completionfrom
fix/studyu-906-offline-safety

Conversation

@johannesvedder

@johannesvedder johannesvedder commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Description

Related Jira issue: STUDYU-95

Stack 1 of 3 · Base: #936

Offline progress could still be lost at study-end and recovery boundaries. Destructive actions could clear pending progress or media before synchronization, and deleted-subject startup recovery cleared local data before the participant could contact the researcher.

This PR:

  • preserves issued task progress when completion happens after the study schedule ends;
  • keeps offline questionnaire and media progress durable across reloads;
  • blocks quit, switch, delete, reset, and new-study actions until pending work synchronizes;
  • serializes destructive cleanup against active cache writes and synchronization;
  • routes deleted-subject startup failures to the existing recovery screen without clearing local results;
  • clears recovery data only after explicit participant confirmation.

This PR is stacked on #936. The next PR adds deferred Fitbit synchronization.

Testing Steps

  1. Complete ordinary and media tasks while the backend is unavailable and reload the app.
  2. Verify the cached completion and pending upload remain available.
  3. Attempt a destructive study action while synchronization fails and verify it remains blocked.
  4. Trigger deleted-subject recovery and verify local progress remains available before Reset App is confirmed.
  5. Automated verification completed:
    • focused app-state, cache synchronization, offline persistence, recovery-screen, and cleanup tests;
    • scripts/pre-commit-check;
    • git diff --check.

PR Checklist

  • I tested the changes and affected user flows.
  • I reviewed the full diff and checked for unintended changes.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e7f21c3d-0036-4b82-a9ed-7eb68b52f5d5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

936 - PR Code Verified

Compliant requirements:

  • Complete degraded task submissions through durable local cache persistence.
  • Keep cache retry separate from task completion and prevent duplicate retries.
  • Assign intervention identity to issued task completions.
  • Serialize cache operations and destructive cleanup against synchronization.
  • Coordinate authentication recovery and destructive actions with synchronization barriers.
  • Preserve synchronization retry after cleanup failures.

Requires further human verification:

  • Verify the complete offline completion, reload, reconnect, opt-out, and full-reset flows on supported mobile and web platforms.
  • Verify exactly-once remote synchronization against the production backend behavior.
  • Confirm the required offline task recording or video is attached to the pull request.

STUDYU-906 - PR Code Verified

Compliant requirements:

  • Preserve issued task intervention identity after the study schedule ends.
  • Persist offline questionnaire and media progress through the cache.
  • Block destructive cleanup while pending synchronization cannot complete.
  • Serialize cleanup against cache writes and synchronization.
  • Preserve local results during deleted-subject startup recovery.
  • Defer recovery-data deletion until participant confirmation.

Requires further human verification:

  • Verify quit and new-study actions, whose callers are not directly exercised by the shown tests.
  • Verify browser and mobile UI behavior, including recovery navigation and loading states.
  • Confirm the affected user flows were manually tested as required by the PR checklist.
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🏅 Score: 92
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit a6ff682):

(expires Sat, 05 Sep 2026 11:01:25 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 2149dad49ed83535217e50d5c18c0c8c90da629b

@johannesvedder johannesvedder changed the title STUDYU-906: fix(app): preserve offline study progress STUDYU-95: fix(app): preserve offline study progress Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant