Diagram ToStringNode: explicit null collapses to empty string via ?? #1023

Closed
opened 2026-08-12 08:40:23 +00:00 by spikerj · 1 comment
Owner

Summary

ToStringNode.data() uses String(inputs?.['value']?.[0] ?? '').

An explicit null input is treated as missing because of nullish coalescing, so the node emits "" instead of "null". false/0 are fine (they are not nullish), but diagrams that intentionally pass null (e.g. from GetVariable of an unset key, or a robot scan miss) silently produce an empty string.

Expected

String(null) → "null" (or a dedicated null sentinel), distinct from a missing input.

Actual

null ?? "" → "" → String("") → "".

Repro (unit)

new ToStringNode().data({ value: [null] }) // { result: "" }

Suggested fix

Use nullish only for the missing-array case, e.g. check inputs?.['value']?.[0] presence with '0' in (inputs?.value ?? {}) / length, or stringify with value === undefined ? "" : String(value) so null survives.

Found by Wave 6 coverage tick 11 (a7).

## Summary `ToStringNode.data()` uses `String(inputs?.['value']?.[0] ?? '')`. An **explicit `null` input** is treated as missing because of nullish coalescing, so the node emits `""` instead of `"null"`. `false`/`0` are fine (they are not nullish), but diagrams that intentionally pass `null` (e.g. from GetVariable of an unset key, or a robot scan miss) silently produce an empty string. ## Expected `String(null)` → `"null"` (or a dedicated null sentinel), distinct from a missing input. ## Actual `null ?? ""` → `""` → `String("")` → `""`. ## Repro (unit) ```ts new ToStringNode().data({ value: [null] }) // { result: "" } ``` ## Suggested fix Use nullish only for the missing-array case, e.g. check `inputs?.['value']?.[0]` presence with `'0' in (inputs?.value ?? {})` / length, or stringify with `value === undefined ? "" : String(value)` so `null` survives. Found by Wave 6 coverage tick 11 (a7).
Author
Owner

Already present on spikersoft-angular master. ToStringNode.data() stringifies an explicit null as "null" (only undefined/missing inputs become ""). Closing.

Already present on `spikersoft-angular` `master`. `ToStringNode.data()` stringifies an explicit `null` as `"null"` (only `undefined`/missing inputs become `""`). Closing.
Sign in to join this conversation.