Agent 1: Shipment Event Listener (estimated build time: 12 hours, complexity: Moderate)
ID
Scenario
Input
Expected Output
Pass Criteria
T01
Happy path: webhook fires with valid tracking number
ShipStation webhook payload: order_id=TEST001, status=Shipped, tracking_number=1Z999AA10123456784, carrier=UPS
Structured data object: customer_email, order_number, carrier_name=UPS, tracking_url=https://wwwapps.ups.com/tracking/tracking.cgi?tracknum=1Z999AA10123456784
All four fields populated; tracking URL correctly formed for UPS carrier; no errors logged.
T02
Happy path: polling mode detects new shipment
ShipStation poll returns one new order with status=Shipped and a FedEx tracking number
Same structured data object with carrier_name=FedEx and correct FedEx tracking URL prefix
URL prefix matches https://www.fedex.com/fedextrack/?trknbr= and tracking number appended correctly.
T03
Happy path: USPS carrier URL construction
ShipStation webhook: carrier=USPS, tracking_number=9400111899223397988523
tracking_url=https://tools.usps.com/go/TrackConfirmAction?tLabels=9400111899223397988523
USPS URL prefix used; no carrier mismatch error thrown.
T04
Shopify order fetch returns full record
Valid order_id passed to Shopify API after ShipStation trigger
Shopify order object returned with customer.email, order_number, first_name, last_name
All required fields present in response; HTTP 200 returned; no null fields.
T05
Tracking number is null at trigger time
ShipStation webhook: status=Shipped, tracking_number=null
Automation halts at trigger; no Shopify fetch attempted; error logged: 'Null tracking number — event skipped'
No downstream actions fire; error entry visible in the orchestration layer error log.
T06
ShipStation returns an unrecognised carrier code
webhook: carrier=DHL_EXPRESS_ASIA (not in carrier map)
Error logged: 'Unknown carrier code — tracking URL could not be formed'; agent halts and flags for manual review
No malformed URL is passed downstream; flag visible in error log; manual review queue receives the record.
T07
Shopify order fetch returns HTTP 404
order_id=MISSING999 passed to Shopify; Shopify returns 404
Retry attempted once after 30 seconds; on second 404, error logged and record routed to manual review
Retry logic executes exactly once; final error state logged; no unhandled exception thrown.
T08
Shopify API rate limit hit (HTTP 429)
Shopify returns 429 Too Many Requests on first call
Automation pauses for the Retry-After period specified in the response header, then retries successfully
Backoff delay applied; second call succeeds; no data loss; total delay logged.
T09
Order status is Shipped but tracking number is a duplicate of a previously processed order
tracking_number=1Z999AA10123456784 (same as T01, already processed)
Duplicate detected via Google Sheets log lookup; event skipped; log entry reads 'Duplicate tracking number — already notified'
No second Klaviyo email fired; existing log row unchanged; duplicate flag written to error log.
Agent 2: Notification Dispatch Agent (estimated build time: 10 hours, complexity: Moderate)
ID
Scenario
Input
Expected Output
Pass Criteria
T10
Happy path: Klaviyo transactional email fires successfully
Valid structured data object: customer_email=test@internal.com, order_number=ORD-1001, carrier_name=UPS, tracking_url=valid UPS URL, first_name=Test
Klaviyo API returns event_id; email queued for delivery; HTTP 200 confirmed
Klaviyo response contains a non-null event_id; no delivery error in Klaviyo activity feed.
T11
Google Sheets log row appended correctly
Same valid data object as T10 after successful Klaviyo send
New row written to designated sheet tab: order_id, customer_email, tracking_number, carrier, send_timestamp, status=Sent
Row appears in the correct tab; all six columns populated; timestamp is within 5 seconds of send time.
T12
Slack digest post fires correctly
Batch of 3 successful sends in the test session
Slack message posted to test channel: '3 tracking notifications sent in the last session. 0 failures.'
Message appears in the correct Slack channel within 60 seconds; count matches actual sends in the test run.
T13
Klaviyo API returns a 400 error (invalid template ID)
Structured data object with a misconfigured Klaviyo flow ID
Error logged: 'Klaviyo send failed — invalid flow ID'; Google Sheets row written with status=Failed; Slack message flags 1 failure
No retry on a 400; log row status=Failed; Slack failure count increments correctly.
T14
Google Sheets write fails due to permission error
Klaviyo send succeeds but Google Sheets service account lacks write permission
Error logged: 'Google Sheets write failed — permission denied'; Slack post still fires; error flagged in log
Klaviyo send is not rolled back; Slack still posts; permission error appears in error log without crashing the run.