Phase 11, step 2: the journal's daily anchor by mail
CI / secret scan (push) Successful in 7s
CI / fmt, clippy, tests (push) Successful in 50s
CI / release (push) Canceled after 34s

Every day from 07:00 Chiang Mai time the app mails the journal's last
entry number and its hash to the addresses set on the Notifications page
(src/anchor.rs, migration 0012: settings, journal_anchors), when anything
was added since the last anchor that went out. A day without news is
noted without a mail; a failed send is tried again after an hour; a
transaction-level advisory lock keeps two runs from both sending. "Send
the anchor now" sends at once. Each mail says whether the chain checked
whole (in capitals when it did not) and links to /journal/anchor, which
compares a kept entry number and hash with the journal now: the same
hash, another one, or no such entry. Changing the recipients is itself a
journal entry. Every anchor mail is in the notifications log.

Tests: the daily rule (before seven, once a day, an hour after a
failure), recipients checked and journaled, one mail per recipient with
the head hash, unchanged days, by hand, the check page's three answers,
and a chain broken around the app said in the mail. 126 unit, 67
integration.
This commit is contained in:
grabowski committed 2026-11-22 23:02:20 +07:00
1 parent 94ad25b6fc
commit 72a4faf71a
14 files changed
+990 -22

No files matched your search

+13 -4
View File
@@ -246,7 +246,7 @@ dark at desktop and phone width, a commit and a push.
| 8 | Reminders by Matrix room message and by email; text messages later | mail and the Notifications page built Nov 22, 2026 |
| 9 | The legal practice: lawyers, clients (Thai and foreign, people and organizations), general and artist contracts with versions that never change, paper copies with ids and places, the journal as a hash-chained ledger | built Nov 21, 2026 |
| 10 | One client list: a visa record becomes part of a client; People becomes the visa clients | planned Nov 21, 2026 |
| 11 | The conflict check and the other parties of a contract; the journal's last hash sent outside the server each day | step 1 built Nov 22, 2026 |
| 11 | The conflict check and the other parties of a contract; the journal's last hash sent outside the server each day | built Nov 22, 2026 |
| later | Thai user interface, agency cases and fees, other visa categories' packs | |
### Phase 1: app, login, people
@@ -709,9 +709,18 @@ the note go into the journal entry of the client or party. A check without
a match is noted too. `/conflicts` runs the check alone before a first
meeting and saves nothing.
**Step 2 (next).** Once a day the app sends the journal's last entry
number and hash outside the server (email, a Matrix room), so a journal
rebuilt by someone with database access no longer matches the copies.
**Step 2 (built November 22, 2026).** The journal's anchor
(`src/anchor.rs`, migration 0012). Every day from 07:00 Chiang Mai time
the app mails the journal's last entry number and its hash to the
addresses set on the Notifications page, when anything was added since
the last anchor; a day without news is noted without a mail, a failed
send is tried again an hour later, and "Send the anchor now" sends at
once. The mail says whether the chain checked whole, and in capitals when
it did not. A change of the recipients is itself a journal entry. Kept
outside the server, the mails show later that nobody rebuilt the journal:
`/journal/anchor?seq=…&hash=…` (linked from each mail and the Journal
page) says whether the entry still has that hash, has another one, or is
gone. A Matrix room can be a second place for it once phase 8 has one.
## Open questions