Skip to content

fix(scheduler): reject expired one-shot schedules atomically - #1684

Merged
Open-Squilla merged 74 commits into
mainfrom
fix/validate-one-shot-schedules-atomically
Sep 16, 2026
Merged

Open-Squilla merged 74 commits into
mainfrom
fix/validate-one-shot-schedules-atomically

Conversation

@Open-Squilla

@Open-Squilla Open-Squilla commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Scope

Past one-time schedules previously executed immediately and disappeared after their run. New or rescheduled at jobs now reject past timestamps before persistence, with an actionable field-named error.

Scope boundary: scheduler creation/update validation, idempotent creation, the cron update RPC, and regression tests. An update containing both an enabled toggle and an invalid schedule leaves the entire stored job unchanged. Valid combined updates persist once. Idempotent retries return an existing job even after its scheduled time; only a genuinely new job is checked for expiry, after acquiring the creation lock with a fresh clock.

Recurring schedules and metadata-only changes to existing overdue jobs retain their behavior.

Merge-queue validation also exposed an existing preview-driver race: two 16 ms timer samples could occur in one rendering frame and treat a moving control as stable. The driver now samples across rendered frames, keeps the original shared four-second action deadline, cancels stalled frame callbacks, and preserves the last confirmed semantic failure.

This is the stable integration of #1526. The original contribution and maintainer follow-up commits are retained; ongoing main-branch synchronization on the contributor branch does not change this integration head.

Branch

Base branch: main.

Target exception: none.

Integrated mainline fixes: #1674 (SQLite fallback connection compatibility) and #1677 (atomic initial generated publication receipts) resolve existing main-branch failures exposed by CI. Both fixes are included and tested with this change. #1674 has merged; #1677 also has a separate review and CI run for generated publication behavior.

Issue

Linked issue: Fixes #1516.

Release Note

Release note: Reject expired one-time reminders without partially updating tasks or breaking idempotent creation retries. No standalone changelog entry added.

Tests

  • Original PR preflight: 57 passed.
  • Supplemental regressions reproduced 12 failures before the fixes.
  • Scheduler, cron RPC, admin-tool, and CLI focused verification: 347 passed.
  • Integrated verification with fix(sqlite): expose change counts on the fallback connection #1674 and fix(artifacts): record initial publication receipts atomically #1677: 376 scheduler, cron update RPC, SQLite compatibility, ArtifactSession, generated source, and workbench tests passed.
  • After integrating current main (Prevent incomplete compaction from replacing history #1673), 331 unique scheduler, cron RPC, and CLI tests passed on this stable branch.
  • Coverage includes timezone offsets, no-write rejection, combined enable/schedule updates, concurrent idempotent retries after the due time, expiry while waiting for the creation lock, and metadata-only edits to overdue jobs.
  • The live HTML business-driver suite passed 33/33 tests. Deterministic frame-scheduling controls fail under the previous implementation and pass after the fix; 20 real Chromium runs had no premature stability decisions after the change.
  • Ruff on changed files, targeted mypy on changed source modules, and git diff --check passed.
  • Platform-neutral Python/SQLite logic, locally verified on macOS; remote CI verifies the final PR and queue revision.

Maintainer Live Check

Maintainer live check: no.

Surface: gateway.

Safety

Offline, deterministic, credential-free tests use synthetic jobs and isolated temporary databases. No secrets, runtime transcripts, or local artifacts are included.

Third-Party Origin

Third-party origin: original OpenSquilla contribution by @lifelmy in #1526, retained with its commit history. Maintainer follow-ups make updates atomic and preserve idempotent retries. No external vendored implementation.

liumingyao.marvin added 30 commits August 31, 2026 23:00
A one-time 'at' schedule with a timestamp already in the past is accepted,
fires on the next scheduler tick, and the one-shot job is then deleted — so
the payload runs immediately with no future occurrence and disappears. That
is almost never what a caller scheduling a one-time reminder intends.

Validate the 'at' timestamp against the current time in SchedulerOps.add and
SchedulerOps.update (the two structured-schedule entry points) and raise a
field-named ValueError before persisting, matching the existing timezone and
interval validation style. Recurring cron/every schedules are unaffected.

Fixes #1516
@github-actions

Copy link
Copy Markdown

Merge queue CI: failurerun 35107000795, attempt 1.
Tested queue candidate: d367e31c58b8b510c3b8e8a4fd903e5282ece50d. This result belongs to that combined tree, not necessarily the PR's current head.

The run summary lists reused suites and executed checks. A green PR check alone does not mean queue validation has passed.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 16, 2026
@Open-Squilla
Open-Squilla added this pull request to the merge queue Sep 16, 2026
@github-actions

Copy link
Copy Markdown

Merge queue CI: failurerun 35110881749, attempt 1.
Tested queue candidate: fc381d0da4a209b64293dbd2933c274ddaf5c2ba. This result belongs to that combined tree, not necessarily the PR's current head.

The run summary lists reused suites and executed checks. A green PR check alone does not mean queue validation has passed.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 16, 2026
@Open-Squilla
Open-Squilla added this pull request to the merge queue Sep 16, 2026
@github-actions

Copy link
Copy Markdown

Merge queue CI: cancelledrun 35122228608, attempt 1.
Tested queue candidate: 2cbaf18b3705ae2e5847c8729b52b770ec7f7f4a. This result belongs to that combined tree, not necessarily the PR's current head.

The run summary lists reused suites and executed checks. A green PR check alone does not mean queue validation has passed.

@github-actions

Copy link
Copy Markdown

Merge queue CI: cancelledrun 35123038242, attempt 1.
Tested queue candidate: c367ecfd19b5ebd6edbaf4b858ffe67060158de3. This result belongs to that combined tree, not necessarily the PR's current head.

The run summary lists reused suites and executed checks. A green PR check alone does not mean queue validation has passed.

Merged via the queue into main with commit 243fc12 Sep 16, 2026
65 of 67 checks passed
@github-actions

Copy link
Copy Markdown

Merge queue CI: successrun 35126044362, attempt 1.
Tested queue candidate: 243fc1235f80c0e2af8899c1e188057da5e7c2a1. This result belongs to that combined tree, not necessarily the PR's current head.

The run summary lists reused suites and executed checks. A green PR check alone does not mean queue validation has passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Past one-time Cron schedules are accepted and executed immediately

1 participant