mirror of
https://github.com/Canner/WrenAI.git
synced 2026-10-16 06:57:43 +08:00
fix(context-loader): write the prepared document verbatim on stdout
The two output routes disagreed by one byte: `-o` wrote the document as serialized, while stdout appended a newline. A consumer that hashes what it reads to detect drift would get different answers depending on which route it used, which is the opposite of what a single-producer wire format is for.
This commit is contained in:
@@ -52,7 +52,9 @@ fn main() -> ExitCode {
|
||||
return ExitCode::from(1);
|
||||
}
|
||||
}
|
||||
None => println!("{document}"),
|
||||
// `print!`, not `println!`: the `-o` path writes the document verbatim, and a consumer
|
||||
// that hashes what it reads would see the two routes disagree by one byte.
|
||||
None => print!("{document}"),
|
||||
}
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user