Google Sign-In Required

Use your company Google account to access the BetterFleet private content.

Back to private home

BetterFleet Support Private
Skip to content
BetterFleet Dev Wiki
Telematics Core Migration MVP (Implementation-Time BDD)
Initializing search
    bf-dev
    • Home
    • Process
    • Products
    • Reference
    • Decisions
    • Work
    • Operations
    bf-dev
    • Home
      • Process Handbook
      • BetterFleet Workflow Map
      • Product Development System
      • Product Engineering Workflow
        • Process Workflows
        • Work Intake and Weekly Planning
        • Product Engineering Workflow in Linear
        • Product Engineering Delivery
        • Agent Guidance
        • Workflow
        • Skills
        • Skill Sources
        • Process Guides
        • GitLab Feature Flags
        • In-App Docs Authoring
        • Release Notes
        • Process Templates
        • Release Plan: <title>
      • Process Publishing
      • Product overview
        • General Reference
          • Core Domain Training
          • System Topology
          • Two-Axis Ontology Model
          • Ontology Primer
          • Worked Example
          • Evidence, Ownership, and Lineage
          • Energy Management
          • Standards and Protocol Map
          • Charging, Roaming, and Commercial Model
          • Charge Planning and Operations
          • Cross-Cutting Domains
          • Domain Coverage Matrix
        • BetterFleet Product Ontology
        • Core Operations Data Ontology
        • BetterFleet R&D Plan
        • Index
        • Architecture
        • Manage Product Capabilities
        • Manage Data and State
        • Manage Service Interaction Flows
        • Manage Reference
        • Manage Internal Application Diagrams
          • Manage Authorization And Permissions
          • bf-manage-core Auth and Authorization Model
          • Manage Authorization and Permissions
          • bf-manage-web Auth and Permission Model
          • Manage Service Catalog
          • bf-depot-sim
          • bf-digital-twin (Manage Role)
          • bf-fleet-health
          • bf-manage-connect
          • bf-manage-core
          • bf-manage-incidents
          • bf-manage-roaming
          • bf-manage-sitepwrmon
          • bf-manage-web
          • bf-schedule-creator (Manage Role)
          • bf-support-microsite
          • bf-telematics
        • Index
        • Architecture
        • Plan Reference
        • Plan Internal Application Diagrams
        • Plan Migration and Flags
        • Plan Simulation Request Lifecycle
          • Plan Service Catalog
          • bf-bnl-schedule-analysis-compute
          • bf-bnl-settings
          • bf-bnl-ui
          • bf-digital-twin (Plan Role)
          • bf-route-modelling
          • bf-schedule-creator (Plan Role)
      • Where to Ask Product Questions
      • Reference
        • Platform Reference
        • Platform Architecture
        • Script Runtime Model
        • Compose Profiles and Modes
        • Repository Map
        • Monolithic Git Transition FAQ
        • Monolithic Git Sizing
        • CI and Release Integration
        • Shared Reference
        • Shared Infrastructure Architecture
        • Secrets and Env Strategy
        • Vendors and Local Dependencies
        • System Reference
        • Cloud Data Dependencies
        • Ports and URLs
        • Service Matrix
          • API Docs
          • OCPI API Docs
          • OCPP API Docs
          • OSCP API Docs
          • VDV API Docs
          • Yard State API Docs
        • System Design
        • System Design: BBA Microgrid Controller Generic Packet Translation
        • System Design: Depot Simulation
        • System Design: IoT Sensor Packet
        • System Design: Microgrid Energy Orchestration
          • System Design: OCPP Profile 3 And ISO 15118 PKI
          • Architecture: BetterFleet OCPP Profile 3 and ISO 15118 PKI
          • Specification: BetterFleet OCPP Profile 3 and ISO 15118 Certificate Lifecycle Management
          • System Design: On-Prem Control
          • Challenge
          • Specification: BetterFleet On-Prem Continuity Control
          • System Design: OSCP
          • OSCP Protocol Documentation
          • Depot Sim Testing Requirements
          • System Design: OSCP Flexibility Provider Domain
      • Decisions
        • Architecture Decision Records
        • 0001 - Record architecture decisions
        • 0002 - Cognito for Authentication and Authorisation
        • 0003 - AWS Amplify for Authentication
        • 0004 - DynamoDB for default database
        • 0005 - Data Persistence
        • 0006 - Trunk-Based Development
        • 0007 - Generalised principle for automation
        • 0008 - Naming Repositories, Services, and URLs
        • 0009 - Use Timezone Aware DateTimes and UTC
        • 0010 - Use semantic release
        • 0011 - Centralized feature flag repository
        • 0012 - Use Named Exports in Storybook
        • 0013 - RESTful TITLE GraphQL
        • 0014 - Service Granularity
        • 0015 - Async/co-routine exception handling pattern
        • 0016 - Logging & log levels
        • 0017 - Instantiated Models
        • 0018 - Repository Pattern for Database Access
        • 0019 - Use of Design Tokens in TypeScript React Application
        • 0020 - API backwards compatibility and versioning
        • 0021 - Alembic Migration strategy
        • 0022 - Consistent react-hook-form usage
        • 0023 - Domain Event-Driven Architecture
        • 0024 - Domain Event Bus Tech Stack
        • 0025 - No enum types in DB table columns
        • 0026 - In-Memory Ormar Stores for Repository testing
        • 0027 - Storing Tab State in Query and Local Storage
        • 0028 - Adopt OpenTelemetry Semantic Conventions for Structured Logging
        • 0029 - Adopt RFC 9457 for HTTP Error Responses
        • 0030 - Use GitLab registry and Terraform state for ECS services
        • 0031 - Adopt DDD, Hexagonal Architecture, and CQRS for Python Domain Services
      • Work
        • Active Work
          • Work: Bba Microgrid Controller
          • Implementation Specification: BBA Microgrid Controller
          • BBA Microgrid Controller Deliverables (Stories)
          • Work: BFDev Monolithic Git
          • Challenge
          • Specification: BFDev Monolithic Git v2
          • BFDev Monolithic Git v2 Stories
          • Work: Complex Circuit Load Balancing
          • Implementation Specification: Complex Circuit Load Balancing
          • Complex Circuit Load Balancing Deliverables (Stories)
            • COR-10 and COR-11 Consolidation Review
          • Work: Dispatch Reliability and Reconciliation
          • Challenge
          • Specification: Dispatch Reliability and Reconciliation
          • Dispatch Reliability and Reconciliation (Unit User Stories)
            • Dispatch populated vehicle cards grey surface snapshot
            • Dispatch Visual Review
          • Work: Enable Scheduled Managed Charger Access
          • Challenge: Enable Scheduled Managed Charger Access
          • Specification Exploration Dossier: Enable Scheduled Managed Charger Access
          • Specification Review: Enable Scheduled Managed Charger Access
          • Specification: Enable Scheduled Managed Charger Access
          • Work: Guided Cut-Off and Release Orchestration
          • Specification: Guided Cut-Off and Release Orchestration
          • Guided Cut-Off and Release Orchestration (Unit User Stories)
          • Work: Production Deployment Validation
          • Challenge
          • Work: Scheduled Report Parity
          • Specification: Scheduled Report Parity
          • Work: Telematics
          • Telematics EventBridge Path
          • Telematics Ingress Architecture
          • Specification: Telematics Migration into bf-manage-core with 5-Minute Freshness and Health Visibility
          • Telematics Core Migration MVP (Implementation-Time BDD)
            • Feature Narrative
            • Scenario Inventory
            • Phase 2 BDD Backlog
            • Gherkin Scenarios
            • Coverage Review
            • Gaps / Open Questions
            • Automation Target Plan
          • Work: Vector Derms
          • Implementation Specification: Vector DERMS
          • Vector DERMS Deliverables (Stories)
          • Work: Visiting Vehicle Charging Visibility
          • Specification: Visiting Vehicle Charging Visibility
          • Visiting Vehicle Charging Visibility (Unit User Stories)
          • Work: Workspace Owned Stripe Roaming
          • Specification: Workspace-Owned Stripe Credentials for Roaming Payments
        • Backlog Work
          • Work: Microgrid
          • Microgrid Backlog Stories
          • Work: Mobile Ops Companion
          • Challenge
          • Specification: Mobile Operations Companion v1
          • Mobile Operations Companion Deliverables (Stories)
          • Work: Oscp
          • OSCP Backlog Stories
        • Archived Work
          • Work: Code Canonical Orchestration
          • Challenge
          • Specification: Product Engineering Workflow
          • Product Engineering Workflow Deliverables (Unit User Stories)
          • Work: Release Notes Automation
          • Release Plan: Release Notes Automation
          • Release Notes Automation Backlog Stories
      • Operations
      • Onboarding Runbook
        • Operations Runbooks
        • Production Hotfix Release
        • Staging Hotfix Release
        • Manage Staging Release Validation
        • Terraform Plan Dry Runs
        • Operations Tooling
        • Code Indexing
        • Operations Evidence
        • Database Restoration Test Report
      • Daily Operations Runbook
      • Testing Guide
      • Troubleshooting
    • Feature Narrative
    • Scenario Inventory
    • Phase 2 BDD Backlog
    • Gherkin Scenarios
    • Coverage Review
    • Gaps / Open Questions
    • Automation Target Plan
    1. Home
    2. Work
    3. Active
    4. Telematics

    Telematics Core Migration MVP (Implementation-Time BDD)¶

    Feature Narrative¶

    • Story: As Accounts, Operations, and Support users, we need one canonical telematics freshness and health contract so stale/no-data devices are discoverable quickly and values stay consistent across Manage pages.
    • Trigger: EventBridge-triggered workspace poll cycles execute inside bf-manage-core, websocket ingress updates flow from bf-telematics into the same core command handler, and read APIs compute request-time health and issues.
    • Outcomes:
    • 5-minute target cadence with staggered workspace starts.
    • Core owns all scheduled polling tasks.
    • One canonical snapshot for values and last update received.
    • One shared core handler for websocket and scheduled poll updates.
    • Request-time health states (healthy, delayed, stale, configured-no-data) with actionable stale/no-data reporting.
    • Observable lifecycle traces, KPI visibility, and reversible per-workspace cutover controls.

    Scenario Inventory¶

    • Execute staggered 5-minute workspace poll cycles.
    • Persist canonical snapshot and event history atomically for accepted payloads.
    • Reject invalid canonical payloads that fail workspace/device identity validation.
    • Keep telematics values and freshness consistent across Manage read surfaces.
    • Compute request-time health state from persisted snapshot, ingest history, and device configuration.
    • Return stale/no-data lists with reason and recency context for Accounts follow-up.
    • Roll back read/poll ownership to legacy mode without destructive data changes.

    Phase 2 BDD Backlog¶

    • Reject synchronized scheduling configurations before activation.
    • Add explicit configured-no-data grace-breach timing scenario separate from classification outline.
    • Return deterministic health-report empty-state contract for no stale/no-data devices.
    • Emit traceable poll-cycle lifecycle records across telematics ingress and core ingest.
    • Expose workspace KPI indicators for cycle success, delay patterns, and update coverage.
    • Progress workspace cutover from shadow to core read ownership with parity-gate checks.

    Gherkin Scenarios¶

    @behavior @implementation @telematics
    Feature: Telematics core migration with freshness and health visibility
      Fleet users can trust telematics freshness and diagnose stale/no-data devices from one canonical core contract.
    
      Rule: Workspace polling runs on a staggered 5-minute target cadence
        Background:
          Given active workspaces are configured for telematics polling
    
        Scenario: Execute staggered 5-minute workspace poll cycles
          When the scheduler triggers a polling window
          Then each active workspace receives one poll cycle attempt within the 5-minute target cadence
          And workspace start times are staggered rather than aligned to one synchronized start instant
          And the scheduled poll path does not call `bf-telematics`
    
      Rule: Canonical snapshot persistence is the single source of telematics truth
        Background:
          Given canonical handoff payloads are submitted from websocket ingress or core-owned poll execution into core command handling
    
        Scenario: Persist snapshot and event history atomically for accepted updates
          When a payload passes identity and schema validation
          Then one canonical snapshot for that configured workspace/device/vehicle is upserted
          And event history for the accepted update is appended in the same transaction
          And the snapshot includes current values and last update received timestamp
    
        Scenario: Use one core handler for websocket and scheduled poll updates
          Given websocket ingress and scheduled polling produce the same canonical update payload shape
          When either path submits an update into core
          Then core applies the same validation and persistence flow
          And the accepted update is observable through the same canonical snapshot and event history contract
    
        Scenario: Reject invalid payload identity mapping
          Given a payload has unresolved or conflicting workspace/device identity
          When core command validation runs
          Then the payload is rejected without mutating snapshot state
          And the rejection outcome is observable for diagnostics
    
        Scenario: Keep telematics values consistent across Manage read surfaces
          Given a canonical snapshot has been updated for a configured device
          When multiple Manage pages read telematics freshness/value data
          Then each page reads from the canonical snapshot/health contract
          And returned values and freshness timestamps are consistent within one refresh cycle
    
      Rule: Health and issue classification is computed at request time
        Background:
          Given workspace policy defaults are stale threshold 15 minutes and configured-no-data grace 60 minutes
          And device configuration and latest accepted updates are persisted in core
    
        Scenario Outline: Classify request-time health state deterministically
          Given a configured device has freshness age <freshness_age_minutes> minutes
          And the device has accepted update history <has_history>
          When a health report is requested
          Then the device health state is <expected_state>
          And the response includes freshness age and reason context
          Examples:
            | freshness_age_minutes | has_history | expected_state      |
            | 3                     | yes         | healthy             |
            | 9                     | yes         | delayed             |
            | 22                    | yes         | stale               |
            | 65                    | no          | configured-no-data  |
    
      Rule: Health reporting is actionable for Accounts and Support workflows
        Background:
          Given workspace health data is available from request-time query calculation
    
        Scenario: Return stale/no-data lists with follow-up context
          When Accounts requests a workspace telematics health report
          Then the response includes stale and configured-no-data device lists
          And each listed device includes reason and recency context for outreach
    
      Rule: Cutover toggles provide reversible per-workspace migration control
        Background:
          Given workspace cutover controls include device registry source, poll owner, read owner, and provider mode
    
        Scenario: Roll back workspace to legacy ownership safely
          Given a workspace is using core read ownership
          When rollback is triggered by defined canary guardrails
          Then read owner and poll owner are set to legacy mode
          And no destructive data migration is required to restore service continuity
    

    Coverage Review¶

    • Criterion intent: Run per-workspace poll cycles on 5-minute target cadence with staggered starts.
      • Scenario titles: Execute staggered 5-minute workspace poll cycles.
      • Status: covered
    • Criterion intent: Persist one canonical telematics snapshot with last update received per configured device/vehicle.
      • Scenario titles: Persist snapshot and event history atomically for accepted updates.
      • Status: covered
    • Criterion intent: Provide workspace health reporting with stale/no-data discoverability.
      • Scenario titles: Classify request-time health state deterministically; Return stale/no-data lists with follow-up context.
      • Status: covered
    • Criterion intent: Ensure all Manage pages read telematics freshness/value from canonical core contract.
      • Scenario titles: Keep telematics values consistent across Manage read surfaces.
      • Status: covered
    • Criterion intent: Expose workspace-level indicators and traceability for collection reliability.
      • Scenario titles: Emit traceable cycle lifecycle records; Expose workspace telematics KPI indicators.
      • Status: deferred
    • Criterion intent: Enforce transitional ownership boundary (bf-telematics ingress, bf-manage-core command/query).
      • Scenario titles: Execute staggered 5-minute workspace poll cycles; Persist snapshot and event history atomically for accepted updates; Use one core handler for websocket and scheduled poll updates.
      • Status: covered
    • Criterion intent: Keep request-time health/issues calculation until event-bus projections are introduced.
      • Scenario titles: Classify request-time health state deterministically; Return stale/no-data lists with follow-up context.
      • Status: covered
    • Criterion intent: NFR freshness reliability target (95% within 5 minutes) and request-time latency budgets.
      • Scenario titles: Execute staggered 5-minute workspace poll cycles; Expose workspace telematics KPI indicators.
      • Status: deferred

    Gaps / Open Questions¶

    • NFR thresholds are defined, but explicit executable pass/fail thresholds for first-wave load and query-latency budgets are still open (OQ-005).
    • Notification strategy for stale/no-data is unresolved (OQ-003): passive report-only vs active notifications.
    • First-wave Manage page scope for canonical cutover is unresolved (OQ-004), which affects final UI e2e scope.
    • Post-MVP event bus/projection readiness gates remain unresolved (OQ-006).
    • Permission-role behavior is not explicitly specified in the telematics spec for health-report access control.

    Automation Target Plan¶

    • bf-manage-web Cypress e2e candidate grouping: extend existing cypress/e2e/baseline/ with telematics-focused specs (for example cypress/e2e/baseline/telematics-health.cy.ts) and reuse page-level patterns from overview.cy.ts and vehicles-page.cy.ts.
    • bf-manage-web runnable commands discovered from package.json:
    • npm run e2e:baseline for baseline-group execution.
    • npm run e2e:all or npm run e2e:ci-all for broader regression.
    • bf-manage-core pytest targets for backend behavior:
    • Existing telematics suites under test/telematics_mvp/ (test_scheduler.py, test_service.py, test_router.py, test_polling_tasks.py, test_runtime.py) for scheduler, ingest, query, and toggle behavior.
    • Existing compatibility coverage under test/telematics/test_telematics.py for legacy path non-regression.
    • Suggested backend additions:
    • test/telematics_mvp/test_health_report_contract.py for stale/no-data payload and deterministic empty-state.
    • test/telematics_mvp/test_cutover_toggle_rollbacks.py for shadow/canary/core transitions and rollback safety.
    • Optional adapter: pytest-bdd can be introduced later if the team wants executable Gherkin binding; not required for initial implementation.
    Made with Material for MkDocs
    BFDev Docs Assistant
    New conversation?
    Ask one focused question at a time, this helps the assistant provide accurate answers about what's been implemented in BetterFleet.