Add partial failure surfacing to BulkApprovalProcessor
epic-expense-approval-workflow-bulk-and-action-task-003 — Extend BulkApprovalProcessor to collect and surface failed individual records within a batch without aborting the remaining batch. Build the aggregation logic that produces a structured report of which claim IDs succeeded, which failed, and why, so the coordinator UI can present actionable feedback.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 2 - 518 tasks
Can start after Tier 1 completes
Implementation Notes
Implement the Stream using a StreamController
Avoid exposing the StreamController outside the service — return a Stream
Testing Requirements
Unit tests: (1) hasPartialFailure/isCompleteFailure/isCompleteSuccess getters for all three states, (2) failedRecords ordering matches input ordering, (3) retryFailedRecords() only processes isRetryable=true records from the previous result, (4) Stream
If a bulk approval batch partially fails (some claims approved, some failed), the UI must communicate which specific claims failed without overwhelming the coordinator. A poorly designed error display could cause coordinators to re-approve already-approved claims or miss claims that still need attention.
Mitigation & Contingency
Mitigation: Design the BulkApprovalResult display to show a clear summary (e.g., '14 approved, 2 failed') with a collapsible list of failed claims including their IDs and submitter names. Failed claims should remain selected in the queue so the coordinator can retry them individually.
Contingency: If the summary UI proves insufficient, add a dedicated 'bulk action history' sheet showing the last bulk operation result, accessible from the queue screen header.
If the app is backgrounded or the network drops while the coordinator has the ApprovalActionSheet open mid-decision, the typed comment could be lost and the transition state could be ambiguous, potentially causing a coordinator to believe they approved a claim that was never submitted.
Mitigation & Contingency
Mitigation: Persist the in-progress action sheet state (selected action + comment text) to a local draft store keyed on claim ID. On sheet re-open for the same claim, restore the draft. After confirmed submission, verify the resulting claim status from the server before dismissing the sheet.
Contingency: On network error during submission, display a persistent retry banner within the sheet rather than dismissing it, so the coordinator can resubmit without re-entering their comment.