Skip to content

test(core): verify managed native asynchronous waiting - #64

Merged
medz merged 1 commit into
mainfrom
test/managed-native-waiting
Oct 24, 2026
Merged

medz merged 1 commit into
mainfrom
test/managed-native-waiting

Conversation

@medz

@medz medz commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Define managed native waiting through the existing Runtime.start, Fiber.join, and forkIn APIs. A short-lived waiter can cancel while the explicitly owned operation keeps its resource lease and late-failure supervision. The existing execution model already supports this contract; no additional wrapper or runtime behavior is needed.

Add a concrete HTTP lease example and clarify that host Future.timeout does not cancel or relinquish observation of Runtime.run. A genuinely cancellable native adapter must acknowledge stopping through fromCallback cleanup before resources can be released.

Related issues

Closes #13

Validation

  • Seven new integration tests cover multiple waiters, retained leases, late failure reporting, Runtime and explicit Scope shutdown, host timeout, and asynchronous native stop acknowledgment success/failure.
  • All 131 related tests pass, including cancellation, fibers, task lifetimes, and shared resources.
  • dart analyze --fatal-infos, repository formatting, git diff --check, and static analysis of the extracted HTTP Dartdoc example pass.

Summary by CodeRabbit

  • Documentation
    • Clarified that stopping a wait does not necessarily cancel the underlying work or release resources it still needs.
    • Added guidance on keeping native operations supervised, handling cancellation and stop acknowledgments, and waiting for longer-running work.
    • Explained that timeouts stop waiting but do not cancel the task, and that runtime shutdown waits for pending native work.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 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-24T11:54:26.796419Z 52c096a 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.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

This change documents how native asynchronous work remains supervised when a waiter stops waiting. It adds tests for resource lease lifetimes, late failures, runtime and scope shutdown, host timeouts, and asynchronous cancellation acknowledgment.

Changes: Native async operations

Layer / File(s) Summary
Ownership and waiting documentation
lib/src/core/fiber.dart, lib/src/core/runtime.dart, lib/src/core/task.dart
Documentation describes waiter cancellation, Runtime.start ownership, resource lease lifetimes, Runtime.run timeouts, and native cancellation acknowledgment.
Native async lifecycle tests
test/core/native_async_test.dart
Tests cover canceled waiters, late failures, runtime and owner-scope shutdown, host timeouts, and native cancellation acknowledgment or failure. Test helpers track client releases, native calls, and error mappings.

Priority: Not assessed

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Possibly related issues

  • odroe/any#11 — The tests exercise resource lease retention and explicit scope shutdown for owned operations, which relates to the issue’s scope and execution lifetime ownership.

Possibly related PRs

  • odroe/any#63: Changes runtime, fiber, scope, and task cancellation paths that this PR documents and tests.
  • odroe/any#62: Adds SharedResource.use, which this PR uses in its HTTP example and native-operation tests.
Merge Risk: Low · up to 52c09

The example can delay an HTTP error and runtime shutdown when a server sends an unbounded error body. This is a narrow risk that can be fixed or accepted before merging.

Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • 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.

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

medz commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 52c096acd3

ℹ️ 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 978b533 into main Oct 24, 2026
2 of 3 checks passed
@medz
medz deleted the test/managed-native-waiting branch October 24, 2026 11:55
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.

Support managed interruptible waiting for native asynchronous operations

1 participant