carp-dk / carp-dk/carp_study_app

fix(consent): upload informed consent before marking accepted; surface and retry failures

Open
#629 0 comments 0 reactions 1 assignee Claimed by @Zeroupper View on GitHub
Dominant language
Dart
Stars
10
Forks
5
Avg merge
1d 3h
Merged PRs (30d)
14

Description

## Problem
(verified) `informedConsentHasBeenAccepted` persists the local accepted-flag *before* awaiting upload (`lib/blocs/app_bloc.dart:399-407`), and `uploadInformedConsent` catches the upload exception, logs a release-invisible warning, and **returns the consent object as if it succeeded** (`lib/data/carp_backend.dart:223-238`). A signed consent can be permanently lost while the app believes it was filed — for an mHealth study that is a compliance incident, not a bug.

## Proposed fix
Make upload failure propagate (return null/throw); persist the signed `RPTaskResult` locally as "pending" and retry on connectivity restoration/app start; only treat consent as filed when CAWS confirms (the backend check at `app_bloc.dart:379-394` already exists for the read side). Land inside the ConsentService from #593.

## Acceptance criteria
- [ ] Airplane-mode consent flow → visible "will sync" state → automatic upload on reconnect (integration test against the test server)
- [ ] Failure path unit-tested
- [ ] No path returns success on a failed upload

**Effort:** M · **Priority:** P0 · **Change risk:** Medium (onboarding-critical path; needs the #599 flow tests as a safety net)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.