Skip to content

Adds scheduling cancellation support#9487

Merged
PascalSenn merged 4 commits intomainfrom
pse/make-scheduled-message-cancellable
Mar 30, 2026
Merged

Adds scheduling cancellation support#9487
PascalSenn merged 4 commits intomainfrom
pse/make-scheduled-message-cancellable

Conversation

@PascalSenn
Copy link
Copy Markdown
Member

@PascalSenn PascalSenn commented Mar 30, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 30, 2026 17:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces first-class scheduling APIs that return an opaque cancellation token, along with store-level cancellation support and corresponding test coverage. It also consolidates scheduling types into the main Mocha project (removing the standalone Mocha.Scheduling project).

Changes:

  • Add IMessageBus.Schedule*Async(...) APIs returning SchedulingResult, plus CancelScheduledMessageAsync(token, ...).
  • Extend IScheduledMessageStore to return a token from PersistAsync and support CancelAsync(value, ...); implement Postgres cancellation SQL/store logic.
  • Update/expand unit and integration tests to validate cancellable results and cancellation behavior.

Reviewed changes

Copilot reviewed 23 out of 29 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Mocha/src/Mocha/IMessageBus.cs Adds scheduling + cancellation methods to the public bus API.
src/Mocha/src/Mocha/Middlewares/DefaultMessageBus.cs Implements scheduling methods returning SchedulingResult and token-based cancellation.
src/Mocha/src/Mocha/SchedulingResult.cs New result type carrying token + scheduled time + cancellable flag.
src/Mocha/src/Mocha/Scheduling/IScheduledMessageStore.cs Changes persistence contract to return tokens; adds cancellation method.
src/Mocha/src/Mocha/Scheduling/DispatchSchedulingMiddleware.cs Captures store token into a pooled feature for the bus to return.
src/Mocha/src/Mocha/Features/ScheduledMessageFeature.cs New pooled feature to flow the token back to the caller.
src/Mocha/src/Mocha/Scheduling/* Adds scheduler core wiring, signal abstraction, and skip/bypass features.
src/Mocha/src/Mocha.EntityFrameworkCore.Postgres/Scheduling/ScheduledMessageQueries.cs Adds SQL for cancelling scheduled messages.
src/Mocha/src/Mocha.EntityFrameworkCore.Postgres/Scheduling/EfCoreScheduledMessageStore.cs Returns token on persist and implements cancellation via SQL delete.
src/Mocha/test/Mocha.EntityFrameworkCore.Postgres.Tests/PostgresSchedulingIntegrationTests.cs Adds integration coverage for cancellable results + cancellation semantics in Postgres scheduling.
src/Mocha/test/Mocha.Tests/Scheduling/* Updates/expands tests for new scheduling APIs and in-memory cancellation behavior.
src/Mocha/test/Mocha.Sagas.TestHelpers/TestMessageBus.cs Updates test helper bus to satisfy new IMessageBus scheduling API surface.
.csproj / Mocha.slnx / src/Mocha/src/Mocha.Scheduling/ Removes the standalone Mocha.Scheduling project and related references.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Mocha/src/Mocha/Middlewares/DefaultMessageBus.cs
@github-actions github-actions Bot added the 📚 documentation This issue is about working on our documentation. label Mar 30, 2026
@PascalSenn PascalSenn merged commit c64226a into main Mar 30, 2026
127 of 129 checks passed
@PascalSenn PascalSenn deleted the pse/make-scheduled-message-cancellable branch March 30, 2026 21:00
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (6a3b7a3) to head (c27fcf9).
⚠️ Report is 1061 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #9487       +/-   ##
==========================================
- Coverage   74.16%       0   -74.17%     
==========================================
  Files        2677       0     -2677     
  Lines      140790       0   -140790     
  Branches    16371       0    -16371     
==========================================
- Hits       104421       0   -104421     
+ Misses      30774       0    -30774     
+ Partials     5595       0     -5595     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

📚 documentation This issue is about working on our documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants