fix(data): preserve jsonb numbers for metadata CAS

This commit is contained in:
ZheFox
2026-09-03 14:37:10 +08:00
parent d672ba2068
commit 979dbc4b33
2 changed files with 12 additions and 1 deletions
@@ -3671,6 +3671,17 @@ mod tests {
assert!(!sql.contains("is_active"));
}
#[test]
fn runtime_metadata_cas_preserves_postgres_jsonb_numeric_lexemes() {
// PostgreSQL jsonb keeps the exact decimal value. Losing that lexeme while
// decoding into serde_json::Value makes a subsequent namespace CAS compare
// a nearby-but-different number and report a false conflict.
let postgres_json = r#"{"used_percent":9.373679999999995}"#;
let decoded: serde_json::Value = serde_json::from_str(postgres_json).unwrap();
assert_eq!(serde_json::to_string(&decoded).unwrap(), postgres_json);
}
#[test]
fn ordinary_key_update_does_not_own_runtime_observation_fields() {
let sql = super::KEY_UPDATE_SQL.to_ascii_lowercase();