CHASM return same timestamp from context.Now() within same MutableCtx#10506
Open
awln-temporal wants to merge 3 commits into
Open
CHASM return same timestamp from context.Now() within same MutableCtx#10506awln-temporal wants to merge 3 commits into
awln-temporal wants to merge 3 commits into
Conversation
rodrigozhou
reviewed
Jun 4, 2026
rodrigozhou
left a comment
Contributor
There was a problem hiding this comment.
Can you add more details to the PR summary? What's the motivation for this change? What problem is it solving?
| type mutableCtx struct { | ||
| *immutableCtx | ||
|
|
||
| nowByComponent map[*Node]time.Time |
Contributor
There was a problem hiding this comment.
Can we call something else than "now" given that it's not really "now" after the first call?
Contributor
Author
There was a problem hiding this comment.
hm, what do you think this should be called? The method to access it is Now(), do you think if the map name was like cachedNowTimeByComponent that would be better?
51d7d32 to
d75dd38
Compare
rodrigozhou
reviewed
Jun 9, 2026
| type mutableCtx struct { | ||
| *immutableCtx | ||
|
|
||
| now **time.Time |
Contributor
There was a problem hiding this comment.
Why double pointer here?
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?
Return same timestamp from context.Now() within same MutableCtx
Why?
Within each task execution, we are adding semantics that access from Now() in MutableCtx returns the same timestamp.
Rather than storing each timestamp locally within task execution, it's more convenient to return the same timestamp for each Now() call.
There are no guarantees across multiple tasks in the same transaction since it's not guaranteed a pure physical task execution will result in multiple logical tasks being ran, so we should treat tasks as isolated units.
How did you test it?