Skip to main content

Data Model: hbf-data-manager

Domain objects used by this service. Full schemas: docs/domain-model.md

Objects This Service Uses

ObjectHowKey fields accessed
ChatSessionreferenced by UUID only (no direct DB join)uuid stored as session_id in interaction_metadata

hbf-data-manager does not depend on hbf-core or hbf-core-api for data access. It receives ChatSession UUIDs embedded in Kafka event payloads published by hbf-bot, and stores them as opaque strings.

Local Entities

InteractionMetadata

Table: interaction_metadata Database: MySQL 8 — hbf_data_manager ORM: TypeORM 0.3 Source: src/interactions/interaction-metadata.entity.ts

ColumnTypeORM typeMySQL DDLNullableNotes
idbigint PKBIGINT AUTO_INCREMENTnoAuto-generated surrogate key
hbf_event_idchar(36)CHAR(36)noUUID of the HBF event (one event = one workflow execution)
session_idchar(36)CHAR(36)noChatSession.uuid from hbf-bot
tstimestampTIMESTAMP(6)noWhen the interaction occurred
typetextTEXTnoInteraction type (e.g. VARIABLE, NODE, LLM_REQUEST)
friendly_nametextTEXTyesHuman-readable label for the node (added in migration 1769000000000)
payloadjsonJSONnoEvent-specific data. For VARIABLE type: { key, newValue }
has_errorbooleanBOOLEANyesTrue if the interaction step errored (added in migration 1727200000000)
duration_msintINTyesExecution duration in ms for supported types (added in migration 1727200000000)
created_attimestamp (CreateDateColumn)TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP(6)noRow insertion time (added in migration 1726500000000)
updated_attimestamp (UpdateDateColumn)TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)noRow last-modified time (added in migration 1726500000000)

Indexes:

  • idx_session_ts on (session_id, ts) — primary access pattern for listing interactions per session
  • idx_hbf_event_ts on (hbf_event_id, ts) — access pattern for fetching all steps within a single event

Migration history:

MigrationTimestampChange
CreateInteractionMetadata1726400000000Initial table: id, hbf_event_id, session_id, ts, type, payload; idx_session_ts
AddTimestampsToInteractionMetadata1726500000000Added created_at, updated_at
AddErrorDurationToInteractionMetadata1727200000000Added has_error, duration_ms
AddFriendlyNameToInteractionMetadata1769000000000Added friendly_name

Notes

  • session_id maps to ChatSession.uuid (not ChatSession._id). hbf-bot publishes the uuid string; no FK constraint exists.
  • payload schema varies by type. For VARIABLE interactions the payload contains { key: string, newValue: string | null }, used by the session-variables API endpoint to reconstruct variable state at a point in time.
  • Delete operations are async (HTTP 202). The service accepts the request and runs the DELETE in the background.
  • hbf-data-retention is the only internal caller of the delete API, authenticated via a locally-issued DM JWT (HS256, DM_AUTH_JWT_SECRET).