Commit Graph
3 Commits
Author SHA1 Message Date
Lauri Ojansivu fbea673a1b Compact finished Sync rule plans after 90 days.
Maintainer decision of 2026-09-30: receipts are compacted after 90 days to
a permanent minimal id and outcome. A stored rule plan keeps the whole
documents of the rules and actions it matched - a send-email action's
recipients and text among them - and was kept forever; its 'rules' receipt
had no time, so it could not be told old.

runStoredSyncRules now writes a completion receipt with its time once every
action is done, and the shared plan retention compacts the plan in place
SYNC_RECEIPT_METADATA_DAYS (90) later. A replay of the compact form returns as
done; every other stage that needs the whole plan - email command capture,
archive capture - refuses the stub, and the legacy email review treats a
command whose plan is compacted as finished, never rebindable. Action
receipts stay, and rule email commands keep their own schedule.

A MongoDB test covers compaction, the untouched unfinished plan, replay and
the legacy review; the full-app rule test compacts a finished plan and
replays it. 565 server tests pass.

Thanks to xet7 !
2026-09-30 11:42:51 +03:00
Lauri Ojansivu 1e342170b9 Compact finished rule email commands after 90 days.
Maintainer decision of 2026-09-30: receipts are compacted after 90 days
to a permanent minimal id and outcome, as the notification outbox does.
A rule email command keeps the whole mail - body and attachments up to
12 MB - and its outcome row keeps recipient addresses, forever. Now,
once an attempt is sent or dropped, is older than
SYNC_RECEIPT_METADATA_DAYS (90), and its rule invocation has a receipt
- after which no replay reads the mail - the command is replaced in
place by its _id, checksum, invocation, plan and effect ids, and the
outcome row is removed. The attempt row, already minimal, stays as the
receipt a late retry finds. A command whose checksum no longer matches
its attempt, or that has no receipt yet, is left for a later pass.

The recovery detail returns an empty recipient list for a compacted
command (only finished attempts are compacted, and none can be resolved
again), and the legacy review no longer counts compacted rows. The
sweep runs hourly (SYNC_RECEIPT_SWEEP_INTERVAL_MS).

A MongoDB test compacts only the old finished command with a receipt,
leaves the one without a receipt, the recent one and the unconfirmed one,
repeats without change, reads the compact form in both readers, and
refuses a command that no longer matches its attempt.

Thanks to xet7 !
2026-09-30 10:23:15 +03:00
Lauri Ojansivu f5d20a18d7 Let administrators review legacy rule emails instead of leaving them stuck.
A rule email prepared before commands recorded their source (no source
binding), or one with card Details whose binding predates the related-
source chain, is refused by dispatch and was waiting for a recovery that
did not exist. Admin Panel -> Problems -> Recovery now lists them with
their board, card, recipients, subject and reason. Nothing runs them
automatically. An administrator re-binds one - its content is prepared
again from the card as it is now, after re-checking that the rule's
author is enabled with write access and that the rule and action are
unchanged - or discards it, which records a dropped attempt so the rule
stage completes without mail. Each decision writes one immutable audit
record, is serialized per command, and is final once an attempt exists.

Unit, MongoDB integration and source tests cover listing, re-bind,
discard and every refusal, and pin that only the admin methods call
them; a Playwright case covers review and discard. New interface text is
in English, pending translation.

Thanks to xet7 !
2026-09-30 01:49:49 +03:00