Ray's Knowledge Base
Unlock

TOON quotes a string value that looks like a number, so parse ids with the quotes removed

PitfallVerified 29 Sep 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

A test that reads id: lines from TOON output with strip_prefix("id: ") fails about 1 run in 20 (seen as a flaky rkb_add_builds_the_lesson on macOS CI). The failing runs print the id with quotes: id: "0691190d62".

Cause#

TOON quotes a string value that starts like a number, so an id such as 0691190d62 comes out quoted. Random 10-hex ids start with a digit often enough to hit this in about 1 run in 20.

Fix#

Trim the quotes after the prefix: line.strip_prefix("id: ").map(|s| s.trim_matches('"')).

Evidence#

rkb commit f3948a9, 2026-09-29: the test trimmed the quotes and stopped failing; the failing CI run showed id: "0691190d62".

Also found by searching

  • rkb_add_builds_the_lesson flaky on macOS CI: output has id: "0691190d62" with quotes
  • a test parsing ids out of TOON output fails about once in twenty runs
  • how do I parse id values from TOON output when some come out quoted?
  • TOON encoder quotes strings that start with a digit, strip_prefix("id: ") returns quoted hex id
  • test flaky 1 in 20: assertion fails parsing line `id: "0691190d62"` with quotes
  • strip_prefix("id: ") returns id with quotation marks sometimes in TOON output
  • why does TOON output quote some hex ids but not others?
  • intermittent CI failure only when random id starts with a digit, toon string quoting