Skip to content

URS-003 · Audit Log Tracking of All User Actions

Title: Audit Log Tracking of All User Actions Date: 2026-09-29T02:31:01.549Z Duration: 52.0s Overall Status: ✅ PASS

The system shall record user actions related to data creation and modification.

Source: User_Requirement_Specifications_Vantis_DeviceFlow.xlsx — the run below proves the system meets this requirement.

Status: ✅ PASS

Each step below corresponds to one Playwright test that ran sequentially. Screenshots and video recordings provide visual evidence of the UI behaviour.

What this step proves:

The sales representative (Blair Bennett) authenticates using valid credentials. On successful login the client-side logEvent() helper writes a user_log row with action=user:login to the audit_events table. This is verified in the DB validation phase to confirm that every login event is captured regardless of user role.

Audit events generated by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

TimeTypeActionUserOrgPerformed
2026-09-29 02:31:08Zuser_loguser:loginblair.bennett@corvetasurgical.comCorveta Surgical Group—
2026-09-29 02:31:14Zuser_loguser:loginblair.bennett@corvetasurgical.comCorveta Surgical Group—
2026-09-29 02:31:34Zuser_loguser:loginblair.bennett@corvetasurgical.comCorveta Surgical Group—
2026-09-29 02:31:51Zuser_loguser:logindan.distributor@corvetasurgical.comCorveta Surgical Group—

Screenshots:

step 01 rep logged in

Video recording:


What this step proves:

The rep navigates through the four-step order request wizard and submits a consignment order. The createOrderRequest service function calls logDecision with action=order_request_created and performed=true immediately after the INSERT, writing a synchronous audit row that proves the creation event. A separate decision:auto_approve_order row is written later by a delayed Restate handler once the ORDER_REQUEST_SUBMISSION_DELAY_MS grace window expires, and is therefore out of scope for this test’s observation window.

Audit events generated by this step:

(Evidence scoped to step execution window: 2026-09-29T02:31:23.323Z → 2026-09-29T02:31:30.735Z)

TimeTypeActionUserOrgPerformed
2026-09-29 02:31:29Zchecklistchecklists.createblair.bennett@corvetasurgical.comVantis—
2026-09-29 02:31:29Zdecisionrepresentatives.gate_rep_actionblair.bennett@corvetasurgical.comVantisno
2026-09-29 02:31:29Zdecisionorder_request_createdblair.bennett@corvetasurgical.comVantisyes

Screenshots:

step 02 order step2 account selected

step 02 order step3 products

step 02 order step4 review

step 02 order submitted

Video recording:


What this step proves:

The rep opens the newly created order and edits a line item quantity during the submission grace period. The editOrderRequestItem service function calls logDecision with action=update_order_request_item and performed=true, writing a synchronous audit row immediately. This confirms that data-modification events within an order are captured inline at the point of change.

Audit events generated by this step:

(Evidence scoped to step execution window: 2026-09-29T02:31:41.005Z → 2026-09-29T02:31:48.293Z)

TimeTypeActionUserOrgPerformed
2026-09-29 02:31:44ZdecisionbasicErp.deriveSalesOrderblair.bennett@corvetasurgical.comVantisno
2026-09-29 02:31:44Zdecisionreevaluate_order_request_issuesblair.bennett@corvetasurgical.comVantisno
2026-09-29 02:31:44Zdecisionupdate_order_request_itemblair.bennett@corvetasurgical.comVantisyes

Screenshots:

step 03 order detail

step 03 edit dialog open

step 03 after edit

Video recording:


What this step proves:

The administrator (Dan Distributor) authenticates using valid credentials. The login event writes a user_log row with action=user:login to audit_events, identically to the rep’s login in Step 1. This confirms that audit logging of authentication events is role-agnostic and applies uniformly to every authenticated user in the system.

Audit events generated by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

TimeTypeActionUserOrgPerformed
2026-09-29 02:31:08Zuser_loguser:loginblair.bennett@corvetasurgical.comCorveta Surgical Group—
2026-09-29 02:31:14Zuser_loguser:loginblair.bennett@corvetasurgical.comCorveta Surgical Group—
2026-09-29 02:31:34Zuser_loguser:loginblair.bennett@corvetasurgical.comCorveta Surgical Group—
2026-09-29 02:31:51Zuser_loguser:logindan.distributor@corvetasurgical.comCorveta Surgical Group—

Screenshots:

step 04 admin logged in

Video recording:


The following SQL queries ran against the application database after the Playwright scenarios completed. Each query asserts a specific condition that proves the feature under test persisted its data correctly.

audit_events table has the expected schema — ✅ PASS

