fix: Forward the gated event from the Time Gate - #6873
Open
claykaufmann wants to merge 1 commit into
Open
claykaufmann wants to merge 1 commit into
claykaufmann wants to merge 1 commit into
Conversation
The Time Gate emitted an empty object when it released an event that it had held. Downstream nodes received no payload, so every expression that read the gate output resolved to nothing. The component emits from two paths. Execute() emits the incoming event when the current time is already inside the window. The timeReached and pushThrough hooks emit when the gate actually waited, but hooks run with an ActionHookContext, which does not carry the event data. Both hooks sent a literal empty map instead. The result was silent and depended on timing: the same canvas kept the payload when the window was open and dropped it when the gate deferred. Store the event in the execution metadata when the gate defers, then emit that event from both hooks. Executions with no stored event keep the previous empty object, so in-flight executions stay valid. Signed-off-by: Clay Kaufmann <claykaufmann@gmail.com>
Contributor
|
👋 Commands for maintainers:
|
Contributor
|
Maintainers: comment |
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.
Summary
The Time Gate drops the event payload whenever it actually gates.
The component emits from two paths:
Execute()emits the incoming event when the current time is already inside the active window (time_gate.go#L176).HandleTimeReachedandHandlePushThroughemit when the gate waited. Hooks run with anActionHookContext, which does not carry the event data, so both sent a literalmap[string]any{}.ExecutionStateContext.Emitwrites that payload directly to thedatafield of the event that downstream nodes consume, andPassInTransactionadds no fallback. Downstream nodes therefore receive{}, and every expression that reads the gate output resolves to nothing.The failure is silent and depends on timing. The same canvas keeps the payload when the run starts inside the window and drops it when the gate defers. Deferring is the normal case, so a "release at 09:00" gate loses the payload every day, while a manual test run during business hours looks correct.
This also contradicts the component documentation, which describes the gate as delaying event processing rather than replacing the event.
Fix
Store the event in the execution metadata when the gate defers, then emit that event from both hooks. Executions that stored no event keep the previous empty object, so executions already in flight during a deploy stay valid.
The change stays inside the component. Adding
Datatocore.ActionHookContextwould work too, but it touches the framework and the other hook-based components synthesize their own payloads on purpose.Test plan
TestTimeGate_TimeReached_ForwardsGatedEvent— the gate defers, thentimeReachedemits the original event. Fails onmainwithdata = {}.TestTimeGate_PushThrough_ForwardsGatedEvent— same for the manual push-through action.TestTimeGate_ForwardsGatedEventStoredAsJSON— the payload survives the JSON round trip thatExecutionMetadataContextperforms.TestTimeGate_EmitsEmptyObjectWhenNoEventStored— executions with no stored event still emit{}.gofmtandgo vetare clean for the package.docs/components/Core.mdxis updated for the new documentation line.The new tests select tomorrow as the only active day, so the gate always defers and the tests do not depend on the wall-clock time at which CI runs them.