fix(mcp): after a close is answered nothing of this process can write to the book, and a close says when its last backup wasn't whole
A close ended with the process still alive, so the faults that process exit used to bound now lived on: something of the server's own could still write to a book that was reported closed, or, once the book was opened again (here or by another process), to the new book's files. One rule now: after a close is answered this process holds nothing that writes to the book's folder, and every path that touches the book is either counted by its gate or checks, under the lock of its own write, that the book is still open. The close answers only when that is true. * A refusal's access record is written by a task that carries the request's place inside the door, so a client hanging up no longer leaves the record to land after the close; the access log, uploads, exports and backups are closed under their own locks by the close, so a record, sweep or run still on its way is refused, unwritten. * A restore over an open book lets go as a close does (drain, sessions, backups, closing the logs) before it moves the book to legacy/: an upload half received no longer leaves its part in legacy/ nor writes to the replaced book's log after. * The backup at a close is bounded, and a run past its bound is stopped (git killed with all it started) and waited for to end, instead of its future being dropped while its blocking task went on; the close answers closed_backup_incomplete, with why, when the last backup wasn't whole. The server's own close does the same. * Every timer (the sweep, the look for a backup due, the look for a drill due) works on handles closed with the book; the sweep also takes its place inside the door. They take --timers for tests. * A format upgrade, run, drill and record through a backup handle from before a close do nothing. * A call whose answer isn't read within the grace is the case of a connection dropped at any other moment: its record, written before its answer, says it ran. No journaled call carries a client key or a duplicate check, so a retry isn't made safe; said in INVARIANT 14, and left as an open design point. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
181859d801
commit
26b42c6d01
9 files changed
+1723
-148
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -187,6 +187,13 @@ impl Server {
|
||||
Self::spawn(home, home.dir.path(), &[], args)
|
||||
}
|
||||
|
||||
/// [`Server::start`], with `env` beside the home's own and these
|
||||
/// arguments after the root (a PATH with a stand-in git first, a
|
||||
/// shortened timer).
|
||||
pub fn start_full(home: &Home, env: &[(&str, &Path)], args: &[&str]) -> Self {
|
||||
Self::spawn(home, home.dir.path(), env, args)
|
||||
}
|
||||
|
||||
/// [`Server::start`], in the folder `cwd`, with `env` beside the
|
||||
/// home's own (INVARIANT 1).
|
||||
pub fn start_in(home: &Home, cwd: &Path, env: &[(&str, &Path)]) -> Self {
|
||||
@@ -352,6 +359,16 @@ impl Wire {
|
||||
}
|
||||
}
|
||||
|
||||
/// The MCP session this wire opened (after `initialize`).
|
||||
pub fn session(&self) -> Option<&str> {
|
||||
self.session.as_deref()
|
||||
}
|
||||
|
||||
/// The protocol version this session negotiated.
|
||||
pub fn version(&self) -> Option<&str> {
|
||||
self.version.as_deref()
|
||||
}
|
||||
|
||||
/// The token this session sends.
|
||||
pub fn token(&self) -> Option<&str> {
|
||||
self.token.as_deref()
|
||||
|
||||
Reference in new issue
Block a user