Phase 2 tests the data flow between agents and verifies that the correct payload shape is passed at each handoff. All tests run in sandbox. IDs continue from T15.
ID
Scenario
Input
Expected Output
Pass Criteria
T15
Handoff: Document Gap Detector to Receipt Collection Coordinator
Document Gap Detector produces a valid gap list with 8 entries in the expected JSON schema
Receipt Collection Coordinator receives the payload, parses all 8 entries, and begins the email send sequence
Coordinator log shows 8 items ingested; email sequence triggered within 10 seconds of gap list write; no schema validation errors
T16
Handoff: Receipt Collection Coordinator to Package Builder (all matched)
Coordinator matched log shows 100% match rate; bookkeeper confirmation trigger fires
Package Builder receives the matched log and file manifest; begins Drive assembly immediately
Package Builder log shows file_manifest received with correct item count; Drive assembly starts within 15 seconds; no manual intervention logged
T17
Handoff: Receipt Collection Coordinator to Package Builder (with exceptions resolved)
Coordinator matched log has 2 items marked as manually_resolved by bookkeeper; remainder auto-matched
Package Builder includes manually resolved items in the package without treating them as errors
Drive package contains all items including the 2 manually resolved ones; package checklist shows manual_resolution: true for those entries; no items silently excluded
T18
Gap list payload schema mismatch
Document Gap Detector emits a gap list with a missing required field (transaction_ref omitted from one entry)
Receipt Collection Coordinator rejects the malformed entry, logs a schema error, and continues processing the valid entries
Schema error log contains the malformed entry index and the missing field name; valid entries processed normally; malformed entry escalated to Slack
T19
Slack notification delivery across all three agents
Run the full sandbox workflow end-to-end with one exception item
Three distinct Slack messages delivered: exception alert from Coordinator, package-ready notification from Package Builder, and a run-complete summary
Slack test workspace shows exactly 3 messages in the correct channels; each message contains the correct run_id reference; no duplicate messages
T20
QuickBooks rate limit hit during export
Simulate a 429 Too Many Requests response from the QuickBooks API during the report pull
Automation applies exponential backoff (30s, 60s, 120s) and retries up to 3 times before halting and alerting
Retry log shows 3 attempts with correct intervals; after third failure, run halts and monitoring alert contains the rate-limit error detail and run_id
T21
Hubdoc service temporarily unavailable
Hubdoc API returns 503 during receipt processing
Agent queues the affected receipts for retry; retries after 10 minutes; if still unavailable, escalates to Slack
Queue log shows affected receipt IDs; retry fires after 600 seconds; Slack escalation includes service_name: Hubdoc and affected_receipt_count
T22
DocuSign envelope completed but Slack notification fails
DocuSign webhook fires envelope_completed event; Slack API returns 500 on notification attempt
Slack failure is logged; DocuSign envelope status is not affected; retry of Slack notification attempted after 2 minutes
DocuSign envelope remains in completed state; Slack retry fires after 120 seconds; if retry succeeds, delayed notification delivered; error log records the original failure
Edge case tests cover scenarios outside the normal workflow path. These must all resolve to a recoverable or correctly flagged state. No edge case should produce a silent failure.
ID
Scenario
Input
Expected Output
Pass Criteria
E01
Duplicate run triggered for the same tax period
Workflow triggered twice for the same period identifier within the same day
Second trigger detected as a duplicate; run not started; de-duplication log entry created; alert sent to monitoring channel
Only one active run_id exists for the period; de-duplication log contains both trigger timestamps; monitoring alert references the duplicate trigger source
E02
Employee email address missing from QuickBooks record
Gap list contains an entry where the employee record has no email_address field
Entry skipped for email send; logged as undeliverable; Slack alert lists the employee name and transaction_ref for manual contact
Email send queue does not include the entry; undeliverable_log count incremented; Slack alert contains employee_name and transaction_ref
E03
Receipt amount in Hubdoc does not match QuickBooks transaction amount (tolerance exceeded)
Hubdoc extracts $124.50 from a receipt; QuickBooks transaction amount is $142.00 (delta exceeds 5% threshold)
Item flagged as amount_mismatch; not added to matched log; Slack exception alert includes both amounts and transaction_ref
Matched log excludes the item; exception log entry contains hubdoc_amount, qb_amount, and delta_percent fields; Slack alert delivered with both values
E04
Google Drive storage quota exceeded during package assembly
Drive API returns a 403 storageQuotaExceeded error during file upload
Assembly halts; error logged with file name and Drive folder path; Slack alert sent to Finance Manager with remediation instruction
No partial package written beyond the point of failure; error log contains the Drive folder path and the file that triggered the quota error; Slack alert includes a link to Drive storage settings
E05
Bookkeeper does not confirm exception resolution within the configured timeout (72 hours)
Slack exception alert posted; no bookkeeper response or manual confirmation received after 72 hours
Escalation alert sent to Finance Manager (TR) with the open exception count and a link to the Slack thread; run remains paused
Escalation fires at exactly the 72-hour mark; escalation message addressed to Finance Manager role; run status remains paused, not cancelled
E06
Receipt file type not supported by Hubdoc (e.g. HEIC or TIFF)
Employee submits a receipt image in HEIC format; Hubdoc returns an unsupported media type error
File rejected from OCR pipeline; logged with file extension and sender; Slack alert prompts the employee to resubmit in a supported format (JPEG or PDF)
Hubdoc queue does not include the rejected file; log entry contains file_extension: heic and sender_email; Slack message references the correct supported formats
E07
DocuSign approver email address invalid or bounced
Package Builder dispatches DocuSign envelope to a configured approver address that returns a delivery failure
DocuSign envelope voided or held; error logged with recipient address; Slack alert to Finance Manager with instruction to update the approver address
DocuSign account shows envelope in voided or error state; log entry contains recipient_email and bounce_reason; Slack alert delivered to Finance Manager within 5 minutes