Implement consent version management and re-consent flow
epic-geographic-peer-mentor-map-consent-privacy-task-009 — Add consent versioning to location-privacy-config and location-consent-service so that when an organisation updates its privacy policy or data processing agreement, mentors who previously consented under an older version are flagged as requiring re-consent. Implement the re-prompt trigger that shows the dialog again with a change-summary before the mentor can access map features.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 5 - 253 tasks
Can start after Tier 4 completes
Implementation Notes
Add consent_version (text) and requires_reconsent (boolean, default false) columns to consent_grants via a migration. Add consent_version (text) and change_summary (text) columns to location-privacy-config. Implement the version bump flow as an Edge Function updateConsentVersion(orgId, newVersion, changeSummary) that: (1) validates caller is org admin, (2) rejects if newVersion <= currentVersion (semver compare), (3) in a transaction: updates location-privacy-config.consent_version, then runs UPDATE consent_grants SET requires_reconsent = true WHERE org_id = $orgId AND consent_version != $newVersion. Extend ConsentStatusNotifier to expose a requiresReconsent state variant.
In the map feature guard widget, check both status == pending and requiresReconsent == true as triggers to show the dialog. Pass changeSummary from the ConsentStatusResponse into the dialog as an optional parameter. To avoid a separate API call for the change summary, include change_summary in the ConsentStatusResponse from task-008 when requires_reconsent is true.
Testing Requirements
Unit tests: mock location-privacy-config provider returning a new version, assert ConsentStatusNotifier transitions to requiresReconsent state, assert re-prompt dialog is shown. Test that Opt In during re-consent calls grantConsent with new version and clears requires_reconsent. Test that Opt Out during re-consent calls revokeConsent. Integration tests: create an org with 3 mentors who have consented under version 1.0.0, simulate admin updating to version 1.1.0, assert all 3 rows have requires_reconsent = true in the database.
Test version downgrade rejection. Test graceful degradation: make location-privacy-config unavailable and assert dialog still renders with generic text. Widget test: render LocationConsentDialog with changeSummary set and assert ChangeSummaryBanner is visible; render without changeSummary and assert banner is absent.
If the privacy policy text or consent terms change after mentors have already opted in, existing consent records may become legally insufficient, requiring re-consent from all opted-in mentors which could temporarily reduce map coverage.
Mitigation & Contingency
Mitigation: Store a consent_version field on every consent record. Implement a consent version check in location-consent-service that compares the stored version against the current policy version from location-privacy-config and flags stale consents for re-consent prompting.
Contingency: If a policy update invalidates existing consents, suppress affected mentors from the map, queue them for re-consent notification via the existing in-app notification system, and restore map visibility only after new consent is recorded.
A poorly designed consent dialog may lead to low opt-in rates, reducing map utility for coordinators to the point where the feature delivers insufficient value to justify maintenance cost.
Mitigation & Contingency
Mitigation: Follow plain-language writing guidelines from the cognitive accessibility feature. User-test the dialog with 2-3 peer mentors from Blindeforbundet before implementation is finalised. Ensure the dialog explains the benefit to the mentor, not just the data collection facts.
Contingency: If opt-in rate after launch is below 40%, conduct a targeted usability study and iterate on dialog copy and layout. The coordinator can also send a bulk opt-in invitation notification (per the user story) to non-consenting mentors.