Skip to content

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

Open
tarcisiozf wants to merge 8 commits intodevelopfrom
DEVSVCS-4432/cron
Open

Fake Capabilities - Refactor with context handling and job management#22012
tarcisiozf wants to merge 8 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.

@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.

@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_ManagedTokenPool_NoRateLimit Logs ↗︎

View Full Report ↗︎Docs

@cl-sonarqube-production
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube IDE SonarQube IDE

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.

2 participants