fix(analytics): replace NUL-byte map-key separators with a visible one

Two in-memory key builders joined their parts with a literal NUL
(`${a}\x00${b}`): the sleep writer-bucket key and the correlation
pair key. The embedded NUL made grep classify both files as binary, so a
plain `grep symbol src/**` skipped them silently.

Swap the separator for U+241F (␟, the unit separator). It cannot appear
in a `MeasurementSource` enum literal, a device-type tag, or a
correlation-channel name, so the key semantics are identical — the sleep
key still slices its source prefix unambiguously and the correlation Set
still excludes double-counts. Both keys are ephemeral (one pass, never
persisted), so the byte change is invisible to any stored state.
This commit is contained in:
Marc-André Bombeck committed 2026-07-18 02:09:33 +02:00
1 parent 55186ccd3e
commit 3dc6c7436f
2 files changed
+13 -4

No files matched your search

+4 -3
View File
@@ -309,10 +309,11 @@ const RECONSTRUCTED_TIMELINE_SOURCES: ReadonlySet<string> = new Set<string>([
/**
* Separator between the source and device-type parts of a writer key.
* `` cannot appear in a `MeasurementSource` enum literal or a
* device-type tag, so the split-back is unambiguous.
* The unit-separator character (U+241F) cannot appear in a
* `MeasurementSource` enum literal or a device-type tag, so the
* split-back is unambiguous.
*/
const WRITER_KEY_SEP = "";
const WRITER_KEY_SEP = "\u241F";
/**
* Writer-bucket key of a stage row: the source, refined by the device-type