Repository navigation
Keep legacy query preparation in replay mode - #1658
Conversation
1084111 to
254769c
Compare
| .to_path_buf() | ||
| // Shared build caches can reuse a runner compiled in another worktree. Cargo's runtime | ||
| // manifest directory identifies the checkout being tested, unlike the compiled-in path. | ||
| let manifest_dir = env::var_os("CARGO_MANIFEST_DIR") |
| #[allow(clippy::large_enum_variant)] | ||
| enum WFCommandVariant { | ||
| /// Returned when we need to wait for the lang sdk to send us something | ||
| NoCommandsFromLang, |
There was a problem hiding this comment.
Just wasn't doing anything useful any more
| } else if results.iter().any(|cmd| { | ||
| !matches!( | ||
| &cmd.variant, | ||
| WFCommandVariant::UpdateResponse(response) | ||
| if matches!(response.response, Some(update_response::Response::Rejected(_))) | ||
| ) | ||
| }) { |
There was a problem hiding this comment.
Not that humans read code anymore, but a comment (or switching to an all vs negated any bc that makes more sense in my brain for some reason) explaining the condition we're checking would help.
There was a problem hiding this comment.
My hope here was the returned error clarifies stuff - it's just looking for anything that isn't a rejected update.
| panic!( | ||
| "Got a new WFT while there are outstanding local activities, but there \ | ||
| was no waiting on LA info." |
There was a problem hiding this comment.
Self: not fully understanding why this is no longer a concern
There was a problem hiding this comment.
It's now possible that we might want to start an LA during replay while servicing a query, but, we don't dispatch it because we're servicing a query and not a new task.
Then, we might get a real task, at which point we now can in fact dispatch that LA for execution. So, there was no waiting on la info at that point (but there will be after we dispatch it)
254769c to
013dec1
Compare
What was changed
replayingwhile preparing to serve a legacy query, including when its history contains trailing events or an already-started workflow task. Local activities without recorded results remain pending instead of executing during query playback.Why?
Legacy queries cannot produce workflow commands. Previously, reaching the end of query history could end replay and dispatch local activities whose commands were discarded. This could duplicate side effects and leave cached runs in an invalid state or stuck. Query preparation must remain replay-only while preserving the cache for the next real workflow task.
Checklist
Closes [Bug] Legacy query task executes local activities; the cached run can then hit "invalid state MarkerCommandCreated" or wedge #1644
How was this tested:
timeout 180 cargo integ-test workflow_tests::— 357 passed, 1 ignored; includes the four regression cases and recorded-marker replay tests.cargo test -p temporalio-sdk-core --lib— 492 passed, 2 ignored.timeout 180 cargo integ-test legacy_query— 10 passed with the ephemeral server before the final notification-site refactor; the subsequent workflow test run covers that refactor.origin/main:timeout 180 cargo integ-test --server-kind external legacy_query_must_not_execute_local_activity— all four cases passed; this test uses mocked server responses.cargo lint,cargo +nightly fmt, andgit diff --checkpassed. Lint and diff checks were rerun on the new base.Any docs updates needed?