3.0 KiB
3.0 KiB
Runtime Flows And Invariants
Event Time Source Priority
Use component event time over ingest time whenever possible.
eventFallbackTime(actual, ingestedAt, collectedAt):
actualingestedAtcollectedAt
collectedFallbackTime(collectedAt, ingestedAt):
collectedAtingestedAt
Status Event Time Parsing Order
parseComponentStatusEventTime resolves time in this order:
status_changed_at- Latest matching
status_historyitem for current status - Latest parseable
status_historyitem status_checked_at
Failure Event Rules
For critical components:
- Timeline event type:
COMPONENT_FAILED failure_events.failure_timeuses resolved failure time (not raw ingest time)failure_events.external_idincludes the same failure timestamp
First Seen Rules
parts.first_seen_at must be the earliest known ingest-derived component time.
Candidate sources:
- Parseable
status_history[].changed_at status_changed_atstatus_checked_ateventFallbackTime(nil, ingestedAt, collectedAt)
Persistence rule:
- Keep the minimum value over time.
- If incoming is earlier than stored value, overwrite with incoming value.
Duplicate Component Serial Rules (CSV + JSON Ingest)
If serial numbers are not unique within the same p/n (model) inside one ingest payload:
- First occurrence keeps original
vendor_serial. - Each next duplicate occurrence is assigned a service serial placeholder:
- Format:
NO_SN-XXXXXXXX(8-digit zero-padded global counter).
- Format:
- If
vendor_serialis empty, a service serial placeholder is assigned as well. - Counter is global for the whole application and stored in
id_sequencesunderentity_type = 'no_sn_placeholder'.
Component Health Computation In UI
Component health is derived only from the latest status event among:
COMPONENT_FAILEDCOMPONENT_WARNINGCOMPONENT_OK
Non-status timeline events (INSTALLED, REMOVED, FIRMWARE_CHANGED, FIRMWARE_INSTALLED, etc.) must not change health status.
Firmware Timeline Rules
For component firmware observations:
- First observed version ->
FIRMWARE_INSTALLED(asset + component timeline pair) - Later version change ->
FIRMWARE_CHANGED(asset + component timeline pair)
Storage details:
FIRMWARE_INSTALLEDstores transition string intimeline_events.firmware_version:- -> <installed_version>FIRMWARE_CHANGEDstores installed/new firmware value
Detection details:
- Previous observation lookup:
ORDER BY observed_at DESC, id DESC LIMIT 1 OFFSET 1
Timeline Color Semantics
REMOVED-> yellowCOMPONENT_FAILED-> redCOMPONENT_WARNINGand related warning semantics followtimelineEventClass
Regression Guardrails
Do not reintroduce these regressions:
- Using ingest timestamp when payload provides better event/failure timestamp
- Letting
INSTALLEDmark failed components as healthy - Missing
Previous Componentssection on asset page - Missing installation history on component page
- Missing firmware information on component page timeline