Phase 2 integration tests confirm that data flows correctly across agent boundaries and that the orchestration layer passes context without loss or corruption. All tests run in the sandbox environment with injected payloads. IDs continue from the Phase 1 sequence.
ID
Scenario
Input
Expected Output
Pass Criteria
T16
Bank Feed Sync to Matching Agent handoff
Bank Feed Sync Agent completes successfully and passes a 30-record normalised payload to the Matching Agent
Matching Agent receives all 30 records with no field truncation; processing begins within 5 seconds of the sync agent completing
Matching Agent input record count equals 30; no null amounts, dates, or references in the received payload
T17
Matching Agent to Notifications Agent handoff when no exceptions exist
Matching Agent completes with 30 confirmed matches and zero exceptions; triggers Notifications Agent
Notifications Agent receives a context object with matched_count: 30, exception_count: 0, and period label
Slack message and Gmail confirmation reflect the correct counts; Xero close step fires without waiting for an exceptions-resolved flag
T18
Matching Agent to Notifications Agent handoff when exceptions exist
Matching Agent completes with 25 confirmed matches and 5 exceptions; Notifications Agent should wait for human resolution
Notifications Agent fires the Slack alert immediately, then pauses the Xero close step pending the exceptions-resolved signal from Google Sheets
Xero close record is NOT written until the resolved flag is set; Slack message correctly shows exception_count: 5
T19
Full three-agent pipeline in sequence
Scheduled trigger fires; all three agents run in order with a 30-record dataset containing 2 exceptions
Plaid pull, normalisation, matching, exception logging, Slack alert, Gmail email, and Xero close all complete in a single run
Each agent's completion event is logged in sequence; total pipeline duration under 3 minutes; all expected outputs present
T20
Parallel run output matches manual reconciliation
Automation run against the same 3-month historical dataset used for manual reconciliation during the QA parallel run
Matched pairs, exception items, and closing balances produced by the automation match the manually prepared reconciliation outputs
Discrepancy rate between automation and manual output is zero for exact matches; any differences are investigated and documented before Phase 3
T21
Orchestration retry on transient Xero write failure
Xero sandbox returns a 503 on the first reconciliation write attempt mid-pipeline
Orchestration layer retries the write step twice, succeeds on the second retry, and the pipeline continues
Two retry events logged; reconciliation record written on retry; no duplicate records created in Xero
T22
Scheduling: no duplicate run if previous run is still active
Scheduled trigger fires while a previous run is still in progress (simulated by setting a long-running lock on the orchestration context)
New trigger is queued or skipped according to the configured concurrency policy; no duplicate data written
Only one active pipeline instance at any time; queue or skip event logged; no duplicate Xero postings
ID
Scenario
Input
Expected Output
Pass Criteria
E01
Duplicate transaction in bank feed
Plaid sandbox returns the same transaction ID twice in a single pull (simulating a known Plaid deduplication edge case)
Bank Feed Sync Agent deduplicates by transaction ID before passing the payload downstream; only one record written
Downstream payload contains one record for the duplicated transaction ID; deduplication event logged
E02
Missing amount field in bank transaction
One bank transaction in the Plaid payload has a null amount field
Agent rejects the malformed record, writes it to a dead-letter log with the transaction ID and error reason, and continues processing the remaining records
All other records processed normally; dead-letter log contains the rejected record with a 'null amount' error tag
E03
Missing reference field in bank transaction
One bank transaction has an empty reference/description string
Matching Agent falls back to amount-plus-date matching only for that record; if a match is found it is tagged as 'probable match' rather than 'confirmed'
Record appears in the exceptions sheet with status 'probable match' and a note indicating no reference was available for matching
E04
Xero API unavailable for the full run
Xero sandbox returns 503 on all calls throughout the test run
Bank Feed Sync Agent logs the failure after three retries, halts the pipeline, and sends an error alert to the FullSpec error channel; no data written anywhere
Error event logged with all retry attempts; Slack error alert sent; Google Sheets and Xero untouched; next scheduled run starts fresh
E05
Bookkeeper does not resolve exceptions within 48 hours
Exceptions sheet has unresolved rows 48 hours after the Slack alert was sent
A reminder Slack message is sent to the finance channel and a follow-up email is sent to the finance lead Gmail address
Reminder Slack message and Gmail email both sent; reminder event logged; Xero close step remains paused
E06
Bank feed covers a different date range to the Xero ledger pull
Plaid sandbox returns transactions for 1 May through 31 May; Xero demo is queried for 1 May through 28 May due to a date parameter bug
Agent detects the date range mismatch, logs a data integrity warning, and halts the matching step until the date parameters are reconciled
No matching attempted on mismatched ranges; data integrity warning logged with both date ranges; pipeline halted with descriptive error message