Skip to content

Fake Capabilities - Refactor with context handling and job management#22012

Merged
ibrajer merged 14 commits intodevelopfrom
DEVSVCS-4432/cron
Apr 22, 2026
Merged

Fake Capabilities - Refactor with context handling and job management#22012
ibrajer merged 14 commits intodevelopfrom
DEVSVCS-4432/cron

Conversation

@tarcisiozf
Copy link
Copy Markdown
Contributor

@tarcisiozf tarcisiozf commented Apr 14, 2026

DEVSVCS-4628

This pull request enhances the ManualCronTriggerService by integrating the gocron scheduler, improving how manual cron triggers are managed and executed. The changes introduce per-trigger scheduling, better resource cleanup, and improved error handling. The service is now more robust and easier to test due to these improvements.

Scheduler integration and trigger management:

  • Integrated the gocron scheduler (github.com/go-co-op/gocron/v2) into ManualCronTriggerService, enabling cron-like scheduling for manual triggers. The scheduler is started and properly shut down with the service lifecycle.
  • Added a triggerConfigs map to store cron configurations per trigger, allowing each trigger to have its own schedule.

Manual trigger execution improvements:

  • Refactored ManualTrigger to use the scheduler for executing triggers, returning a chan struct{} that signals completion, and added error handling for missing configs and job creation failures.
  • Improved the goroutine handling for manual triggers to ensure proper cleanup and notification when the trigger job completes or the context is cancelled.

Supports:

@tarcisiozf tarcisiozf requested review from a team as code owners April 14, 2026 17:12
Copilot AI review requested due to automatic review settings April 14, 2026 17:12
@github-actions
Copy link
Copy Markdown
Contributor

👋 tarcisiozf, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Copy Markdown
Contributor

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 14, 2026

✅ No conflicts with other open PRs targeting develop

Copy link
Copy Markdown
Contributor

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

Risk Rating: MEDIUM (touches trigger execution behavior and introduces scheduler-based concurrency)

This PR refactors ManualCronTriggerService to use the gocron scheduler for per-trigger cron scheduling, aiming to improve manual trigger management, lifecycle cleanup, and error handling.

Changes:

  • Added gocron dependency and integrated a scheduler into ManualCronTriggerService lifecycle (Start/Close).
  • Stored per-trigger cron configs and refactored ManualTrigger to schedule via gocron and return a completion channel.
  • Added job creation / next-run error handling and job cleanup (remove job on completion).

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.

File Description
core/capabilities/fakes/manual_cron_trigger.go Integrates gocron, stores trigger configs, and refactors manual triggering to be scheduler-driven with job cleanup.
go.mod Adds gocron/v2 requirement.
go.sum Adds checksums for the new scheduler dependency.

Scrupulous human review areas:

  • ManualTrigger goroutine + scheduler task coordination (channel signaling, cancellation, and avoiding deadlocks/panics): core/capabilities/fakes/manual_cron_trigger.go:125-182.
  • Service lifecycle correctness around scheduler start/shutdown and error propagation: core/capabilities/fakes/manual_cron_trigger.go:205-217.

Comment thread core/capabilities/fakes/manual_cron_trigger.go Outdated
Comment thread core/capabilities/fakes/manual_cron_trigger.go Outdated
Comment thread core/capabilities/fakes/manual_cron_trigger.go Outdated
Comment thread go.mod Outdated
Comment thread core/capabilities/fakes/manual_cron_trigger.go
@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Apr 14, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

Failed Test Failure Summary Logs
Test_CCIPTokenTransfer_EVM2Sui_BurnMintTokenPool The test failed during a coin transfer operation, likely due to an issue with the transfer process or the coin's state. Logs ↗︎
Test_CCIPTokenTransfer_EVM2Sui_BurnMintTokenPool The test failed during a token transfer operation, but the specific cause of failure is not clearly indicated in the provided logs. Logs ↗︎
Test_CCIPTokenTransfer_EVM2Sui_BurnMintTokenPool The test failed during a coin transfer operation, likely due to an issue with the transfer process or the coin's state. Logs ↗︎

View Full Report ↗︎Docs

timothyF95
timothyF95 previously approved these changes Apr 15, 2026
Comment thread core/capabilities/fakes/manual_cron_trigger.go Outdated
timothyF95
timothyF95 previously approved these changes Apr 20, 2026
mchain0
mchain0 previously approved these changes Apr 20, 2026
Comment thread core/capabilities/fakes/manual_cron_trigger.go Outdated
Comment thread core/capabilities/fakes/manual_cron_trigger.go Outdated
jmank88
jmank88 previously approved these changes Apr 21, 2026
@cl-sonarqube-production
Copy link
Copy Markdown

@ibrajer ibrajer added this pull request to the merge queue Apr 22, 2026
Merged via the queue into develop with commit efa8186 Apr 22, 2026
802 of 1080 checks passed
@ibrajer ibrajer deleted the DEVSVCS-4432/cron branch April 22, 2026 18:35
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.

6 participants