Repository navigation
Conversation
moetemp
force-pushed
the
moe/brook/review/r2-withdrawals
branch
from
October 27, 2026 07:43
665fb1d to
9b5fcbc
Compare
moetemp
force-pushed
the
moe/brook/review/r1-redis-store
branch
from
October 27, 2026 07:43
f05f8bd to
e674889
Compare
moetemp
force-pushed
the
moe/brook/review/r2-withdrawals
branch
from
October 27, 2026 08:17
9b5fcbc to
b63c189
Compare
moetemp
force-pushed
the
moe/brook/review/r1-redis-store
branch
2 times, most recently
from
October 27, 2026 16:55
d154bd1 to
5434259
Compare
moetemp
force-pushed
the
moe/brook/review/r2-withdrawals
branch
from
October 27, 2026 16:55
b63c189 to
602c740
Compare
moetemp
force-pushed
the
moe/brook/review/r1-redis-store
branch
from
October 27, 2026 23:47
5434259 to
9df6e26
Compare
moetemp
force-pushed
the
moe/brook/review/r2-withdrawals
branch
from
October 27, 2026 23:47
602c740 to
0983d95
Compare
moetemp
force-pushed
the
moe/brook/review/r1-redis-store
branch
from
October 28, 2026 08:56
9df6e26 to
4ac6a50
Compare
moetemp
force-pushed
the
moe/brook/review/r2-withdrawals
branch
2 times, most recently
from
October 29, 2026 08:40
1f162d3 to
baa1d3c
Compare
moetemp
force-pushed
the
moe/brook/review/r1-redis-store
branch
from
October 29, 2026 08:40
4ac6a50 to
6f16043
Compare
moetemp
force-pushed
the
moe/brook/review/r2-withdrawals
branch
from
October 29, 2026 09:18
baa1d3c to
f5c9cf3
Compare
moetemp
force-pushed
the
moe/brook/review/r1-redis-store
branch
from
October 29, 2026 09:18
6f16043 to
a08b2a8
Compare
moetemp
force-pushed
the
moe/brook/review/r2-withdrawals
branch
from
October 29, 2026 10:04
f5c9cf3 to
476d7b5
Compare
moetemp
force-pushed
the
moe/brook/review/r1-redis-store
branch
from
October 29, 2026 10:04
a08b2a8 to
4281b5a
Compare
moetemp
force-pushed
the
moe/brook/review/r2-withdrawals
branch
from
October 29, 2026 15:17
476d7b5 to
8f1f7bd
Compare
moetemp
force-pushed
the
moe/brook/review/r1-redis-store
branch
from
October 29, 2026 15:17
4281b5a to
6adb884
Compare
The Lua scripts apply the withdrawal rules of `temporalio-streams`. A Local Activity write with its run's task facts withdraws the Records of the run's failed tasks, and a retry run's first write withdraws and fences the previous run. The Redis Store declares `RUN_FENCE`.
moetemp
force-pushed
the
moe/brook/review/r2-withdrawals
branch
from
October 29, 2026 16:13
8f1f7bd to
3b554a4
Compare
moetemp
force-pushed
the
moe/brook/review/r1-redis-store
branch
from
October 29, 2026 16:13
6adb884 to
63486ac
Compare
R2's withdrawal code now returns R1's Redis error type, in the moved store.rs.
# Conflicts: # crates/streams-redis/lua/append.lua
# Conflicts: # crates/streams-redis/src/store.rs
# Conflicts: # crates/streams-redis/docs/redis.md # crates/streams-redis/lua/append.lua # crates/streams-redis/src/store.rs
Only a newer epoch's item withdraws the held epoch's Records. So the Producer's next epoch still withdraws them, as in the memory Store.
A write from an older Core gives no task facts. Its task now goes in `oa` too, so that a later write's facts can withdraw its Records.
A task can fail before its call writes, so no orphan item withdrew it. `tf|<run>` keeps the facts of the run's highest task, and an append checks its task against them.
R1 moves the Producer state to one binary p| field and decodes each script answer into a typed reply. To match the crate, R2's oa|, tf| and ow| fields now hold 24-byte task keys, and started() reads their first 8 bytes.
TaskArgs is untracked, a task with no facts, or a task with facts, and it writes the four script arguments. The script now takes an empty completed key for no facts and 8-byte failed ids, so it parses no text list.
Flag implements FromRedisValue, so the create and append replies decode their flag in the tuple, and a create flag of 1 has a unit case. The malformed facts test checks the mapped reason, not the code string.
Maple's review shaped the types, the argument encoding and the tests of this PR. Co-authored-by: Maple Xu <45406854+xumaple@users.noreply.github.com>
R1 follows the crate's new wire. R2's create keeps its withdrawal on the path that uses an existing Stream, after the conflict check, and its Local Activity task comes from the epoch's case.
R1 splits the storage reasons and closes with no Record. R2's close keeps its retry run fence, and a partial task key or short task facts are storage corrupt.
# Conflicts: # crates/streams-redis/lua/append.lua # crates/streams-redis/src/store.rs
A retry run's creates and appends withdraw the previous run, and Local Activities of three Workflow Tasks give random task facts. These rules are the longest part of the append script.
1 of 3 tasks
# Conflicts: # crates/streams-redis/tests/parity.rs
A batch gives its task facts and its run to withdraw in StreamWriter, and the orphan facts' StreamSuperseded has a writer. The create keeps its own withdraw_run.
moetemp
marked this pull request as draft
November 9, 2026 08:02
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
This PR adds the withdrawal rules of
temporalio-streamsto the Lua scripts.temporalio/sdk-rust#1703).ow|<run>|<task key>field, so the fence reads one field.tf|<run>keeps the task facts of the run's highest task. A later write of a task that these facts show never completed is fenced, since a task can fail before its call writes.oa|<run>, so a later write's facts can withdraw it.RUN_FENCE. An empty batch that withdraws a run keeps its Producer's held epoch.It depends on #1, and on
moetemp/sdk-rust#218, which has the rules and their cases. It replaces the Lua part ofmoetemp/sdk-streams#50.Why?
The orphan rule is the hardest Lua to review, so it's in its own PR.
Some Records stay, in both Stores. A failed task that no later write covers keeps its Records, and so does a failed task older than the last 100 that Core sends.
docs/redis.mdlists these and the other cases.How did you test it?
The shared Store and service suites run on Redis with the rules' cases, standalone with a replica and on a cluster of three primaries with one replica each.
tests/acl.rsalso runs an orphan append and a retry run's create with only the documented commands. A unit case checks that malformed task facts write nothing. The parity check of #1 also runs retry-run withdrawals and Local Activity task facts on both Stores. CI also runs Redis 7.0 and a FIPS build.