Repository navigation
Read routine transitions and schedules under the owner cap lock - #925
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
Implemented and locally validated with OpenAI Codex assistance.
rudycelekli
requested review from
MikeRyanDev,
davidmckayv,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
October 31, 2026 06:06
This branch has not been deployed
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 this changes
A routine update reads its current state before taking the owner's cap lock. At 20 enabled routines, a queued pause, create, and enable can therefore leave 21 enabled: the last update still thinks the routine was enabled and skips the cap check. Concurrent cron and timezone edits can also save one schedule while calculating the next firing from an older one.
Read the current routine and derive its transition and next firing inside the existing owner transaction lock, alongside the count and write. Ownership and channel checks remain in place; channel resolution uses that same transaction so a one-connection pool can complete the update.
Where it runs
Boundary and audit
Changelog
Proof
Base
743649efc3f21d7bf0badbe6af2bcd5daedd97ce, head5def6bc7562973f79a4a44c7c5265b947de05e3a.Two regressions run actual store methods on separate PostgreSQL connections. A real transaction holds the owner's existing advisory lock while the operations queue; the tests observe the sessions' database lock waits before releasing it, without sleeps or mocked locks.
0 17 * * *andAmerica/New_Yorkbut schedules 09:00 there. Afterward the next firing is 17:00 in the stored zone, independently checked withIntl. The update also resolves an explicit channel through a one-connection pool.The full suite was not run on this head. A separate routing candidate (
d428f669f10e21700b6d5eb1fb14e90c9cc59cfe) on the same base ran fulltest:ci: 11,017 passed, 210 skipped, two failed (routine-sweep concurrency expectation and recorder held-steps service-worker timing). Both cases passed when isolated on unchanged base and that routing candidate; full-suite order/timing causality remains unresolved. The routine-sweep file passes in this candidate's routine-family run.Integration tests use a dedicated disposable PostgreSQL 15 database (hosted CI uses 17), with no application data or live provider calls. PR #921 changes a separate sweep test; it does not change this store or these regressions.
AI assistance: implemented and locally validated with OpenAI Codex. Hosted CI and maintainer review remain required.