Expand description
The label log: what you said of messages, spam or not, for the spam
filter to learn from. One JSON line per act, added at the end of a file
and never rewritten: “Junk” and “Not junk” (the Mail page, sioul mail),
“Spam” and “Not spam” (the Porch’s review queue, the Reader), a sender
blocked from one of their messages.
Each device writes its own log, $XDG_STATE_HOME/sioul/spam/labels/<device>.jsonl
(own_log: the device’s name in the sharing, a UUID made once), and
reads every device’s: the logs travel sealed, with the part “Spam
filter” (sioul-sync’s share), so that a message you said is not spam on
one device is never flagged again on another, and the training, on your
computer, learns from what you said on your phone. Before the logs were
shared, each device kept one, labels.jsonl: still read, and moved into
this device’s own the first time it writes.
A line names its message as its server does (the account, the folder, its UIDVALIDITY and UID) and by its Message-ID; never by its text: no subject, no address, no word of it.
{"at":1791360000,"account":"home","folder":"INBOX","uidvalidity":1700000000,"uid":4521,"message_id":"abc@example.org","label":"ham","source":"not-spam"}The newest line about a message, every device’s together, wins, and the
log wins over everything else: the folders and keywords the message is
found in, and the filter’s own verdicts. Those are never written here but
kept apart, in the same way, one file per device: what it moved into a
Junk folder (the matrix’s “Move to spam”) under moved/ (Moved), what
it flagged where it is (the matrix’s “Flag only”) under flagged/
(Flagged). The Porch lists them among the filter’s catches; the
training learns from them as they are until you say otherwise: what was
moved, as spam, as all mail in a Junk folder; what was flagged as
probably spam, as spam; what was flagged as maybe spam, not at all, a
doubt being no label, until you say.
Structs§
- Entry
- One act, one line.
- Moved
- One message your own filter moved into its account’s Junk folder (the
matrix’s “Move to spam”), from where it was; in the log of what it
flagged (
Flagged), one it flagged where it is. No word of yours: the Porch lists it among the filter’s catches while it is there, and the training learns from it as the module says, until you say otherwise.
Enums§
Constants§
- FILE
- The older single log’s file name, in the spam filter’s state folder.
- FLAGGED
- The folder of the logs of what your own filter flagged where it is, one file per device.
- FOLDER
- The folder of the label logs, one file per device.
- LOOKED 🔒
- How long the logs’ folder listing is trusted before it is looked at again: the Porch asks about each message it sorts.
- MOVED
- The folder of the logs of what your own filter moved, one file per device.
Functions§
- append_
to - Adds
lineat the end of the log atpath: one line written whole, under the file’s lock (filelock), so two writers never mix their lines. The file is made yours alone, in a folder of yours alone (Unix). - file_
safe 🔒 - A device’s name as a file name: letters, digits,
-and_. - kept 🔒
fon every device’s label log, read again when one of the files changed (its size or its time) or came: the folder is looked at again after two seconds at most.- logs_in 🔒
- The logs in a folder, every device’s (
*.jsonl, by name), andolderbefore them when it is there. - message_
id_ 🔒of - A stored message’s Message-ID, bare, read from its headers alone (the first 256 KB of the file at most), as its card reads it.
- newest_
by_ message_ id - The newest entry about each message, by its Message-ID: the copies of
one message in several folders or accounts are one.
entriesoldest first. - newest_
for - The newest entry about one message, as its server names it.
entriesoldest first. - own_
flagged_ log - This device’s own log of what your filter flagged where it is under
root,flagged/<device>.jsonl. - own_log
- This device’s own label log under
root(the spam filter’s state folder),labels/<device>.jsonl;deviceis its name in the sharing (a UUID made once: sioul-sync’sshare::Here). The older single log, this device’s own, becomes it the first time. - own_
moved_ log - This device’s own log of what your filter moved under
root,moved/<device>.jsonl. - read_
all - Every device’s label log, here:
read_all_inof this device’s state folder. - read_
all_ in - Every entry of every device’s label log under
root(the spam filter’s state folder), the older single log’s too, oldest first: by when you said it, then in the order written. - read_
flagged_ in - Every device’s log of what your filter flagged where it is, under
root, oldest first. - read_
from - Every line of the log at
path, in the order they were written; a line that cannot be read, cut by a crash or written by a later Sioul, is left out. - read_
judged 🔒 - Every line of the logs of
folder(moved/,flagged/), oldest first. - read_
moved_ in - Every device’s log of what your filter moved, under
root, oldest first. - said_
ham - Whether you said the message on
cardis not spam, here, on another device or in another mail client, so that the Porch keeps your filter’s word and your provider’s off it for good: the$NotJunkkeyword without$Junkin its file name (kept by each sync:maildir::keywords_of); else every device’s label log, whose newest entry about this message says so. - said_
ham_ in - Whether the newest entry of
entries(oldest first) about the message oncardsays it is not spam: an entry of its account with its Message-ID, wherever the message was then (the logs of other devices name it by the folder it was in there); for a message without one, an entry without one at its very place (its UIDVALIDITY and UID). - seal_of 🔒
- state
- The spam filter’s state folder on this device:
$XDG_STATE_HOME/sioul/spam. - unreviewed
- Whether a message your filter moved or flagged is still as it judged
it: no entry of the label logs (
entries, oldest first) about it since.
Type Aliases§
- Flagged
- One message your own filter flagged where it is (the matrix’s “Flag
only”) as it arrived: the same line as a move, in its own log
(
flagged/). The training learns a probable spam flagged so as spam, and leaves a maybe spam out, until you say. - Seal 🔒
- What the logs’ files were when read: their names, sizes and times.