Merge branch 'main' into feat/tui-msgid-join
All checks were successful
ci / test (pull_request) Successful in 4m10s

This commit is contained in:
sirius 2026-09-12 22:10:54 +00:00
commit 18ccab5464
16 changed files with 897 additions and 195 deletions

View file

@ -10,7 +10,7 @@
//!
//! The offline half of this contract — the Arti-status projection, the WAL
//! checkpoint, and the SDK's typed error after shutdown — runs in the normal
//! suite (`tests/hs.rs`, `src/node.rs`, `crates/onionwire-sdk/src/lib.rs`).
//! suite (`tests/hs.rs`, `src/store.rs`, `crates/onionwire-sdk/src/lib.rs`).
use onionwire::node::{FlushOutcome, Node};
use onionwire::hs::TorState;
@ -52,10 +52,25 @@ async fn shutdown_stops_the_node_and_later_calls_are_typed_errors() {
"start returned Ok but tor_state() is {started_state:?}"
);
// Rows written by `start` (self row, current onion) are still in the WAL at
// this point: no checkpoint has run, and the connection that wrote them is
// still open.
let wal = home.join("onionwire.db-wal");
let before = std::fs::metadata(&wal).map(|m| m.len()).unwrap_or(0);
assert!(
before > 0,
"expected pending WAL frames before flush, got {before}"
);
// A flush with nothing queued is a no-op that reports it, not an error.
let drained: FlushOutcome = node.flush().await.expect("flush on a live node");
assert_eq!(drained.remaining, 0, "empty outbox: {drained:?}");
// `flush` promises a truncated WAL, and on an encrypted store that only
// works through the store's own keyed connection.
let left = std::fs::metadata(&wal).map(|m| m.len()).unwrap_or(0);
assert_eq!(left, 0, "flush left {left} bytes of WAL to replay");
node.shutdown().await.expect("shutdown");
assert_eq!(