eventhub/README_PATCH.md

2.0 KiB

Cross-representation tachograph event mixing fix

Problem

When a runtime request combined TACHOGRAPH_FILE_SESSION and TACHOGRAPH_DB, CARD and VU observations of the same tachograph fact were often not fused. The old compatible keys embedded representation-specific values such as tenant metadata, coordinate string scale, country representation, region defaults, vehicle completeness and interval metadata.

Examples of equivalent values that produced different keys:

  • country 13 versus D;
  • region 0 versus null;
  • longitude 9.3883333333333336 versus 9.388333333333334;
  • file-session package tenant default versus the DB tenant;
  • CARD events without VIN versus VU events with VIN.

Changes

  • Compatible activity and support keys now contain only stable candidate identity:
    • driver;
    • domain;
    • event type;
    • semantic lifecycle;
    • exact event timestamp.
  • Exact timestamp behavior is unchanged.
  • Added RuntimeEventEvidenceCompatibilityMatcher to validate grouped candidates semantically.
  • Support compatibility normalizes:
    • tachograph nation numeric/alpha forms;
    • region 0/blank/null;
    • coordinate decimal scale with a 1e-9 serialization tolerance;
    • registration formatting;
    • optional VIN, odometer and operation data.
  • Missing optional data is enrichable, while conflicting meaningful values prevent fusion.
  • Activity compatibility allows source-specific optional metadata differences while still checking tenant, vehicle/registration and card slot compatibility.
  • Mixing now evaluates compatibility per primary/secondary pair instead of suppressing every secondary in a broad group.
  • Internal mixing state now tracks events by object identity and uses the UUID before externalSourceEventId, avoiding collisions from repeated source-side IDs such as CARDPLACE-1.

Tests

Added regression coverage for:

  • file-session CARD_PLACE versus DB VU_PLACE with 13/D, 0/null and decimal-scale differences;
  • file-session CARD activity versus DB VU activity;
  • meaningful coordinate conflicts remaining separate.