Skip to content

Commit 958238a

Browse files
committed
improve verify_serialization to check task type round trip
1 parent d128995 commit 958238a

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

turbopack/crates/turbo-tasks-backend/src/kv_backing_storage.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,22 @@ fn serialize_task_type(
667667
let deserialize: Result<CachedTaskType, _> = serde_path_to_error::deserialize(
668668
&mut pot_de_symbol_list().deserializer_for_slice(&*task_type_bytes)?,
669669
);
670-
if let Err(err) = deserialize {
671-
println!("Task type would not be deserializable {task_id}: {err:?}\n{task_type:#?}");
672-
panic!("Task type would not be deserializable {task_id}: {err:?}");
670+
match deserialize {
671+
Ok(value) => {
672+
if &value != &**task_type {
673+
println!(
674+
"Task type would not round-trip {task_id}:\nOriginal: \
675+
{task_type:#?}\nRound-tripped: {value:#?}"
676+
);
677+
panic!("Task type would not round-trip {task_id}");
678+
}
679+
}
680+
Err(err) => {
681+
println!(
682+
"Task type would not be deserializable {task_id}: {err:?}\n{task_type:#?}"
683+
);
684+
panic!("Task type would not be deserializable {task_id}: {err:?}");
685+
}
673686
}
674687
}
675688
Ok(())

0 commit comments

Comments
 (0)