pub struct TriageStore { /* private fields */ }Expand description
~/.mecha/mail-triage/.
Implementations§
Source§impl TriageStore
impl TriageStore
pub fn default_root() -> Result<PathBuf>
pub fn open(root: impl Into<PathBuf>) -> Result<Self>
Sourcepub fn open_existing_default() -> Option<Self>
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.
pub fn root(&self) -> &Path
Sourcepub fn list(&self) -> Result<Vec<Record>>
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.
pub fn get(&self, account: &str, thread_id: &str) -> Option<Record>
Sourcepub fn is_known(&self, account: &str, thread_id: &str) -> bool
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.
Sourcepub fn needs_classifying(&self, account: &str, thread_id: &str) -> bool
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.
pub fn put(&self, rec: &Record) -> Result<()>
Sourcepub fn correct(
&self,
account: &str,
thread_id: &str,
c: &Correcting,
at: &str,
) -> Result<Option<Vec<Correction>>>
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.