Skip to content

URS-031 · Record all transactions with timestamps and user IDs

Status: FAIL  ·  Duration: 59s  ·  Run Date: April 21, 2026


SKIP

Step 1: Logged in as Bob Kauffman


SKIP

Step 2: First order

Step 2: First order

Step 2: First order

Step 2: First order

Step 2: First order


FAIL

Bill-only orders recorded with user ID + timestamp

Section titled “Bill-only orders recorded with user ID + timestamp”
FAIL

At least two billing_orders created by Bob in the test window, each with created_by_user_id and created_at populated

SELECT id, order_number, status, created_by_user_id, created_at
FROM billing_orders
WHERE created_by_user_id = $1
AND created_at > NOW() - INTERVAL '30 minutes'
ORDER BY created_at ASC
idorder_numberstatuscreated_by_user_idcreated_at
019dadea-e361-757f-b22c-3d61e95c00bdBO-1submitted17b8c9d0-e1f2-3456-1234-5678901234562026-04-21T02:42:25.231Z

Inventory transactions recorded with timestamp

Section titled “Inventory transactions recorded with timestamp”
PASS

inventory_transactions rows exist for the bill-only orders, each with a non-null created_at

SELECT id, source_type, source_id, created_at,
distributor_organization_id, manufacturer_organization_id
FROM inventory_transactions
WHERE source_type = 'bill_only_order'
AND created_at > NOW() - INTERVAL '30 minutes'
AND (distributor_organization_id = $1 OR manufacturer_organization_id = $1)
ORDER BY created_at ASC
idsource_typesource_idcreated_atdistributor_organization_idmanufacturer_organization_id
019dadea-e365-7b6f-a788-441b1e159b1ebill_only_order019dadea-e361-757f-b22c-3d61e95c00bd2026-04-21T02:42:25.231Zb2c3d4e5-f6a7-8901-bcde-f12345678901

Inventory history records each change with a timestamp

Section titled “Inventory history records each change with a timestamp”
PASS

inventory_history contains bill_only_order rows in the test window, each with created_at populated

SELECT ih.id, ih.item_id, ih.quantity, ih.info, ih.created_at
FROM inventory_history ih
WHERE ih.created_at > NOW() - INTERVAL '30 minutes'
AND ih.info->>'reason' = 'bill_only_order'
ORDER BY ih.created_at ASC
LIMIT 20
iditem_idquantityinfocreated_at
019dadea-e367-77ae-a907-cacf834306214ec9562d-982c-4070-ac02-c2336e26f4602[object Object]2026-04-21T02:42:25.231Z
019dadea-e367-77ae-a907-cad0e98a8b8e3ec46943-c392-433d-b94f-adab3c6492d53[object Object]2026-04-21T02:42:25.231Z

Audit events recorded with user ID + timestamp

Section titled “Audit events recorded with user ID + timestamp”
PASS

At least one audit_events row in the test window has both user_id and created_at populated, and no row is missing created_at

SELECT id, organization_id, user_id, event_type, action,
object_id, created_at
FROM audit_events
WHERE created_at > NOW() - INTERVAL '30 minutes'
AND organization_id IN ($1, $2)
ORDER BY created_at ASC
LIMIT 50
idorganization_iduser_idevent_typeactionobject_idcreated_at
019dadea-78ec-7b0e-aff5-fa705b60f155b2c3d4e5-f6a7-8901-bcde-f1234567890117b8c9d0-e1f2-3456-1234-567890123456user_loguser:login2026-04-21T02:41:58.003Z
019dadea-8846-7c27-8026-640c22969902b2c3d4e5-f6a7-8901-bcde-f1234567890117b8c9d0-e1f2-3456-1234-567890123456user_loguser:login2026-04-21T02:42:01.930Z
019dadea-e369-75b7-a60a-af4ca1040492a1b2c3d4-e5f6-7890-abcd-ef123456789017b8c9d0-e1f2-3456-1234-567890123456decisionbill_only_order.enqueue_upload_classification019dadea-e361-757f-b22c-3d61e95c00bd2026-04-21T02:42:25.231Z
019dadea-fad5-7669-bfe3-c846ff5e3d1cb2c3d4e5-f6a7-8901-bcde-f1234567890117b8c9d0-e1f2-3456-1234-567890123456user_loguser:login2026-04-21T02:42:31.257Z

Returns have created_by_user_id + created_at populated

Section titled “Returns have created_by_user_id + created_at populated”
PASS

All pre-seeded returns (and any created during the test) have non-null created_by_user_id and created_at

SELECT r.id, r.return_number, r.status, r.created_by_user_id,
r.created_at, u.email AS created_by_email
FROM returns r
LEFT JOIN users u ON u.id = r.created_by_user_id
WHERE r.return_number = ANY($1)
OR r.created_at > NOW() - INTERVAL '30 minutes'
ORDER BY r.created_at ASC
idreturn_numberstatuscreated_by_user_idcreated_atcreated_by_email
ca000003-0000-4000-8000-000000000003ZRI-RET-2025-003submitted17b8c9d0-e1f2-3456-1234-5678901234562026-03-22T02:18:14.976Zbob.kauffman@stellartech.com
ca000002-0000-4000-8000-000000000002ZRI-RET-2025-002submitted28c9d0e1-f2a3-4567-2345-6789012345672026-04-07T02:18:14.976Zryan.delauintana@stellartech.com
ca000001-0000-4000-8000-000000000001ZRI-RET-2025-001submitted17b8c9d0-e1f2-3456-1234-5678901234562026-04-18T02:18:14.976Zbob.kauffman@stellartech.com

Inventory transactions timestamped at or after their triggering order

Section titled “Inventory transactions timestamped at or after their triggering order”
PASS

For every bill-only order in the test window, the earliest inventory_transaction linked to it has created_at >= billing_order.created_at

SELECT bo.order_number,
bo.created_at AS order_created_at,
MIN(it.created_at) AS first_txn_created_at
FROM billing_orders bo
JOIN inventory_transactions it
ON it.source_type = 'bill_only_order'
AND it.source_id = bo.id
WHERE bo.created_by_user_id = $1
AND bo.created_at > NOW() - INTERVAL '30 minutes'
GROUP BY bo.id, bo.order_number, bo.created_at
order_numberorder_created_atfirst_txn_created_at
BO-12026-04-21T02:42:25.231Z2026-04-21T02:42:25.231Z

Multiple distinct users represented across transactions

Section titled “Multiple distinct users represented across transactions”
PASS

The combined transaction set (orders, returns, audit events) contains at least two distinct user IDs

SELECT DISTINCT user_id FROM (
SELECT created_by_user_id AS user_id FROM billing_orders
WHERE created_at > NOW() - INTERVAL '30 minutes'
AND created_by_user_id IS NOT NULL
UNION
SELECT created_by_user_id AS user_id FROM returns
WHERE return_number = ANY($1)
UNION
SELECT user_id FROM audit_events
WHERE created_at > NOW() - INTERVAL '30 minutes'
AND user_id IS NOT NULL
) u
ORDER BY user_id
user_id
17b8c9d0-e1f2-3456-1234-567890123456
28c9d0e1-f2a3-4567-2345-678901234567