Section titled “audit_events table has the expected schema — ✅ PASS”

Assertion: Table public.audit_events should expose at least: id, organization_id, user_id, event_type, action, object_id, payload, created_at

SELECT column_name
FROM information_schema.columns
WHERE table_schema = 'public' AND table_name = 'audit_events'
column_name
id
organization_id
user_id
contact_id
event_type
action
object_id
secondary_object_id
payload
route
trace_id
created_at
url

rep login was audited (Blair) — ✅ PASS

Section titled “rep login was audited (Blair) — ✅ PASS”

Assertion: Blair logging in should produce at least one user_log row with action=user:login.

SELECT id, action, event_type, user_id, organization_id, payload, created_at
FROM audit_events
WHERE created_at >= $1
AND user_id = $2
AND event_type = 'user_log'
AND action = 'user:login'
ORDER BY created_at ASC
idactionevent_typeuser_idorganization_idpayloadcreated_at
01a0eb00-69b3-729a-a779-23ec57bdf6d8user:loginuser_log17b8c9d0-e1f2-3456-1234-567890123456b2c3d4e5-f6a7-8901-bcde-f12345678901{"email":"blair.bennett@corvetasurgical.com"}2026-09-29T02:31:08.000Z
01a0eb00-83f3-7ccb-928f-65a5aa35f0fbuser:loginuser_log17b8c9d0-e1f2-3456-1234-567890123456b2c3d4e5-f6a7-8901-bcde-f12345678901{"email":"blair.bennett@corvetasurgical.com"}2026-09-29T02:31:14.717Z
01a0eb00-d320-7a17-8c1a-a82794cfda2fuser:loginuser_log17b8c9d0-e1f2-3456-1234-567890123456b2c3d4e5-f6a7-8901-bcde-f12345678901{"email":"blair.bennett@corvetasurgical.com"}2026-09-29T02:31:34.981Z

admin login was audited (Dan) — ✅ PASS

Section titled “admin login was audited (Dan) — ✅ PASS”

Assertion: Dan logging in should produce at least one user_log row with action=user:login.

SELECT id, action, event_type, user_id, organization_id, payload, created_at
FROM audit_events
WHERE created_at >= $1
AND user_id = $2
AND event_type = 'user_log'
AND action = 'user:login'
ORDER BY created_at ASC
idactionevent_typeuser_idorganization_idpayloadcreated_at
01a0eb01-14a9-7f7b-85f1-629d59a9ba4euser:loginuser_logc3d4e5f6-a7b8-9012-cdef-123456789012b2c3d4e5-f6a7-8901-bcde-f12345678901{"email":"dan.distributor@corvetasurgical.com"}2026-09-29T02:31:51.728Z

order_request_created decision was audited for Blair — ✅ PASS

Section titled “order_request_created decision was audited for Blair — ✅ PASS”

Assertion: Creating an order request should produce a decision audit_events row with action=order_request_created for the acting user.

