Cotton code
53 lines · 2.3 KB · JSONRaw
{  "format_version": 1,  "id": "email_bin_cut",  "name": "Deleted sender",  "plural": "Deleted senders",  "builtin": false,  "visibility": "owner",  "title": "key",  "columns": [    {      "key": "key",      "name": "Sender",      "type": "text",      "required": true,      "indexed": true    },    {      "key": "before",      "name": "Sent up to",      "type": "date",      "format": "calendar-datetime",      "required": true    },    {      "key": "at",      "name": "Covers arrivals up to",      "type": "date",      "format": "calendar-datetime",      "required": true    },    {      "key": "made_at",      "name": "Made at",      "type": "date",      "format": "calendar-datetime",      "required": true    },    {      "key": "state",      "name": "State",      "type": "text"    },    {      "key": "except",      "name": "Brought back",      "type": "longtext"    }  ],  "seal": {    "clear": []  },  "instructions": "One row per Delete of a whole sender or domain in Post, and per Block with also delete (MAIL PREDICATE phase 2, 27 Nov 2026): every mail from key (an address, or @domain for a whole domain, lower case) sent at or before `before` and landed on the server at or before `at` is in the Bin from made_at, in one write however many mails that is; mail that lands after `at` is not, whatever its date says. except is a JSON list of the email ids brought back from the Bin since. After 30 days from made_at a phone holding the keys erases the mails it covers as ordinary deletes in slices. Every reader asks cotton_rules::mail::predicate (and its TypeScript mirror), never this table itself. Written only from his own tap; sealed like the rest. made_at is when he tapped (the later of his phone's clock and the newest server time the copy knew); `at` is the newest server arrival among the mails he saw and bounds what the row covers. state is live (or absent), undone, erasing or erased: a Delete's row is never removed by a phone. Undo writes undone and a phone beginning the erase writes erasing, each a versioned write of this one row, so one wins; once nothing of it is left it is erased, and stays as the rule for what it covered: mail it covers that turns up later is erased where it is seen. Its 30 days and its Bin date run from made_at, never `at`. His own addresses are never covered."}