Skip to content

Fixed runTask returns undefined for eventTrigger problem #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 17, 2025

Conversation

chrisli30
Copy link
Member

  • Fixed operator eventTrigger not capturing all ERC20 transfer problem (Fixed operator eventTrigger not capturing all ERC20 transfer problem #329)
  • Fix operator failed to notify aggregator on task trigger problem - Fixed critical bug in MustStart() where tasks were loaded using storage key instead of task ID, added database fallback, enhanced variable resolution with dual-access mapping, improved preprocessing in node runners, added comprehensive logging
  • Fix unnecessary stack trace in event trigger query optimization warning - Changed Warn to Info level since this is informational, not an error requiring debugging
  • Fixed runTask returns undefined for eventTrigger problem

@chrisli30 chrisli30 requested a review from Copilot June 17, 2025 00:16
…xed critical bug in MustStart() where tasks were loaded using storage key instead of task ID, added database fallback, enhanced variable resolution with dual-access mapping, improved preprocessing in node runners, added comprehensive logging
…ng - Changed Warn to Info level since this is informational, not an error requiring debugging
@chrisli30 chrisli30 force-pushed the chris-fix_event_trigger_undefined_return branch from b6e4083 to 4231ce0 Compare June 17, 2025 00:17
Copilot

This comment was marked as outdated.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes event-trigger handling and runTask output, enhances variable preprocessing and dual-access mapping (camelCase and snake_case), improves logging levels, and updates tests for new behaviors.

  • Added dual-access mapping (CreateDualAccessMap) for node outputs and inputs to support both naming conventions.
  • Refactored text preprocessing in ETH transfer and contract read processors to apply variable mapping.
  • Extended engine startup and aggregation to use task IDs correctly, added DB fallback, and enriched event data.
  • Changed log level for duplicate-query warning and optimized stack trace visibility.
  • Updated numerous tests to reflect camelCase key usage and added comprehensive dual-access tests.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
core/taskengine/vm_secrets_test.go Inlined key collection in tests; potential unmatched braces issue.
core/taskengine/vm_runner_eth_transfer.go Preprocesses destination and amount with variable mapping.
core/taskengine/vm_runner_contract_read.go Preprocesses call data and method name before executing contract calls.
core/taskengine/vm_runner_branch.go Unified condition preprocessing using variable mapping.
core/taskengine/vm.go Added dual-access mapping for output vars and trigger inputs.
core/taskengine/trigger/event.go Changed duplicate-query warning from Warn to Info.
core/taskengine/smart_variable_resolution_test.go Added tests for dual-access variable support and debug helpers.
core/taskengine/run_node_immediately.go Applied dual-access mapping to VM inputs; removed original key-logging args.
core/taskengine/executor_test.go Updated filter expressions to use camelCase.
core/taskengine/engine_trigger_output_test.go Updated trigger data mapping tests to expect camelCase keys.
core/taskengine/engine.go Fixed startup task ID loading, added DB fallback, enriched event triggers.
core/taskengine/enrich and mapping methods Improved event enrichment logging and mapping, updated helper signatures.
Comments suppressed due to low confidence (4)

core/taskengine/vm_runner_branch.go:183

  • [nitpick] Both branches call preprocessTextWithVariableMapping, making the if strings.Contains branch redundant. You can simplify this to a single call to preprocessTextWithVariableMapping regardless of template delimiters.
processedExpression = r.vm.preprocessText(processedExpression)

core/taskengine/vm_runner_contract_read.go:94

  • [nitpick] The variables callData and calldata are very similar and may be confusing. Consider renaming the preprocessed string to preprocessedCallData to clearly distinguish it from the byte slice calldata.
callData := r.vm.preprocessTextWithVariableMapping(methodCall.CallData)

core/taskengine/engine_trigger_output_test.go:260

  • [nitpick] The tests now cover camelCase keys but no longer verify snake_case fallback. To fully validate dual-access mapping, consider adding assertions that result also contains the snake_case equivalents (e.g., log_index).
require.Contains(t, result, "logIndex", "logIndex field should be present")

core/taskengine/vm_secrets_test.go:249

  • It looks like the closing braces for the if block and test function are misaligned after inlining key collection. This will cause a compilation error. Please ensure you add the missing } to properly close the if and the TestCollectInputsIncludesSecrets function.
t.Errorf("test_var.data not found in CollectInputs output, available keys: %v", keys)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@chrisli30 chrisli30 merged commit 1b172c7 into staging Jun 17, 2025
16 checks passed
@chrisli30 chrisli30 deleted the chris-fix_event_trigger_undefined_return branch June 17, 2025 05:43
chrisli30 added a commit that referenced this pull request Jun 17, 2025
* Fix operator failed to notify aggregator on task trigger problem - Fixed critical bug in MustStart() where tasks were loaded using storage key instead of task ID, added database fallback, enhanced variable resolution with dual-access mapping, improved preprocessing in node runners, added comprehensive logging

* Fix unnecessary stack trace in event trigger query optimization warning - Changed Warn to Info level since this is informational, not an error requiring debugging

* Fixed runTask returns undefined for eventTrigger problem

* Update core/taskengine/engine.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* clean up and addressed copilot’s comments

* Fixed the format of test file

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
chrisli30 added a commit that referenced this pull request Jun 18, 2025
* Fix operator failed to notify aggregator on task trigger problem - Fixed critical bug in MustStart() where tasks were loaded using storage key instead of task ID, added database fallback, enhanced variable resolution with dual-access mapping, improved preprocessing in node runners, added comprehensive logging

* Fix unnecessary stack trace in event trigger query optimization warning - Changed Warn to Info level since this is informational, not an error requiring debugging

* Fixed runTask returns undefined for eventTrigger problem

* Update core/taskengine/engine.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* clean up and addressed copilot’s comments

* Fixed the format of test file

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant