Commit Graph
7 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 12e98cdbfe Let a rule's later actions follow its card to another board, so a cross-board move need not be last.
The ordinary rule engine reads the card by id for every action, so the
actions after a move to another board act on the card there. The
durable commands that can do the same now find the card where a saved
move of the same plan put it, and record their writes, History rows and
activities on that board: card fields, checklist toggles, adding and
removing checklists, linking, and the title variables of a new card or
swimlane. A copy refuses, as the ordinary copy does. A move to another
board is no longer required to be the plan's last action. It is lifted
when every action that can follow it in a plan, in its own rule or in a
rule of the same trigger type, is one of these. Moves, sorting and
moving all cards are resolved against the board the card left, and
archiving cascades to child cards there, so with any of those the board
keeps direct Sync.

Thanks to xet7 !
2026-10-03 00:22:57 +03:00
Lauri Ojansivu 32d1abeffe Make rule moves to another board durable when both boards opted in.
A moveCardToTop or moveCardToBottom rule onto another board now runs its
saved command. The card is updated once, conditionally, with every hook
record deferred, and each record is written from the command: History
rows, the legacy undo row, re-homed checklists, the dependencies left
behind on the old board, attachment placement, re-pointed label
activities, the moveCardBoard activity and the custom-field activities.
The server test compares the result with the ordinary Card.move.

Every other durable command acts on the card on the plan's board, so
such a move must end its rule plan. The command refuses any other
position before writing anything. Eligibility counts the move only when
it is the last action of its rule and no other rule on that board fires
on the same activity type; the destination must have opted in too.

The rule guard follows the card to the board this plan moved it to. The
activity's notification and webhook stages judge recipients on the card
as placed for the activity. Before, they refused a card that a rule had
moved, which would have failed any run whose moved card had a watcher
or a webhook, also for moves on the same board.

Moving all cards of a list to another board stays on direct Sync.

Thanks to xet7 !
2026-10-02 19:10:32 +03:00
Lauri Ojansivu d82a54944a Finish a durable Sync run whose rule moved or archived the card it synced.
A Sync step's rules run after its card write, and since rules may move a
card to another list or archive it, the card can afterwards match
neither the step's before-state nor its after-state. Two things then
failed:

- An interrupted run never recovered. The replay retried the step's
  write, which could not be confirmed, so the run failed on every replay.
  The journal now treats a stored planned activity as proof that the
  write happened (activities are stored only after it is confirmed) and
  finishes the effects, which are idempotent.
- Even an uninterrupted run failed whenever a durable rule moved the card
  out of the list. The activity's notification and webhook stages ran
  after the rule and refused a card that was no longer in the activity's
  list. They now also accept the card where a saved move of that
  activity's own rules put it, and nowhere else.

A failed replay now logs why. The durable Sync server test runs a rule
that moves each new card out of the synced list, crashes after the move,
and checks that the replay completes the run with one move.

Thanks to xet7 !
2026-10-02 18:19:02 +03:00
Lauri Ojansivu ab611bcd79 Make rule links to another board durable when both boards opted into Sync effects.
As decided on 2026-10-02, a linkCard rule that links onto another board
keeps durable Sync only when that board has Sync effects enabled too and
the actor may write there. Eligibility now follows every board such a
rule reaches, because the link's creation activity runs that board's own
rules through the same stored stages; any action there without a durable
adapter keeps the source board on direct Sync. The runner checks the
destination again before each write.

A card-field rule acting on a linked card now writes the card it links
to, as the ordinary setters do through getRealId. Before, the durable
command refused a linked card, so a durable link followed by such a rule
would have failed its Sync run on every replay.

Thanks to xet7 !
2026-10-02 18:04:14 +03:00
Lauri Ojansivu b3b4962414 Run rule moves to the top or bottom of the card's own list through durable Sync.
A moveCardToTop or moveCardToBottom rule whose list and swimlane are '*'
on the card's own board only changes the card's sort. It now has a saved
command, like the card-field actions: the sort is computed once at
capture as the ordinary action computes it, the write is conditional on
the saved sort, the hook's position History row is planned and written
once, and the legacy UserPositionHistory row that Ctrl+Z reads is
written once with trackChange's redo-stack clearing. Replays apply the
saved command and change nothing more.

A move to another list, swimlane or board is reported to eligibility as
'<type>:elsewhere', so a board with such a rule keeps direct Sync.

Thanks to xet7 !
2026-10-02 15:34:18 +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