pub fn session_end_idempotent(
endpoint: &str,
session_id: &str,
) -> Result<Option<SessionStats>, IpcError>Expand description
End a session, treating a vanished daemon as success.
This is the shared library entry point for ending a session. It is
the contract used by the CLI’s zccache session-end <uuid>
subcommand AND by any in-process caller (e.g. soldr’s at-exit
rust-plan save) — both must agree on what “the daemon already
died” means.
§Return shape
Ok(Some(stats))— daemon was reached and returned stats for the session.Ok(None)— daemon was reached but returned no stats (session was tracked without stats), OR the daemon was unreachable at connect time. Both are no-ops from the caller’s perspective: the session is implicitly ended when the daemon dies (see #137 for the daemon-side mirror), and a caller that just wants to “end the session, don’t care if the daemon is still alive” should treat both as success.Err(IpcError)— anything else: timeouts, protocol mismatches, send/recv mid-conversation failures, daemon error responses. These are real faults and must be surfaced.
§Why a separate function
Issue #159: soldr was failing Windows CI on every main commit
because its in-process session-end (called from rust-plan save)
did not share code with cmd_session_end, so #151’s
connect-failure idempotency only applied to the CLI subprocess
path. Promoting this contract to the library lets all callers —
current and future — share the same behavior.