From 75f2aa93dd4850109727feeea28e69edc4c58024 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Wed, 14 Oct 2026 16:41:51 +0200 Subject: [PATCH] fix(prompt): parse JSON floats exactly (serde_json float_roundtrip) The Python-compatible `tojson` renderer (control-plane/src/prompt.rs, also compiled into leleka-runtime) must reproduce json.dumps(json.loads(x)). Without serde_json's float_roundtrip feature the default float parser is not correctly rounded: 123456789012345680000.0 rendered as 1.2345678901234567e+20 instead of Python's 1.2345678901234568e+20. The test only passed in whole-workspace builds where leleka-context's dev-dependency happened to enable the feature; building leleka-runtime alone failed. Enable the feature on both consumers. Co-Authored-By: Claude Sonnet 5.5 --- control-plane/Cargo.toml | 2 +- crates/leleka-runtime/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/control-plane/Cargo.toml b/control-plane/Cargo.toml index 708acced..34584d8c 100644 --- a/control-plane/Cargo.toml +++ b/control-plane/Cargo.toml @@ -28,7 +28,7 @@ reqwest = { version = "0.13.5", default-features = false, features = ["rustls"] regex = "1.13.1" regex-syntax = "0.8.11" serde = { version = "1", features = ["derive"] } -serde_json = "1" +serde_json = { version = "1", features = ["float_roundtrip"] } sha2 = "0.11" subtle = "2.6.1" tokio = { version = "1", features = ["fs", "io-util", "macros", "net", "process", "rt-multi-thread", "signal", "sync", "time"] } diff --git a/crates/leleka-runtime/Cargo.toml b/crates/leleka-runtime/Cargo.toml index a0e9be62..bd55e9fa 100644 --- a/crates/leleka-runtime/Cargo.toml +++ b/crates/leleka-runtime/Cargo.toml @@ -10,7 +10,7 @@ rust-version.workspace = true minijinja = { version = "=2.24.0", default-features = false, features = ["builtins", "macros", "multi_template", "adjacent_loop_items", "serde", "preserve_order", "loop_controls"] } minijinja-contrib = { version = "=2.24.0", default-features = false, features = ["pycompat"] } serde = { version = "1", features = ["derive"] } -serde_json = "1" +serde_json = { version = "1", features = ["float_roundtrip"] } sha2 = "0.11" leleka-backend-api = { path = "../backend-api" } leleka-tokenizer = { path = "../tokenizer" }