Repository navigation
Seed keeps system cron rows in sync on every run - #184
Merged
Merged
Conversation
The cron seed was createOnly, so renaming a system job (name, jobId, handler) never reached an existing database: Kingdom prod kept a renamed handler's old row and the worker failed "Unknown job handler" every minute. - cronJob seed: no longer createOnly. Re-seeding syncs name, jobId, handler and description from code; pattern, enabled, payload, maxAttempts and backoffMs are admin-editable in superadmin and set on insert only (updateOmitFields). - cronJobSync hook also fires on upsert (the seed runner's write, inside db.txn), and skips BullMQ when nothing it reads changed, so a rename moves the repeatable and an unchanged re-seed touches nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
agreenspan
force-pushed
the
fix/cron-seed-sync
branch
from
October 12, 2026 16:49
79366cb to
0c5d938
Compare
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Main's post-biome lint forbids hand cleanup in test after hooks; cleanupTouchedTables truncates every table the test wrote. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
The cron seed was createOnly, so a renamed system job never reached an existing DB (Kingdom prod kept renewConnections after the rename; worker logged "Unknown job handler" every minute). Then the stale repeatable kept firing because the hook never removed anything. Same fixes landed in Kingdom #115 + #116.
Seed
Repeatables
removeRepeatable(handler, { pattern, jobId })never matched because BullMQ overwrites repeat.jobId with the third argument. NowremoveRepeatable(handler, { pattern }, jobId)(checked against real Redis + BullMQ 5.78).registerCronJobson worker start removes repeatables no enabled row registered (matched by returned repeatJobKey); prunes nothing if any row failed to register.Tests: renamed system row updates on re-seed and its repeatable moves; admin-edited fields survive; unchanged re-seed touches nothing; orphan pruning. Full
bun run checkgreen.🤖 Generated with Claude Code