pub struct MockWorkspaceFacade {
pub peers: Mutex<Vec<PeerStatus>>,
pub deliver_calls: Mutex<Vec<(SessionSlot, String, WrappedPrompt)>>,
pub force_deliver_error: Mutex<Option<DeliverError>>,
pub handoff_calls: Mutex<Vec<(SessionSlot, String)>>,
}Expand description
Mock for unit tests in the Tool impls. Captures every dispatched call into a Vec so tests can assert “tool X dispatched deliver_peer_prompt with these args” without spinning up a real Workspace.
Fields§
§peers: Mutex<Vec<PeerStatus>>Pre-loaded peer status snapshot returned by list_peers.
deliver_calls: Mutex<Vec<(SessionSlot, String, WrappedPrompt)>>Captured calls to deliver_peer_prompt.
force_deliver_error: Mutex<Option<DeliverError>>If set, deliver_peer_prompt returns this error instead of
running the normal lookup path. Lets tests force-test the
failure surface.
handoff_calls: Mutex<Vec<(SessionSlot, String)>>Captured calls to handoff.
Implementations§
Trait Implementations§
Source§impl Default for MockWorkspaceFacade
impl Default for MockWorkspaceFacade
Source§impl WorkspaceFacade for MockWorkspaceFacade
Available on crate features testing only.
impl WorkspaceFacade for MockWorkspaceFacade
Available on crate features
testing only.Source§fn list_peers(&self) -> Vec<PeerStatus>
fn list_peers(&self) -> Vec<PeerStatus>
Snapshot of every configured project’s peer status, in
forge.toml declaration order. Computed fresh on each call.
Source§fn whoami(&self, caller: &SessionSlot) -> Option<PeerStatus>
fn whoami(&self, caller: &SessionSlot) -> Option<PeerStatus>
Identity of the calling session. Returns
None when caller
doesn’t resolve to any known project (defensive - the tools
closure-bind a real key at spawn time, so this should be
Some in practice).Source§fn deliver_peer_prompt(
&self,
caller: &SessionSlot,
target_project: &str,
wrapped: WrappedPrompt,
) -> Result<(), DeliverError>
fn deliver_peer_prompt( &self, caller: &SessionSlot, target_project: &str, wrapped: WrappedPrompt, ) -> Result<(), DeliverError>
Deliver a wrapped peer prompt to
target_project. Read moreSource§fn handoff(
&self,
caller: &SessionSlot,
note: String,
) -> Result<(), HandoffError>
fn handoff( &self, caller: &SessionSlot, note: String, ) -> Result<(), HandoffError>
The exit call: the note is accepted only while a handoff is running on
the caller’s own seat. A handoff starts at
/handoff or at the
automatic trigger (fill or compaction), which dispatch the command
directly; no caller starts one through here.Auto Trait Implementations§
impl !Freeze for MockWorkspaceFacade
impl !RefUnwindSafe for MockWorkspaceFacade
impl Send for MockWorkspaceFacade
impl Sync for MockWorkspaceFacade
impl Unpin for MockWorkspaceFacade
impl UnsafeUnpin for MockWorkspaceFacade
impl UnwindSafe for MockWorkspaceFacade
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more