feat: move to continue as new pattern (CM-1277)#4262
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the packages_worker Maven ingestion to follow the established long-running Temporal workflow pattern (used by npm/go): a single ingestMavenPackages workflow drains work in bounded cycles and uses continueAsNew instead of launching a new workflow every minute.
Changes:
- Replaces the one-shot Maven workflows with
ingestMavenPackages, which runs up to 5 batches per cycle andcontinueAsNews while there’s work. - Replaces the per-minute Temporal schedule with a daily
maven-ingestionschedule and adds startup cleanup to delete the legacymaven-criticalschedule. - Removes the unused non-critical batch activity and related exports/registrations.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| services/apps/packages_worker/src/workflows/index.ts | Updates workflow exports to register ingestMavenPackages instead of legacy Maven workflows. |
| services/apps/packages_worker/src/maven/workflows.ts | Implements bounded loop + continueAsNew Maven ingestion workflow. |
| services/apps/packages_worker/src/maven/schedule.ts | Switches to daily schedule and attempts to delete the legacy schedule at startup. |
| services/apps/packages_worker/src/maven/activities.ts | Removes the unused non-critical activity implementation. |
| services/apps/packages_worker/src/bin/maven-worker.ts | Updates worker startup to register the new Maven schedule function. |
| services/apps/packages_worker/src/activities.ts | Removes non-critical Maven activity export from the activity index. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0caf5d3. Configure here.
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
42bf5db to
b6c85c9
Compare
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>

Summary
Replaces the per-minute Maven schedule (launching a new Temporal workflow every minute) with a single long-running
ingestMavenPackagesworkflow that usescontinueAsNew— the same pattern already in use by the npm, go, and other workers. The workflow processes one batch of 2000 packages per cycle, callscontinueAsNewas long as there is work, and exits cleanly when the queue is drained. A daily Temporal schedule restarts it the next day.Changes
maven/workflows.ts— replacesmavenCriticalWorkflow/mavenNonCriticalWorkflow(single-shot, no retry) withingestMavenPackages: processes one batch per cycle, callscontinueAsNewif work remains, returns when the queue is emptymaven/schedule.ts— schedule IDmaven-critical(every minute, 15 min timeout) →maven-ingestion(daily at midnight,workflowRunTimeout: 24h); startup now deletes the legacymaven-criticalschedule to prevent ghost runs after deploymaven/activities.ts— removes deadprocessMavenNonCriticalBatch(no callers since non-critical schedule was never activated)activities.ts— removesprocessMavenNonCriticalBatchfrom the activities index exportbin/maven-worker.ts,workflows/index.ts— updated to reference the new namesType of change
JIRA ticket
CM-1277
Note
Medium Risk
Changes Maven ingestion cadence and Temporal workflow lifecycle (24h runs vs 1-minute launches), which can affect how quickly the universe is polled until the first daily run completes; deploy-time legacy schedule deletion is intentional but environment-specific if schedules were customized.
Overview
Maven package enrichment moves from minute-by-minute one-shot workflows to a single long-running
ingestMavenPackagesworkflow that processes one batch per cycle,continueAsNews while work remains, and exits when the queue is empty—aligned with npm/go workers.Scheduling: Temporal schedule
maven-critical(every minute, 15m execution timeout) is replaced bymaven-ingestion(daily0 9 * * *, fixed workflow idmaven-daily-enrichment, 24h run timeout). Worker startup deletes the legacymaven-criticalschedule to avoid duplicate runs after deploy.Cleanup:
processMavenNonCriticalBatchandmavenNonCriticalWorkfloware removed (non-critical path was never scheduled). Activity proxy gains retry (max 5) on the critical batch path.Reviewed by Cursor Bugbot for commit 837668d. Bugbot is set up for automated code reviews on this repo. Configure here.