Skip to main content

TriageStore

Struct TriageStore 

Source
pub struct TriageStore { /* private fields */ }
Expand description

~/.mecha/mail-triage/.

Implementations§

Source§

impl TriageStore

Source

pub fn default_root() -> Result<PathBuf>

Source

pub fn open(root: impl Into<PathBuf>) -> Result<Self>

Source

pub fn open_existing_default() -> Option<Self>

Open the default location only if it exists — read paths must not create state as a side effect, the rule doctor leans on.

Source

pub fn root(&self) -> &Path

Source

pub fn list(&self) -> Result<Vec<Record>>

Every record, newest first. Unreadable rows are skipped rather than fatal: one torn file must not hide the rest of the inbox.

Source

pub fn get(&self, account: &str, thread_id: &str) -> Option<Record>

Source

pub fn is_known(&self, account: &str, thread_id: &str) -> bool

Has this thread already been classified? The question a sweep asks before spending a model call, and the reason re-running the trigger costs nothing on a quiet inbox.

Source

pub fn needs_classifying(&self, account: &str, thread_id: &str) -> bool

Whether a sweep should classify this thread.

A failed record is not an answer, and treating it as one buries mail. is_known is true for every record the store holds, failures included, so a sweep filtering on it skips exactly the threads whose classification never happened. On 2026-08-19 the local model server was down for a night and 17 threads recorded failed — among them a manuscript review invitation, which is the category with the lowest reply rate and the hardest deadlines. Every later sweep would have skipped all 17 forever, because the store had heard of them.

A transient outage must not be permanent. dismissed is excluded because that is a person’s decision rather than an accident, and classified because it is done.

Source

pub fn put(&self, rec: &Record) -> Result<()>

Source

pub fn correct( &self, account: &str, thread_id: &str, c: &Correcting, at: &str, ) -> Result<Option<Vec<Correction>>>

Record what a human did. Returns false when the thread is unknown, rather than inventing a row for it. Record that a human corrected the verdict. Returns what changed, or an empty vec when nothing did.

Corrects in place and keeps the history. The record’s verdict becomes right immediately, so the list a person reads is right immediately; the pair rides in corrections so the learner can see what the classifier said before it was told otherwise.

Source

pub fn mark( &self, account: &str, thread_id: &str, action: &str, state: &str, ) -> Result<bool>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more