Implement background tasks - #193
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds background task infrastructure spanning Rust (a new stride_background crate and FRB bindings) and Flutter/Dart (Workmanager-based scheduling) to support periodic repository sync running outside the foreground UI.
Changes:
- Added a new Rust
stride_backgroundcrate and wired it into the workspace andflutter_bridgeerror model. - Introduced new Flutter Rust Bridge APIs for background task init/execute and a Dart-side background task manager built on
workmanager. - Updated the Flutter
TaskBloc+ Tasks drawer UI to schedule, cancel, and visualize per-repository background sync tasks.
Reviewed changes
Copilot reviewed 20 out of 23 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/flutter_bridge/src/frb_generated.rs | Regenerated FRB bindings to expose background task APIs and result types. |
| crates/flutter_bridge/src/api/mod.rs | Exposes the new background API module. |
| crates/flutter_bridge/src/api/error.rs | Adds Background error kind and an is_background() discriminator. |
| crates/flutter_bridge/src/api/background.rs | Implements Rust-side background task entrypoint/stream hook. |
| crates/flutter_bridge/Cargo.toml | Adds stride_background + async-trait dependencies. |
| crates/background/src/tests.rs | Adds initial unit tests for the background runner. |
| crates/background/src/lib.rs | Introduces the background task runtime (tokio runtime on a dedicated thread). |
| crates/background/src/error.rs | Defines background task error types and downcasting helpers. |
| crates/background/Cargo.toml | Adds the new stride_background crate manifest. |
| Cargo.toml | Adds crates/background to the workspace and workspace deps; adds async-trait. |
| Cargo.lock | Locks new Rust dependencies (tokio-related + new crate). |
| app/pubspec.yaml | Adds workmanager and async dependencies for background scheduling. |
| app/pubspec.lock | Locks new Dart dependencies. |
| app/lib/routes/tasks_route.dart | Updates drawer UI to reflect background sync status per repository. |
| app/lib/main.dart | Initializes background system during app startup. |
| app/lib/bridge/frb_generated.io.dart | Updates generated IO-side FRB bindings for background types. |
| app/lib/bridge/frb_generated.dart | Updates generated FRB API surface to include background init/execute. |
| app/lib/bridge/api/settings.dart | Minor generated-comment update. |
| app/lib/bridge/api/error.dart | Adds RustError.isBackground() to the Dart API. |
| app/lib/bridge/api/background.freezed.dart | Generated Freezed model for BackgroundResult. |
| app/lib/bridge/api/background.dart | Generated Dart API for background init/execute and result type. |
| app/lib/blocs/tasks_bloc.dart | Migrates periodic sync from timers to background tasks; schedules per-repo work. |
| app/lib/background.dart | Adds Dart background task framework + desktop Workmanager shim. |
Files not reviewed (1)
- app/lib/bridge/api/background.freezed.dart: Generated file
Suppressed comments (2)
crates/background/src/tests.rs:54
- Same
compare_exchangeissue asnotify: transitioningtrue -> falsereturnsOk(true)on success, so== Ok(false)is never satisfied andreset()never resets the flag.
if self
.flag
.compare_exchange(true, false, Ordering::SeqCst, Ordering::SeqCst)
== Ok(false)
{}
crates/flutter_bridge/src/api/background.rs:62
- Same issue as
on_task_start: unwrappingStreamSink::addcan panic during shutdown / stream cancellation.
state.stream_sink.add(result).unwrap();
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
HalidOdat
force-pushed
the
feature/background-tasks
branch
from
August 4, 2026 07:29
36f0d98 to
0e9e370
Compare
HalidOdat
force-pushed
the
feature/background-tasks
branch
from
August 4, 2026 07:31
0e9e370 to
a6247f2
Compare
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.
This pull request introduces background task support for periodic repository synchronization and integrates the new background task APIs into the app. The main changes include adding the new
stride_backgroundcrate and Dart API, updating theTaskBlocto use background tasks for syncing repositories, and updating dependencies and generated bindings to support these features.Background task support and integration:
stride_backgroundcrate to the workspace and as a dependency inCargo.toml, and updated dependencies to includeasync-traitfor async background tasks. [1] [2] [3]Flutter/Dart API and code changes:
app/lib/bridge/api/background.dart, including theBackgroundResulttype and methods for initializing and executing background tasks.app/lib/blocs/tasks_bloc.dartto register and unregister periodic background sync tasks per repository using the new background API, replacing previous timer-based logic. Now, syncs are scheduled as background tasks and handled more robustly. [1] [2] [3]