Skip to content

DataService misfiles context-less delta values under an "undefined.<path>" key #209

Description

@mairas

Surfaced (not introduced) by the strictNullChecks review of #208; confirmed pre-existing and byte-identical to the base behavior.

Problem

When a Signal K updates delta arrives with no context field, DataService.setPathContext(context, path) computes the storage key as:

context !== this._selfUrn ? `${context}.${path}` : `${SELFROOTDEF}.${path}`

With context === undefined, undefined !== this._selfUrn is true, so the value is filed under the literal key `${undefined}.${path}` — e.g. undefined.navigation.position. Widgets subscribed to self.<path> never see that data; it is silently misfiled rather than treated as self.

The interface comments (IPathValueData.context, IMeta.context) state "empty context should assume the message is from Self", but setPathContext doesn't special-case empty/undefined — so the documented intent and the code diverge.

Why it's low-priority

Real Signal K servers always include context in delta updates, so this only triggers for a non-conforming producer. #208 deliberately preserved the behavior (the honest string | undefined typing surfaced it without changing runtime), and the delta-service updates win test now pins that a context-less message emits context: undefined.

Fix direction

Treat empty/undefined context as self in setPathContext (fold it to SELFROOTDEF), matching the documented "empty context assumes Self" contract. Add a DataService test asserting the path key produced for a context-less message once the self URN has been learned.

Location

  • src/app/core/services/data.service.tssetPathContext

Refs #6, #208

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions