Files
wekan/server/lib/syncRuleRetention.js
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

15 lines
986 B
JavaScript

'use strict';
// Retention for stored Sync rule plans (maintainer decision of 2026-09-30),
// through the shared plan retention (syncPlanRetention.js). A rule plan keeps
// the matched rules' and actions' whole documents - an email action's
// recipients and text among them. Once every action of the plan is done
// (executeRulePlan confirmed its 'rules' receipt) a completion receipt with its
// time is written; SYNC_RECEIPT_METADATA_DAYS (90) later the plan is compacted
// in place. A replay of the compact form returns as done. Nothing else needs
// the whole plan by then: every action has its own receipt, and a rule email
// command is compacted on its own schedule (syncRuleEmailRetention.js).
const kit = require('./syncPlanRetention').createPlanRetentionKit('sync-rule');
module.exports = { isCompactRulePlan: kit.isCompactPlan, recordRuleCompletion: kit.recordPlanCompletion,
readCompactedRule: kit.readCompactedPlan, createSyncRuleRetention: kit.createPlanRetention };