Context
crates/relayburn-sdk/src/ingest/pending_stamps.rs:451-475 serialize_stamp and :406-444 parse_pending_stamp hand-roll JSON for PendingStamp. The struct already has Debug, Clone, PartialEq and the workspace already enables serde_json/preserve_order.
Adjacent: pending_stamps.rs:594-630 uuid_v4 shells out to read /dev/urandom per call. harnesses/claude.rs:62-105 mint_session_id rolls another v4-shaped UUID using DefaultHasher over now+pid — much weaker than OsRng, and the formatting code is 24 lines.
Proposed fix
- Derive
Serialize, Deserialize on PendingStamp with #[serde(rename_all = "camelCase")]. The two ad-hoc fns collapse to 1-line serde_json::to_string / from_str calls. ~80 LOC removed.
- Replace both UUID generators with one consistent path. Two options:
- Add
uuid = "1" (pulls in ~one crate) with the v4 feature.
- Add
getrandom = "0.2" and keep a small format helper.
The first is cleaner; the doc comments at harnesses/claude.rs explicitly avoided pulling uuid "for one call site," but now there are two.
Verification
- The
*_compat_tests.rs files are explicitly named to catch byte-identical-ness with the TS sibling. Run cargo test -p relayburn-sdk pending_stamps after the change.
- The TS sibling produces JSON in a deterministic field order — verify the
#[serde(rename_all = "camelCase")] field declaration order in the struct matches.
References
crates/relayburn-sdk/src/ingest/pending_stamps.rs:406-444, 451-475, 594-630
crates/relayburn-cli/src/harnesses/claude.rs:62-105
- Ingest+ledger and CLI review notes from the May 2026 Rust review.
Context
crates/relayburn-sdk/src/ingest/pending_stamps.rs:451-475 serialize_stampand:406-444 parse_pending_stamphand-roll JSON forPendingStamp. The struct already hasDebug, Clone, PartialEqand the workspace already enablesserde_json/preserve_order.Adjacent:
pending_stamps.rs:594-630 uuid_v4shells out to read/dev/urandomper call.harnesses/claude.rs:62-105 mint_session_idrolls another v4-shaped UUID usingDefaultHasherovernow+pid— much weaker thanOsRng, and the formatting code is 24 lines.Proposed fix
Serialize, DeserializeonPendingStampwith#[serde(rename_all = "camelCase")]. The two ad-hoc fns collapse to 1-lineserde_json::to_string/from_strcalls. ~80 LOC removed.uuid = "1"(pulls in ~one crate) with thev4feature.getrandom = "0.2"and keep a small format helper.The first is cleaner; the doc comments at
harnesses/claude.rsexplicitly avoided pullinguuid"for one call site," but now there are two.Verification
*_compat_tests.rsfiles are explicitly named to catch byte-identical-ness with the TS sibling. Runcargo test -p relayburn-sdk pending_stampsafter the change.#[serde(rename_all = "camelCase")]field declaration order in the struct matches.References
crates/relayburn-sdk/src/ingest/pending_stamps.rs:406-444, 451-475, 594-630crates/relayburn-cli/src/harnesses/claude.rs:62-105