Phase 2 verifies that agents pass data correctly to one another and that the full chain from Xero trigger to Google Sheets output completes without loss or corruption. Integration test IDs continue from T15. Edge case tests use a separate E-series sequence covering scenarios that cross agent boundaries or involve external tool failure.
ID
Scenario
Input
Expected Output
Pass Criteria
T15
Full handoff: Data Collection Agent to Scoring Agent
Xero sandbox webhook triggers Data Collection Agent; output record written to Airtable test base
Scoring Agent detects the new Airtable record within its polling interval, reads all required fields, and produces a score without manual intervention
Scoring Agent execution log shows trigger from Airtable record creation. Score written within 2 minutes of Data Collection Agent completion. No field mapping errors.
T16
Full handoff: Scoring Agent to Escalation Agent (flagged path)
Scoring Agent writes status = flagged to Airtable test record
Escalation and Reporting Agent triggers within its polling interval, sends Slack alert to test channel, creates Gmail draft
Escalation Agent log shows trigger from flagged status. Slack message and Gmail draft both created. End-to-end elapsed time under 5 minutes.
T17
Full handoff: Scoring Agent to Google Sheets (clear path, no escalation)
Scoring Agent writes status = clear to Airtable test record
Google Sheets scorecard row updated with new score and clear status. No Slack alert sent. No Gmail draft created.
Sheets row updated. Slack and Gmail actions not triggered. Escalation Agent log confirms no-escalation branch taken.
T18
Month-end report: full chain from Airtable to Google Sheets
Cron trigger fires in sandbox; Airtable test base has 8 vendor records with mixed statuses across simulated month
Report appended to Google Sheets with correct vendor count, accurate aggregate scores, and flag summary
8 vendor rows in report. Aggregate scores match Airtable data. Flag count matches records with status = flagged. Report appended to correct tab, not overwritten.
T19
Manager approval gate: email held until approval received
Flagged vendor triggers Gmail draft creation; no approval action taken for 10 minutes in test environment
Email remains in draft state. No send action executed. Slack alert remains visible. System does not auto-send after timeout.
Gmail draft status unchanged after 10 minutes. No sent mail in test Gmail sandbox. Approval gate confirmed as blocking.
T20
Manager approval gate: email sends after approval
Flagged vendor draft exists; approval flag set to true in test environment to simulate manager action
Gmail draft promoted to sent. Vendor email address in To field. Airtable record updated with email_sent = true and timestamp.
Email present in Gmail sandbox sent items. Airtable record email_sent = true. Timestamp within 60 seconds of approval flag set.
T21
Concurrent vendor events: two invoices arrive simultaneously
Two Xero sandbox webhook payloads fired within 2 seconds for different vendor IDs
Two separate Airtable records created. Each scored independently. No field data cross-contamination between records.
Two distinct Airtable records with correct vendor IDs. Scores independent. No shared field values. Both Google Sheets rows updated.
T22
Same vendor, multiple events in one month: rolling score accumulates correctly
Three sequential Airtable records for the same vendor_id created across simulated month (scores 85, 60, 55)
Rolling score reflects weighted average of all three events. Scorecard row shows downward trend. Flag triggers on third event when score crosses threshold.
Rolling score calculated correctly per scoring model. Flag status = flagged after third event. Historical score entries preserved in Airtable performance log.
Edge-case tests — IDs E01 through E06. These cases specifically target conditions outside the normal happy path that span multiple agents or involve external system failure.
ID
Scenario
Input
Expected Output
Pass Criteria
E01
Duplicate Xero event: same invoice webhook fires twice
Identical Xero webhook payload sent twice within 5 seconds (simulating Xero retry on network error)
Data Collection Agent detects duplicate via idempotency key check; second event discarded; only one Airtable record created
Airtable contains exactly one record for the invoice ID. Duplicate-detection log entry present. No duplicate score calculated.
E02
Missing vendor name in Xero payload
Xero webhook payload where vendor_name field is null or empty string
Agent logs a data-quality warning, writes record with vendor_name = UNKNOWN, does not halt; Slack alert (if triggered) includes UNKNOWN label with record link
Record written with vendor_name = UNKNOWN. Warning log present. Scoring proceeds. Slack alert (if applicable) contains UNKNOWN label and Airtable link.
E03
Airtable API unavailable during Scoring Agent write
Scoring Agent completes calculation but Airtable returns 503 for the write attempt
Agent retries up to 3 times with exponential backoff (2s, 4s, 8s), logs each attempt, and after final failure stores the scored payload in the automation platform's dead-letter queue
3 retry attempts logged with timestamps. Dead-letter queue entry present with full scored payload. No data silently discarded.
E04
Google Sheets scorecard tab deleted or renamed
Escalation Agent attempts to write to a Google Sheets tab that no longer exists (tab deleted by a user)
Agent logs a Sheets write error with the expected tab name, does not crash, raises a configuration alert to the monitoring channel
Error log contains expected tab name. Monitoring alert sent. Airtable record still updated. No unhandled exception.
E05
Ops manager does not respond to Slack approval prompt within 24 hours
Flagged vendor alert sent to Slack test channel; no approval or rejection action taken for simulated 24-hour window
Escalation Agent sends a single reminder Slack message after 24 hours. Email draft remains unsent. No further automated action taken after reminder.
Reminder Slack message sent exactly once after 24-hour window. Gmail draft remains in draft state. No third automated message sent.
E06
Scoring threshold environment variable changed mid-month
Threshold variable updated from 70 to 60 while 3 vendor records already scored this month under the old threshold
New events scored under the new threshold immediately. Historical records retain their original scores. No retroactive rescoring occurs. Change logged.
Events after variable change scored at threshold 60. Pre-change records unaltered. Configuration change log entry present with old and new values and timestamp.