critical priority low complexity backend pending backend specialist Tier 0

Acceptance Criteria

DuplicateCheckRequest model is defined as an immutable Dart class with fields: peer_mentor_id (String, non-null), date (DateTime, non-null), activity_type_id (String, non-null)
DuplicateConflictResult model contains: original_submitter_id (String), submission_timestamp (DateTime), conflicting_record_reference (String), conflict_type (enum), and is serializable to/from JSON
AttributionRecord model contains: registered_by (String, non-null), attributed_to (String, non-null), activity_id (String), created_at (DateTime) with full JSON serialization
ProxyAuditQueryFilter model supports date range filtering (from/to), coordinator_id filter, and mentor_id filter — all fields nullable for flexible querying
Abstract interface IDuplicateDetectionService is declared with at minimum: checkDuplicate(DuplicateCheckRequest) and checkDuplicateBatch(List<DuplicateCheckRequest>) method signatures
Abstract interface IActivityAttributionService is declared with at minimum: enforceAttribution(AttributionRecord), enforceAttributionBatch(List<AttributionRecord>), getProxyRegisteredByCoordinator, and getSelfRegisteredByMentor method signatures
AttributionValidationError is defined as a typed exception class with fields: field_name, reason, and record_reference
All models are fully equatable (using Equatable or operator==) for BLoC state comparison
All DTOs have copyWith methods for immutable updates
Unit tests exist confirming JSON round-trip serialization for every model

Technical Requirements

frameworks
Flutter
Dart
BLoC
Riverpod
data models
ActivityRecord
ProxyActivityEntry
CoordinatorUser
PeerMentor
performance requirements
Models must be lightweight value objects with no async operations
JSON serialization must be synchronous and complete in under 1ms per record
security requirements
No sensitive PII (names, addresses) stored in conflict metadata — use only user IDs and record references
Models must not expose raw database row identifiers beyond opaque string references

Execution Context

Execution Tier
Tier 0

Tier 0 - 440 tasks

Dependents (28)
epic-proxy-activity-registration-orchestration-task-001 component Cross-Epic Component proxy-registration-service depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-orchestration-task-002 component Cross-Epic Component proxy-registration-service depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-orchestration-task-003 component Cross-Epic Component proxy-registration-service depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-orchestration-task-004 component Cross-Epic Component proxy-registration-service depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-orchestration-task-005 component Cross-Epic Component proxy-registration-service depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-orchestration-task-006 component Cross-Epic Component bulk-registration-service depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-orchestration-task-007 component Cross-Epic Component bulk-registration-service depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-orchestration-task-008 component Cross-Epic Component bulk-registration-service depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-orchestration-task-009 component Cross-Epic Component bulk-registration-service depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-orchestration-task-010 component Cross-Epic Component proxy-registration-service depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-orchestration-task-011 component Cross-Epic Component bulk-registration-service depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-001 component Cross-Epic Component bulk-participant-list depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-002 component Cross-Epic Component bulk-participant-list depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-003 component Cross-Epic Component bulk-participant-list depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-004 component Cross-Epic Component duplicate-warning-dialog depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-005 component Cross-Epic Component duplicate-warning-dialog depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-006 component Cross-Epic Component duplicate-warning-dialog depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-007 component Cross-Epic Component proxy-peer-mentor-selector depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-008 component Cross-Epic Component proxy-peer-mentor-selector depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-009 component Cross-Epic Component proxy-peer-mentor-selector depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-010 component Cross-Epic Component proxy-activity-form depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-011 component Cross-Epic Component proxy-activity-form depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-012 component Cross-Epic Component proxy-registration-screen depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-013 component Cross-Epic Component proxy-registration-screen depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-014 component Cross-Epic Component proxy-registration-screen depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-015 component Cross-Epic Component bulk-registration-screen depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-016 component Cross-Epic Component bulk-registration-screen depends on proxy-duplicate-detection-service
epic-proxy-activity-registration-ui-task-017 component Cross-Epic Component bulk-registration-screen depends on proxy-duplicate-detection-service

Implementation Notes

Place all interfaces and DTOs under lib/domain/proxy/ in a flat structure: duplicate_check_request.dart, duplicate_conflict_result.dart, attribution_record.dart, proxy_audit_query_filter.dart, i_duplicate_detection_service.dart, i_activity_attribution_service.dart, attribution_validation_error.dart. Use freezed or manual immutable classes — if using freezed, ensure build_runner is already configured in the project. Do NOT couple these models to Supabase types at this layer; keep them pure domain objects. The composite key (peer_mentor_id, date, activity_type_id) should be encapsulated as a value object to avoid parameter ordering errors in batch calls.

ConflictType enum should at minimum include: exact_match, same_day_same_type, overlapping_time_window.

Testing Requirements

Unit tests using flutter_test for all models: JSON serialization round-trip, copyWith correctness, Equatable equality checks, and null-safety boundary conditions. Test that AttributionValidationError carries correct field metadata. No integration or widget tests required at this layer — pure Dart unit tests only. Minimum 90% line coverage on all model files.

Component
Proxy Duplicate Detection Service
service medium
Epic Risks (2)
medium impact medium prob scope

Overly strict duplicate matching (exact date + type) may flag legitimate back-to-back sessions of the same activity type on the same day as duplicates, frustrating coordinators and undermining trust in the feature.

Mitigation & Contingency

Mitigation: Confirm with product owners whether the matching key should be (mentor_id, date, activity_type_id) only or should also consider duration and time-of-day. Document the chosen threshold in the service and surface it in the duplicate warning dialog for transparency.

Contingency: If false-positive rates are high in user testing, add a duration-window tolerance parameter to the detection query that can be tuned without code changes.

high impact low prob security

If the current session token is invalidated between the coordinator starting the proxy form and submitting it, the activity-attribution-service may fail to resolve the coordinator's user ID, causing a silent attribution error.

Mitigation & Contingency

Mitigation: Read the coordinator's user ID from the session at service call time rather than at form-open time. Validate the session is still active before committing the insert, and surface a clear re-authentication prompt if it has expired.

Contingency: If a mis-attributed record is detected post-submission, the audit log retains the original session metadata, allowing a corrective record to be created with accurate attribution.