fix: align session tests with jsonl persistence

This commit is contained in:
YeonGyu-Kim
2026-04-02 11:31:53 +09:00
parent ffb133851e
commit 12c364da34
4 changed files with 192 additions and 109 deletions

View File

@@ -161,8 +161,15 @@ impl Session {
let path = path.as_ref();
let contents = fs::read_to_string(path)?;
let session = match JsonValue::parse(&contents) {
Ok(value) => Self::from_json(&value)?,
Ok(value)
if value
.as_object()
.is_some_and(|object| object.contains_key("messages")) =>
{
Self::from_json(&value)?
}
Err(_) => Self::from_jsonl(&contents)?,
Ok(_) => Self::from_jsonl(&contents)?,
};
Ok(session.with_persistence_path(path.to_path_buf()))
}