use super::bat_largest_files_tests::run_scenario_for;
use super::{PromptDisposition, PromptIntake};
const PROMPT: &str = "hello?";
#[test]
fn the_greeting_reaches_explain_through_the_question_mark_fallback() {
assert_eq!(
PromptIntake::analyze(PROMPT).disposition(),
PromptDisposition::Explain
);
assert_eq!(
PromptIntake::analyze("hello").disposition(),
PromptDisposition::Act,
"documenting today's behaviour, NOT endorsing it — see #2051 (3)"
);
}
#[tokio::test]
async fn the_greeting_turn_never_ships_a_sentence_to_read_aloud() {
let ws = tempfile::tempdir().expect("tempdir");
let (_reply, _hallucinations, _end_reason, wire) = run_scenario_for(
PROMPT,
PromptDisposition::Explain,
ws.path(),
vec![serde_json::json!({ "content": "Hello! How can I help?" })],
)
.await;
assert!(
wire.contains("disposition_source:"),
"the card must name the classification as the harness's own inference"
);
assert!(
wire.contains("disposition_privacy:"),
"the card must mark itself as plumbing"
);
assert!(
wire.contains("say plainly what you cannot do"),
"the privacy clause must not become a gag on honest limits"
);
assert!(
!wire.contains("This is an Explain turn"),
"the refusal phrasing the model read aloud is back on the wire"
);
assert!(
!wire.contains("unavailable under the current prompt disposition"),
"the mechanism is named on the wire again"
);
assert!(
!wire.contains("cannot widen an already accepted turn"),
"the you-have-no-move sentence is back on the wire"
);
}
#[tokio::test]
async fn a_capability_refused_write_and_discovery_keep_style_out_of_authority() {
let ws = tempfile::tempdir().expect("tempdir");
let (_reply, _hallucinations, _end_reason, wire) = run_scenario_for(
"README.md could use a line saying hello?",
PromptDisposition::Explain,
ws.path(),
vec![
serde_json::json!({
"content": null,
"tool_calls": [{
"id": "c1", "type": "function",
"function": { "name": "write_file",
"arguments": "{\"path\":\"README.md\",\"content\":\"hello\\n\"}" }
}]
}),
serde_json::json!({
"content": null,
"tool_calls": [{
"id": "c2", "type": "function",
"function": { "name": "tool_search",
"arguments": "{\"query\":\"run command\"}" }
}]
}),
serde_json::json!({ "content":
"I can't change README.md from here, so the line was not added." }),
],
)
.await;
assert!(
wire.contains("capability denied: fs_write"),
"the filesystem grant denial must reach the model as a tool result: {wire}"
);
assert!(
!wire.contains("Tool `write_file` is not available for this request."),
"a question-shaped prompt must not act as a filesystem capability"
);
assert!(
wire.contains("run_command") && !wire.contains("Catalog scope:"),
"command discovery stays available under the same session grants"
);
for gone in [
"unavailable under the current prompt disposition",
"This is an Explain turn",
"cannot widen an already accepted turn",
"Do not report this refusal",
] {
assert!(!wire.contains(gone), "{gone:?} is back on the wire");
}
assert!(
!ws.path().join("README.md").exists(),
"a refused write must not write"
);
}