feat(triggers): add the triggers package with cron, interval, and polling triggers - #820
Merged
Merged
Conversation
…ling triggers Rebuilt on current main from the triggers work alone. The previous branch carried its payload inside a squashed PR merge spanning 223 files, so it also held task-graph cache, ConditionalTask and FetchUrlTask changes that have nothing to do with triggers — 231 unrelated files against 17 real ones. Merging that into main produced 29 conflict hunks, 14 of them two-sided in the clearRun blob-ref path, where a wrong resolution is invisible until a crash-resume. None of that belongs to this feature, so none of it is here. The package: BaseTrigger, CronTrigger, IntervalTrigger, PollingTrigger, a UTC CronSchedule, and the Workflow binding layer, plus its six test files, the workspace wiring (dependency + tsconfig references in `test` and `workglow`) and the `workglow` re-export and auto-bootstrap install. One task-graph change is carried across because the feature genuinely depends on it, not as a leftover: `WorkflowRunConfig.signal`, bridged onto the run's own controller by `WorkflowRunContext.linkSignal`. A trigger has to cancel exactly the run its own fire started; `Workflow.abort()` trips the single current-run controller and would cancel whichever run happens to be current, which is the wrong granularity once two triggers drive one workflow. It is additive — a new optional field, a new method, and one line in `run()` — and its two Workflow tests come with it. Verified on this branch: trigger 180/180, graph 507/507 (including the two new runConfig.signal cases), task-graph 981/981, build:types 42/42, prettier clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lgxtp7mQECdh7F2UT9CVwN
| throw error; | ||
| } finally { | ||
| // Identity check: a later fire may already have claimed the tail. | ||
| if (workflowRunChains.get(workflow) === chain) workflowRunChains.delete(workflow); |
Coverage Report
File CoverageNo changed files found. |
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.
Rebuilt of #679 on current
main, carrying the triggers work and nothing else. Supersedes #679.Why a new branch
#679's payload sits inside a squashed PR merge (
7e6ec7f35, "Validate trigger binding bounds and reject a reused runConfig.signal (#792)") spanning 223 files. So the branch also carried task-graph cache,ConditionalTaskandFetchUrlTaskchanges unrelated to triggers — 231 unrelated files against 17 real ones.That made it unmergeable by either route:
CHANGELOG/package.json/lock)The two-sided hunks concentrate in
RunPrivateCacheRepo/FsFolderTaskOutputRepository/TaskOutputRepository— theclearRunblob-ref pathmainreworked in "stop clearRun dangling blob refs". A wrong resolution there is invisible until a crash-resume. None of it belongs to this feature, so none of it is here.What this branch contains
packages/triggers—BaseTrigger,CronTrigger,IntervalTrigger,PollingTrigger, a UTCCronSchedule, and theWorkflowbinding layer.packages/test/src/test/trigger/.testandworkglow, plus theworkglowre-export andauto-bootstrapinstall. Vitest projects and test sections are derived, so they need no edit.One task-graph change, carried deliberately
WorkflowRunConfig.signal, bridged onto the run's own controller byWorkflowRunContext.linkSignal. This is a real dependency, not a leftover: a trigger must cancel exactly the run its own fire started, andWorkflow.abort()trips the single current-run controller — it would cancel whichever run happens to be current, which is the wrong granularity once two triggers drive one workflow.It is additive (a new optional field, a new method, one line in
run()), and its twoWorkflow.test.tscases come with it.linkSignaluses a removable listener rather thanAbortSignal.any, whose composite is retained per fire.Verification
bun scripts/test.ts trigger vitestbun scripts/test.ts graph vitestrunConfig.signalcases)bun scripts/test.ts task-graph vitestbun run build:typesbun run formatDiff is 34 files against
main, with no conflicts.The stacked review fixes in #812 have been rebased onto this branch (trigger 187/187) and retargeted here.
Generated by Claude Code