Skip to content

filter-bar.test.ts has 4 raw NUL bytes, so rg and git treat it as binary #435

Description

@BorisTyshkevich

Found while shipping #425.

What

tests/unit/filter-bar.test.ts contains 4 raw NUL bytes (committed in c9f6505, #412).
They are the time-range group-key delimiter, written as a literal 0x00 byte inside
string literals rather than as a JavaScript unicode escape for code point zero — which is
what production uses: src/core/time-range.ts:183 builds the group key by joining
fromFilter.id and toFilter.id with that escaped code point.

Byte offsets in the committed file: 31689, 35196, 36936, 38846 — e.g. the fixture's
key: 'from<NUL>to' and const key = 'group:from<NUL>to'.

Why it matters

The string VALUES are correct, so the tests pass and assert the right thing. But the raw
byte makes tooling treat the whole 39 KB spec as binary: rg refuses to search it
("binary file matches"), git diff can flag it, and editors may mangle it on save. It
cost real time while shipping #425 — a routine rg for buildFilterBar in that file
returned only "binary file matches" instead of the call sites.

Why deferred

Purely cosmetic and unrelated to #425's scope; touching it would have added unrelated
churn to that PR's diff. (#425 preserved the bytes exactly rather than rewriting them
silently.)

Fix

Replace each literal NUL byte with the escape sequence, so the file is plain text while
every string's VALUE stays identical. npm test should be green with no other edit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglowlow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions