Prevent Duplicate Records from Being Exported Twice
Duplicate exports are a critical financial risk. If the same approved expense claim is exported twice — due to a retry after a partial failure, a manual re-run, or a configuration error — it can result in double payments to peer mentors. The double-export guard maintains an export run registry that tracks which records were included in each export. Before any export, the system checks for records that have already been successfully exported and excludes them unless the admin explicitly requests a re-export with an override reason.
User Story
Acceptance Criteria
- Given a record was successfully exported in a previous sync, When the next scheduled sync runs, Then that record is not included in the new export batch
- Given an admin clicks 'Sync Now' after a partial failure, When the sync runs, Then only records not previously exported successfully are included, not the entire date range
- Given an admin needs to re-export a specific record due to a system error on the accounting side, When they click 'Force Re-export', Then they must enter a reason and confirm the action, and the re-export is logged in the audit trail
- Given I view the export history, When I expand a completed export run, Then I see the list of record IDs exported, the external system's acknowledgement ID, and whether any records were skipped as duplicates
- Given two admins simultaneously trigger a manual sync, When both syncs run concurrently, Then the system's locking mechanism ensures only one sync runs at a time and the second is queued or rejected with an informative message
- Given an export run is in progress, When I navigate to the integration dashboard, Then I see a progress indicator showing records processed vs total and an estimated completion time
Business Value
A single duplicate export incident can trigger hours of accounting investigation, correction journal entries, and potential overpayments that require recovery from peer mentors — causing relationship damage and administrative overhead. For HLF, which processes reimbursements monthly at significant volume, duplicate detection is a zero-tolerance requirement. The double-export guard directly prevents financial loss, maintains trust between the organization and its peer mentor network, and satisfies the audit trail requirements of public grant recipients.
Components
- Double-Export Guard service
- Export Run Repository data
- Approved Claims Query Service data
- Accounting Exporter Service service
- Integration Edge Functions infrastructure
- Organization Integration Repository data