SELECT id, action, event_type, user_id, object_id, payload, created_at
FROM audit_events
WHERE created_at >= $1
AND user_id = $2
AND event_type = 'decision'
AND action = 'order_request_created'
ORDER BY created_at DESC
idactionevent_typeuser_idobject_idpayloadcreated_at
01a0eb00-bca1-7007-9519-f3e6f3e4a1eborder_request_createddecision17b8c9d0-e1f2-3456-1234-56789012345601a0eb00-bc9e-7990-a771-926470fc82c9{"reason":"Order request OR-1 created (importSource=manual)","priority":"normal","itemCount":1,"orderType":"dropship","performed":true,"entityType":"order_request","importSource":"manual","requestNumber":"OR-1","selfFulfilled":false,"resolvedLocationId":"6ea3b4c5-d6e7-8901-6789-012345678901","resolvedSalesAccountId":"fea7b8c9-d0e1-2345-0123-456789012345","fulfillingOrganizationId":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","requestingOrganizationId":"b2c3d4e5-f6a7-8901-bcde-f12345678901"}2026-09-29T02:31:29.126Z

update_order_request_item decision was audited for Blair — ✅ PASS

Section titled “update_order_request_item decision was audited for Blair — ✅ PASS”

Assertion: Editing an order item should produce a decision audit_events row with action=update_order_request_item for the acting user.

SELECT id, action, event_type, user_id, object_id, payload, created_at
FROM audit_events
WHERE created_at >= $1
AND user_id = $2
AND event_type = 'decision'
AND action = 'update_order_request_item'
ORDER BY created_at DESC
idactionevent_typeuser_idobject_idpayloadcreated_at
01a0eb00-f892-7062-b8cb-7bd607390df9update_order_request_itemdecision17b8c9d0-e1f2-3456-1234-56789012345601a0eb00-bc9e-7990-a771-926470fc82c9{"reason":"Item quantity or notes updated during the submission grace period","performed":true,"entityType":"order_request"}2026-09-29T02:31:44.431Z

audit rows for Blair have required fields populated — ✅ PASS

Section titled “audit rows for Blair have required fields populated — ✅ PASS”

Assertion: Every audit_events row for Blair during the run should have non-null event_type and organization_id. (created_at is NOT NULL by schema constraint.)

SELECT id,
(event_type IS NULL) AS missing_event_type,
(organization_id IS NULL) AS missing_org
FROM audit_events
WHERE created_at >= $1
AND user_id = $2
AND (
event_type IS NULL OR
organization_id IS NULL
)

No rows returned

no audit rows leaked to other organizations (test actors only) — ✅ PASS

Section titled “no audit rows leaked to other organizations (test actors only) — ✅ PASS”

Assertion: Audit rows written during the run by the test actors (Blair, Dan, Rana) must belong to one of the demo organizations (Vantis or Corveta).

SELECT id, organization_id, user_id, event_type, action, created_at
FROM audit_events
WHERE created_at >= $1
AND user_id = ANY($2::uuid[])
AND organization_id <> ALL($3::uuid[])

No rows returned

Per-declaration outcome of every expectedAuditActions and expectedEmailTemplates entry written into the orchestrator. Missing evidence here is a real test failure, not a soft warning.

Each row asserts that a declared expectedAuditActions entry produced a matching row in audit_events. A ❌ flips overall status to FAIL — the declaration is real proof, not just an annotation.

StepExpected Audit ActionFound
Step 1: Rep loginuser_log:user:login✅
Step 2: Create orderdecision:order_request_created✅
Step 3: Edit order itemdecision:update_order_request_item✅
Step 4: Admin loginuser_log:user:login✅

Every row written to audit_events while this test was running (scoped to the demo organizations). Provides compliance evidence that user actions are traced end-to-end (URS-003).

Capture window start: 2026-09-29T02:30:59.718Z

SELECT
ae.created_at,
ae.event_type,
ae.action,
ae.user_id,
u.email AS user_email,
ae.organization_id,
o.name AS organization_name,
ae.object_id,
ae.secondary_object_id,
ae.payload,
ae.route,
ae.trace_id
FROM audit_events ae
LEFT JOIN users u ON u.id = ae.user_id
LEFT JOIN organizations o ON o.id = ae.organization_id
WHERE ae.created_at >= $1
AND ae.organization_id = ANY($2::uuid[])
ORDER BY ae.created_at ASC

10 event(s) captured:

TimeTypeActionUserOrgObject IDPerformedReason
2026-09-29 02:31:08Zuser_loguser:loginblair.bennett@corvetasurgical.comCorveta Surgical Group——
2026-09-29 02:31:14Zuser_loguser:loginblair.bennett@corvetasurgical.comCorveta Surgical Group——
2026-09-29 02:31:29Zchecklistchecklists.createblair.bennett@corvetasurgical.comVantis01a0eb00-bcb4-70ea-83c6-4248ed10d533—
2026-09-29 02:31:29Zdecisionrepresentatives.gate_rep_actionblair.bennett@corvetasurgical.comVantisa1b2c3d4-e5f6-7890-abcd-ef1234567890nono_blocking_relationship
2026-09-29 02:31:29Zdecisionorder_request_createdblair.bennett@corvetasurgical.comVantis01a0eb00-bc9e-7990-a771-926470fc82c9yesOrder request OR-1 created (importSource=manual)
2026-09-29 02:31:34Zuser_loguser:loginblair.bennett@corvetasurgical.comCorveta Surgical Group——
2026-09-29 02:31:44ZdecisionbasicErp.deriveSalesOrderblair.bennett@corvetasurgical.comVantis01a0eb00-bc9e-7990-a771-926470fc82c9noflag_disabled
2026-09-29 02:31:44Zdecisionreevaluate_order_request_issuesblair.bennett@corvetasurgical.comVantis01a0eb00-bc9e-7990-a771-926470fc82c9noOrder request issues were unchanged after an edit
2026-09-29 02:31:44Zdecisionupdate_order_request_itemblair.bennett@corvetasurgical.comVantis01a0eb00-bc9e-7990-a771-926470fc82c9yesItem quantity or notes updated during the submission grace period
2026-09-29 02:31:51Zuser_loguser:logindan.distributor@corvetasurgical.comCorveta Surgical Group——