addMember and removeMember join the durable card-field actions. The people
are resolved at capture exactly as performAction resolves them - the acting
user for the #2522 option, username tokens through buildRuleVars (#4294),
and the card's assignees for "remove every member" (#2674) - by a new
RulesHelper.resolveMemberTargets beside it, and saved with their usernames,
so a replay acts on the same people. The ordinary action's one $addToSet or
$pull per person becomes one planned change of `members`, with a joinMember
or unjoinMember activity for each person who really joined or left, as the
members hook writes it, and one members History row.
The new helper phrases its conditions so the source guards that locate
performAction's member branch still find it, and the recording-isolation
test now uses assignees as its example of a field that is never deferred.
Unit tests cover resolution being saved, joins and leaves, nobody resolved
and tampered targets; the full-app durable Sync test adds a member to every
created card through a rule - one joinMember activity and one members
History row. 565 server tests pass.
Thanks to xet7 !
setDate, updateDate, setDateRelative and removeDate join the durable
card-field actions. Their semantics follow the ordinary actions exactly:
setDate only fills a date that is unset, updateDate always sets it,
setDateRelative offsets from "now", removeDate unsets - with "now" fixed at
the command's capture time, so a replay makes the same change.
A full-app probe of the ordinary writes showed what they record: a dates
History row (added, edited or removed) and the timing hook's a-<field>
activity with username, card title, time key and the old value ('' when
there was none) - and no timeValue when the date is removed. The command
plans exactly that. The timing hook in server/models/cards.js gains a
'timing' deferral kind so the saved activity is written instead of the
hook's own, never both; the runner can now unset a field as well as set it.
Unit tests cover all four actions, setDate on a filled date, the timing
activity's shape for set and unset, and a replay-stable relative date; the
full-app durable Sync test gives every created card a due date through a
rule - one a-dueAt activity and one dates History row. 565 server tests pass.
Thanks to xet7 !
Boards with any rule action other than email and archive stayed on direct
Sync. Six more now take the durable path: setColor, addLabel, removeLabel,
removeAllLabels, markCardComplete and markCardIncomplete.
Each rule invocation saves one command (server/lib/syncRuleCardCommand.js)
with its card field's value before and after the action - with the ordinary
action's semantics: $addToSet/$pull for single labels, a missing field stays
missing on removeLabel, 'white' is stored as null - and the effects the
ordinary hooks would write: one History row for the field and, for
addLabel/removeLabel, the addedLabel/removedLabel activity only when the
label really changed (removeAllLabels writes none, as ordinarily). The runner
applies the saved change conditionally with ordinary History deferred for
that one write, then writes the planned History rows and activities, each
activity delivered durably with its own rules and notifications, and returns
the invocation only when all of it is confirmed. Replays use the saved
command, never the rule's current configuration.
The History planner is parameterized by allowed fields (Sync's own, or these
three), and the recording deferral covers labelIds, color and dueComplete.
Unit tests cover every action, the effects, absent-versus-null selectors and
tampering; the full-app durable Sync test labels every created card through
a rule - one History row, one activity, nothing more on replay. The rule
selection test's example of an action without an adapter is now
moveCardToTop. 565 server tests pass.
Thanks to xet7 !