feat(host): the app's books server is a child process; the bridge says in words when the app isn't running or a company isn't open

The desktop app is the host (D-77, D-84): AppServer starts the books server
from the program's own executable, closes it by closing its input, and never
signals it. A window that dies closes the same pipe, so the books close
cleanly. A start is refused in words when host.lock or server.lock is held.
Starting writes run/app-hosted; for such a root with no host the bridge holds
no lease and starts no host, and answers 'Wanderbooks isn't running' or
'Company X isn't open' (WB-app-1, WB-app-3). Owner commands and the viewer
take a lease-less hold on the app's server instead of starting a host beside
it; closing the books and wanderbooks serve say the app has them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-21 08:58:51 -07:00
1 parent 7058fbd2b9
commit c8c0f5e0d9
7 files changed
+816 -11

No files matched your search

+3 -3
View File
@@ -83,7 +83,7 @@ pub const EXIT_ANOTHER_HOST: i32 = 3;
/// File options for what the host makes: mode 0600 on Unix; on Windows
/// the file takes the owner-only DACL its folder carries (P11c).
fn private_options() -> std::fs::OpenOptions {
pub(crate) fn private_options() -> std::fs::OpenOptions {
#[allow(unused_mut)]
let mut options = std::fs::OpenOptions::new();
#[cfg(unix)]
@@ -182,7 +182,7 @@ fn take_host_lock_within(run: &Path, wait: Duration) -> Result<Option<std::fs::F
}
/// Move a log larger than LOG_LIMIT aside, then open it for appending.
fn open_log(path: &Path) -> std::io::Result<std::fs::File> {
pub(crate) fn open_log(path: &Path) -> std::io::Result<std::fs::File> {
open_log_within(path, LOG_LIMIT)
}
@@ -195,7 +195,7 @@ fn open_log_within(path: &Path, limit: u64) -> std::io::Result<std::fs::File> {
}
/// The executable the server is started from (INVARIANT 3).
fn children_executable() -> PathBuf {
pub(crate) fn children_executable() -> PathBuf {
if cfg!(target_os = "linux") {
PathBuf::from("/proc/self/exe")
} else {