From 0b1688098abcd27787adfb86d35b2e168f9d668d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 14 Nov 2026 03:12:01 +0000 Subject: [PATCH] fix(anicraft): preserve invalid envelope diagnostic --- crates/anicraft-format/src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/anicraft-format/src/lib.rs b/crates/anicraft-format/src/lib.rs index 030356a59..7cc5dc261 100644 --- a/crates/anicraft-format/src/lib.rs +++ b/crates/anicraft-format/src/lib.rs @@ -105,7 +105,7 @@ where type Value = Envelope; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - formatter.write_str("an AniCraft native project envelope") + formatter.write_str("an .anicraft envelope object") } fn visit_map(self, mut map: A) -> Result @@ -240,6 +240,14 @@ mod tests { assert_eq!(decoder.calls, 1); } + #[test] + fn malformed_top_level_keeps_the_native_envelope_diagnostic() { + let mut decoder = CaptureDocument::default(); + let error = read::("[]", &mut decoder).unwrap_err(); + assert!(error.to_string().contains("expected an .anicraft envelope object")); + assert_eq!(decoder.calls, 0); + } + #[test] fn duplicate_documents_use_the_last_successful_value() -> Result<(), Box> { let json = r#"{"format":"anicraft","version":1,"document":{"value":1},"document":{"value":2}}"#;