event

HierarchyUpdatedByIngestion

Fired by the ingestion pipeline when manager changes are detected in crm_systemuser_history, to trigger downstream hierarchy recomputation.

Event

Event Overview

Published by notify_eventbridge_of_manager_changes() in main.py, and only while processing the crm_systemuser_history table. During that table’s run the pipeline pre-scans extracted rows and compares each user’s manager_source_id against the current RDS state; any user whose manager changed (excluding protected users) is collected. The changes are sorted top-down by hierarchy depth and published in batches of 1,000 per put_events call.

This is a business/integration event, distinct from the audit-event envelope used by the other events on this service. It uses a different EventBridge envelope:

  • DetailType: Hierarchy Updated
  • Event name (in payload): rio.user.hierarchy.updated
  • Source: rio.glue.crm_sync (note: different from the rio.platform audit source)
  • Bus: EVENT_BUS_NAME ({env}-rio-events), falling back to default
  • Batch size: 1,000 updates per event (EB_BATCH_SIZE)

Downstream

The event is consumed by the Identity & Hierarchy Service, whose ${DeployPrefix}-hierarchy-updates rule (rio-identity-service/infrastructure/lambda/template.yaml:168-179) matches:

source: [rio.glue.crm_sync, rio.api.hierarchy_change]
detail-type: [Hierarchy Updated]
detail.event_name: [rio.user.hierarchy.updated]

The target Lambda recomputes each affected user’s hierarchy_path and level_1_idlevel_10_id.

Because that rule also matches rio.api.hierarchy_change, the identity service’s own Hierarchy Updated (Variant B) lands in the same Lambda. A hierarchy change made through the API and one detected by this CRM sync are handled by identical code — which is why this event deliberately copies that payload shape rather than using this service’s usual audit envelope.

Payload Schema

Event-driven architecture documentation: RIO

JSON Schema

18 properties

Fired by the CRM sync when manager changes are detected in crm_systemuser_history. Shape from rio-ingestion-service/jobs/crm-data-sync/main.py:928-936. This is a business/integration event and does NOT use the rio.platform audit envelope used by this service's other events.

event_namestringconstant: rio.user.hierarchy.updated
required

Load-bearing. The identity service's rule matches on this exact value.

domainstringconstant: user
required
versionstringconstant: v1
required
actorobject
required

Who caused the change. Always the sync job itself.

contextobject
required
metadataobject
required
dataobject
required

The manager changes themselves, batched up to 1000 per event.