Commit Graph
5 Commits
Author SHA1 Message Date
Lauri Ojansivu cb69750b17 Let administrators discard List Sync operations that cannot be replayed.
A saved List Sync operation whose list was removed, recreated or
reconfigured, or whose actor lost full-list write access, could never be
replayed. The replay job refused it every minute with only a console line,
and because a new Sync of the list resumes the pending operation first,
that list could not Sync at all.

Such an operation is now marked once, with one Recovery event, and a
blocked manual Sync says why. Admin Panel / Problems / Recovery lists these
operations with what they applied and their live replayability. An
instance administrator can discard one only while the same checks a replay
makes still fail. The discard holds the list's Sync lease, records one
immutable decision, then removes the saved steps and the operation marker,
reading each removal back. It writes no card: changes already applied stay
and the rest are never written. A retry or a second administrator only
finishes the removal, and a replay that finds a decided discard completes it
instead of resuming. The intent stays as evidence and the discard is
audited in Recovery.

Unit, source-wiring and negative tests cover recording once, refusing
non-administrators and replayable operations, and discarding twice; an app
test and a Playwright case cover the Recovery page. New interface text is
in English, pending Transifex.

Thanks to xet7 !
2026-10-08 11:53:06 +03:00
Lauri Ojansivu f06ecdee09 Share guard results within one check, and make rule archive a durable Sync action.
Stored Sync stages nest - a rule archive's delivery inside the rule stage,
inside activity delivery, inside the Sync journal - and every layer's guard
checks before and after by calling the guard below it twice. One innermost
check therefore re-ran every outer guard 2^depth times, and one Sync-created
card archived by a rule took 36 s, which is why archive was held back from
durable Sync (1e40e7e06).

reuseWithinEvaluation (server/lib/syncGuardWindow.js) runs each guard at most
once per evaluation: calls made while another guard's check is running share
the results of guards already checked in it. A call from ordinary work -
between stages, after an adapter or a write - starts a new evaluation and
checks everything afresh, so a policy change or a lost lease between stages
still stops the next one. A first attempt with a 100 ms reuse window missed
exactly that and was dropped. Failures never carry over, a guard reached
again through its own check runs fresh instead of waiting on itself, and the
journal's ownership read is left as it was.

With that, archive and unarchive are registered as durable rule adapters
through the stored archive runner, and boards whose rules archive or
unarchive now take durable Sync. The full-app durable Sync test runs an
"archive every created card" rule end to end: 1.1 s for the whole test. The
rule selection test's example of an action without an adapter is now
moveCardToTop. 565 server tests pass.

Thanks to xet7 !
2026-09-30 11:50:04 +03:00
Lauri Ojansivu 6ed28c41f7 Run manual and scheduled Sync through the durable journal, with replay.
The write-ahead Sync journal and its stored stages - History, activities,
rules, notifications, webhooks - were built and tested but never called:
manual and scheduled Sync wrote cards directly, so a restart mid-run lost
whatever effects had not happened yet. Maintainer decision of 2026-09-30:
finish the Scrum/Sync handoff by calling the stored stages from both.

A run now takes the durable path when it can do everything
(server/lib/listSyncSteps.js): the board enabled Sync effects (and the
instance enabled cron effects for a scheduled run), the list has a versioned
scope, and every rule action on the board - extra actions included - has a
durable adapter. Only sending email has one, so a board with any other rule
action keeps the direct writes, exactly as before; nothing that ran stops
running.

server/lib/listSyncApplication.js turns the reconcile plan into saved steps
from the stored cards, refusing a local edit made since the fetch as the
direct update would, and carrying custom fields only with a mapped estimate.
Effects are planned once with the shared planner and each step is applied
through the hooked card and activity adapters and durable delivery, as the
actor and trigger that started it. Both paths build the same new card.

A new run first finishes the list's unfinished operation, reusing the list
lease it holds instead of taking it twice. The wekan-list-sync-replay cron
job resumes interrupted operations every minute; intents now record their
trigger (version 2) so a replay runs under the same activation switches. An
operation still preparing has written nothing and is discarded - a replay has
no source data to rebuild it from.

Tests: eligibility for every condition, and step building including the
local-edit refusal (node); the direct-path suite now pins that it never calls
the durable one; a full-app run creates, updates and archives through the
journal, crashes at a card write, replays without duplicate cards or
activities, and falls back to the direct path for a rule action without an
adapter. 565 server tests pass.

Thanks to xet7 !
2026-09-30 11:29:44 +03:00
Lauri Ojansivu 5486c263a0 Bind durable Sync intents to their original actor and scope 2026-09-28 04:17:46 +03:00
Lauri Ojansivu 9f179eb7b5 Register private Sync recovery storage with list-lifetime guards 2026-09-28 04:14:39 +03:00