feat(journal): execute frozen body inputs with durable delivery and erasure fences
This commit is contained in:
@@ -615,10 +615,14 @@ async fn headless_unix_client_uses_production_history_lease_and_local_authority(
|
||||
use tokio::io::AsyncWriteExt;
|
||||
|
||||
let temp = tempfile::tempdir()?;
|
||||
// Only the transport endpoint needs a short private pathname. Persistence remains the
|
||||
// same production store exercised by the in-process Host tests above.
|
||||
std::fs::set_permissions(temp.path(), std::fs::Permissions::from_mode(0o700))?;
|
||||
let endpoint_path = temp.path().join("operator.sock");
|
||||
// Shorten only the owned endpoint's components, preserving the harness TMPDIR
|
||||
// even when it is checkout-local. No process-global cwd or external /tmp fallback.
|
||||
let socket_dir = tempfile::Builder::new()
|
||||
.prefix("")
|
||||
.rand_bytes(4)
|
||||
.tempdir()?;
|
||||
std::fs::set_permissions(socket_dir.path(), std::fs::Permissions::from_mode(0o700))?;
|
||||
let endpoint_path = socket_dir.path().join("s");
|
||||
let endpoint = standalone::UnixEndpoint::bind(&endpoint_path)?;
|
||||
let state_dir = temp.path().join("state");
|
||||
let launch = StandaloneLaunchConfig::new(
|
||||
|
||||
@@ -479,38 +479,28 @@ fn journal_response(request: &Request) -> Vec<LlmEvent> {
|
||||
}),
|
||||
);
|
||||
}
|
||||
for (index, range) in state["selected_ranges"]
|
||||
.as_array()
|
||||
.unwrap()
|
||||
let input: Value = request
|
||||
.items
|
||||
.iter()
|
||||
.enumerate()
|
||||
{
|
||||
let mut offset = range["bytes"]["start"].as_u64().unwrap();
|
||||
let mut token = Value::Null;
|
||||
loop {
|
||||
let id = format!("journal-source-{index}-{offset}");
|
||||
match result(&id) {
|
||||
Some(page) => match page["value"]["next_byte"].as_u64() {
|
||||
Some(next) => {
|
||||
assert!(next > offset);
|
||||
offset = next;
|
||||
token = page["value"]["content_token"].clone();
|
||||
}
|
||||
None => break,
|
||||
},
|
||||
None => {
|
||||
return tool(
|
||||
&id,
|
||||
"ReadJournalText",
|
||||
json!({
|
||||
"target":{"target":"source","pointer":range["source"]["pointer"]},
|
||||
"offset":offset,"limit":subjektiv::journal::MAX_JOURNAL_READ_BYTES,"content_token":token
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.filter_map(Item::as_text)
|
||||
.find_map(|text| {
|
||||
text.lines()
|
||||
.find_map(|line| line.strip_prefix("input_json: "))
|
||||
})
|
||||
.map(|json| serde_json::from_str(json).unwrap())
|
||||
.expect("saved direct Journal input");
|
||||
let input = subjektiv::journal::recording::JournalInput::decode(&input).unwrap();
|
||||
assert_eq!(
|
||||
serde_json::to_value(&input.selected_ranges).unwrap(),
|
||||
state["selected_ranges"]
|
||||
);
|
||||
assert!(
|
||||
input
|
||||
.capture
|
||||
.entries
|
||||
.iter()
|
||||
.all(|entry| input.capture.recording_text(entry.order).is_ok())
|
||||
);
|
||||
let (name, action) = if state["current_open"].is_null() {
|
||||
(
|
||||
"CreateJournalEntry",
|
||||
|
||||
Reference in New Issue
Block a user