Skip to content

feat(core): add scoped dynamic fiber groups - #103

Merged
medz merged 2 commits into
mainfrom
feat/scoped-fiber-group
Oct 28, 2026
Merged

medz merged 2 commits into
mainfrom
feat/scoped-fiber-group

Conversation

@medz

@medz medz commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

FiberGroup<E> owns dynamically arriving jobs in the creating scope. start returns each member's typed Fiber, awaitEmpty waits for current members and their owned cleanup, and join retains the first qualifying failure or waits for closure. A failure leaves the group open; scope closure stops and waits for members.

final receive = files.forEach(
  (path) => uploads.start(upload(path)).map((_) {}),
);
return uploads.start(receive)
    .withError<UploadError>()
    .flatMap((_) => uploads.join());

For a long-lived input flow, create uploads with FiberGroup.create<UploadError>() inside the service scope. Pure member cancellation is ignored unless that submission uses propagateCancellation: true; shutdown cancellation is excluded. Cancelling a waiter leaves the members owned.

The implementation composes Scope, Fiber and the existing completion primitive. Membership is installed before first evaluation to support synchronous and reentrant tasks. Later independent failures reuse Runtime reporting and occurrence tracking, excluding occurrences already retained by the group's first failure; cleanup defects owned by shutdown stay on that path. Member reads do not change failure responsibility.

Related issues

Closes #69

Validation

  • dart pub get
  • dart format --output=none --set-exit-if-changed .
  • dart analyze --fatal-infos
  • dart test — 1,401 tests passed.

Seventeen focused tests cover typed synchronous results, nullable/repeated failure waits, continued submissions, occurrence-preserving reports, cancellation policy and origin during shutdown, cancelled waiters, shutdown with native work and cleanup, reentrant finalizers, closed groups and runtime ownership. Ordering uses explicit completion gates.

@medz medz added the enhancement New feature or request label Oct 28, 2026 — with ChatGPT Codex Connector
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a849a92b-c553-4bf4-b324-4c373833e23a
Commits

Reviewing files that changed from the base of the PR and between 2098e03 and 6718e25.

Files selected for processing: 5
  • lib/any.dart
  • lib/src/core/fiber.dart
  • lib/src/core/fiber_group.dart
  • lib/src/core/task.dart
  • test/core/fiber_group_test.dart
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T20:25:07.175230Z 6718e25 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

medz commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 32825fde8a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/src/core/fiber_group.dart Resolved

medz commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

@codex review

medz commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review the current head 6718e25. The previous request has remained running for about 30 minutes without a result; this is one retry on the unchanged, CI-passing head.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 6718e25a45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@medz
medz merged commit 6bc2e9e into main Oct 28, 2026
3 checks passed
@medz
medz deleted the feat/scoped-fiber-group branch October 28, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manage dynamically arriving background jobs in one scoped fiber group

1 participant