code wiki / consumers / _obd_pipeline_smoke.nx

_obd_pipeline_smoke.nx

buildroot/runtime/consumers/_obd_pipeline_smoke.nx

8123 B189 linesdepth 11pulls 15 transitivereach 0 importersview sourcekind smoke
docsdependenciesstructsconstsfunctions

about

_obd_pipeline_smoke.nx -- end-to-end OBD pipeline correctness gate. Proves the OBD predictive-maintenance pipeline works by stitching every layer together + asserting expected outputs: 1. nx_obd2_shim.rx_fn parses a synthetic ISO-TP Mode 01 coolant-temp response -> emits EVT_COOLANT_TEMP event 2. nx_pm_consumer_on_event ingests N drift samples -> eventually classifies as ANOM_DRIFT_UP 3. nx_tm_emit_anomaly serializes verdict to stdout NDJSON Synthetic dataset: coolant temperature rising linearly from 87C to 108C across 100 samples spaced 1 hour apart (~4-day window). Per OBD spec the high threshold is ~105C; the linear drift should cross within the 7-day extrapolation horizon, firing ANOM_DRIFT_UP. Status: SEED v0.1.0. 2026-05-27. WINNER-TIER: EXEMPT (correctness gate per NISHIBENCH_WINNER_STANDARD §antipatterns; smokes are gates not perf claims) INCUMBENTS: n/a (correctness gate) EXEMPTION REASON: correctness validation; no performance claim made Exit-code convention: 0 all assertions PASS 1-9 setup-failure verdicts (memory alloc, init) 10-19 shim-path verdicts (frame parse, event emit) 20-29 consumer-path verdicts (register, on_event, classification) 30-39 telemetry-path verdicts (bus init, emit, sink)

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_telemetry.nx nx_obd2_shim.nx nx_pred_maint_consumer.nx _obd_pipeline_smoke.nx

imports: nx_syscalls.nxnx_telemetry.nxnx_obd2_shim.nxnx_pred_maint_consumer.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap nx_obd2_shim_init nx_pm_consumer_init nx_pm_consumer_register nx_pm_ring_init smoke_assert_shim_parse sys_mmap ↻ smoke_build_coolant_frame nx_obd2_rx_fn nx_obd2_isotp_parse_sf sys_mmap ↻ nx_obd2_pid_to_event nx_obd2_mode03_decode_dtc smoke_assert_drift_detecti nx_pm_consumer_on_event nx_pm_consumer_find_ring nx_pm_ring_push nx_pm_compute_stats nx_pm_isqrt nx_pm_classify_latest nx_tm_emit_anomaly sys_mmap ↻ nx_tm_emit nx_tm_kind_is_valid nx_tm_sev_is_valid nx_tm_rl_try_consume nx_tm_hash_source nx_tm_dispatch_to_sink nx_tm_sink_kind_is_valid nx_tm_sink_stdout_json nx_tm_dispatch_to_sink ↻ nx_tm_rl_init nx_tm_bus_init nx_pm_consumer_set_telemet smoke_assert_telemetry_emi nx_pm_consumer_on_event ↻

structs

none

consts

37const SMOKE_N_SAMPLES: i64 = 100 // drift samples to inject
38const SMOKE_SAMPLE_PERIOD_NS: i64 = 3600000000000 // 1 hour per sample (ns)
39const SMOKE_START_TEMP_C: i64 = 87
40const SMOKE_END_TEMP_C: i64 = 108
41const SMOKE_THRESHOLD_LO: i64 = 70 // OBD spec low (degC)
42const SMOKE_THRESHOLD_HI: i64 = 105 // OBD spec high

functions

54func smoke_build_coolant_frame(out: *u8, temp_c: i64) -> i64
68func smoke_assert_shim_parse(shim: *NxObd2Shim) -> i64
88func smoke_assert_drift_detection(consumer: *NxPredMaintConsumer,
called by 1: main calls 1: nx_pm_consumer_on_event
117func smoke_assert_telemetry_emit(bus: *NxTelemetryBus,
called by 1: main calls 1: nx_pm_consumer_on_event
142func main() -> i64