{{ message }}
feat: task introspection (getNextRuns, match, msToNext, isBusy, runsLeft, getPattern)#547
Merged
Conversation
Add getNextRuns(n), match(date), msToNext(), isBusy(), runsLeft() and getPattern() to the public ScheduledTask interface, implemented for both inline and background tasks. - getNextRuns / match / getPattern are pure (computed from the expression and timezone), so they work on a stopped task and on background tasks without querying the daemon. - msToNext / isBusy reflect live state. - runsLeft mirrors the runner's count; background tasks track it from the forwarded execution:started events since the real count lives in the daemon.
These two introspection methods on BackgroundScheduledTask were untested, dropping coverage. Add the missing cases (msToNext null when stopped + positive once started; isBusy false when idle).
Merged
merencia
added a commit
that referenced
this pull request
Jun 18, 2026
Promote the Unreleased section to 4.4.0 and bump the version. Highlights (all additive, backwards-compatible): - Task introspection: getNextRuns, match, msToNext, isBusy, runsLeft, getPattern (#547) - cron.parse and cron.validateDetailed (#548) - Distributed run coordination: distributed:true + NODE_CRON_RUN default + RunCoordinator (#549)
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.

Phase 1 — task introspection. Six small methods on the public
ScheduledTaskinterface, implemented for both inline and background tasks.getNextRuns(n)Date[]nmatches from now (pure; closes the FI-7 scenario skipped in the DST work)match(date)booleanmsToNext()number | nullnullwhen stoppedisBusy()booleanrunsLeft()number | undefinedmaxExecutionsis setgetPattern()stringgetNextRuns/match/getPatternare pure (computed from the expression + timezone), so they work on a stopped task and on a background task without querying the daemon.runsLeftfor background tasks: the real count lives in the forked daemon, so the parent mirrors it from theexecution:startedevents it already receives.Tests cover both implementations (inline directly; background for the local-compute methods and the event-tracked
runsLeft). Full suite green.Next in Phase 1
cron.parse()+cron.validateDetailed()(expression introspection — separate PR).getStats/history/previousRun(s)) after theEventStoreprovider.