Seeded Begin tests: read a request through its serialization

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-02 20:16:47 +01:00
commit f04de5e9a0

View file

@ -646,15 +646,10 @@ pub(crate) mod tests {
)
}
/// Everything the model was shown in one request.
/// Everything the model was shown in one request, as the request's own
/// serialization: purpose, instructions and input.
fn prompt_text(request: &ghostlight::InferenceRequest) -> String {
let mut text = request.provider.instructions.clone();
for item in &request.provider.input {
if let model_connector::InputItem::UserText { text: more } = item {
text.push_str(more);
}
}
text
serde_json::to_string(request).unwrap()
}
pub(crate) async fn eventually<T>(mut probe: impl AsyncFnMut() -> Option<T>) -> T {
@ -722,7 +717,7 @@ pub(crate) mod tests {
assert_eq!((person.target, person.qualified, person.deficit), (8, 4, 4));
let seed = rig.port.seen_requests();
assert!(
seed.iter().take(2).all(|request| request.purpose == ghostlight::InferencePurpose::Elaboration),
seed.iter().take(2).all(|request| prompt_text(request).contains("Elaboration")),
"two seed sessions asked the model"
);
assert!(