Repository navigation
fix(schedule): report a row that fails to make once per version - #295
Closed
ChiragAgg5k wants to merge 1 commit into
Closed
ChiragAgg5k wants to merge 1 commit into
ChiragAgg5k wants to merge 1 commit into
Conversation
A source of truth can hold a row nothing here accepts -- a schedule written before the parser tightened, say. Reconcile runs on a timer and cached no entry for such a row, so the same row was reported again on every pass for as long as it sat there. One Appwrite Cloud function schedule on an unparseable cron expression produced 3,485 Sentry events in twelve days, roughly one every five minutes, all of them the same row. Pin the refusal to the version that earned it. The row still surfaces once, so nothing is hidden, and an edit that moves the version is tried again on the next sync rather than waiting for a restart. The memo is evicted with the row, on a full snapshot or when it goes inactive. The test helper moves off an anonymous class because PHPStan reads no value type from the `@var list<string>` on its property, which failed `bin/monorepo check schedule` on main.
ChiragAgg5k
requested review from
Meldiron,
abnegate,
eldadfux and
loks0n
as code owners
September 17, 2026 13:32
Benchmark resultsschedule — dispatch and reconcile at scale (4 cores, 10000 schedules: 30% cron / 70% interval, 30 ticks)
115680 occurrences dispatched, 3856 per tick average. Selecting one minute of coverage spends 0.049% of the 60s tick interval. Shared CI runners — treat absolute numbers as rough, compare modes within a run. Commit cb24851. |
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.
What
Scheduler::reconcile()caches no entry for a row whoseSource::make()throws, so the same row is reported again on every pass. Reconcile runs on a timer, so a row the source keeps listing and this scheduler keeps refusing reports forever.The refusal is now pinned to the version that earned it: one report per version, and an edit that moves the version is tried again on the next sync rather than waiting for a restart. The memo is evicted with the row, on a full snapshot or when it goes inactive.
Why
Found by auditing the noisiest ongoing Sentry issues on Appwrite Cloud. CLOUD-3QW1 is 3,485 events since Sep 5 and still firing, roughly one every five minutes — and every one of them is the same row. A single function schedule holds the cron expression
22-3, whichTrigger\Cronrefuses, andschedule.functions.reconcilehas been reporting it on every pass since.Nothing is hidden by this. The row still reports once, with the same message and stack, and reports again if someone edits it and it still fails.
Why not change the parser instead
I first wrote this as a change to
Trigger\Cronto accept22-3as a wrap around the field, and closed it.22-3is not portable cron. cronie'sget_range(), the reference implementation, iswhich sets nothing when
low > high— the job silently never runs. Its only special case isif (low_ > high_ && high_ == 0) high_ = 7;, a narrow Sunday fixup for5-0, not general wrapping. npmcron-parserrejects the range outright.croniterwraps, but it is the outlier.Accepting the wrap would also have started running a production function that has not executed since it was created, six times a day, on a project that never asked for a behaviour change.
The noise was never really about the parser: this row would have kept reporting on every pass whatever
Cronaccepted, and so will the next one.Tests
Two cases in
packages/schedule/tests/ReconcileTest.php, both seen red with thesrc/hunk reverted:make()is called once — so the row is skipped, not merely reported more quietlybin/monorepo check schedule,bin/monorepo test schedule(97 unit + 9 e2e) andbin/monorepo validateall pass.ReconcileTest's error collector moves off an anonymous class in the same commit: PHPStan reads no value type from the@var list<string>on its property, andbin/monorepo check schedulefailed onmainbecause of it. CI selects packages by change, so this branch is what makes that job run.Still open, outside this PR
The one Cloud row is data, not code — it needs its schedule cleared or its owner told, and this change only stops it shouting. Appwrite's
Task\Validator\Cronalready rejects22-3on write, so no new row can reach this state; the existing one predates that validator.