From c911ad83459e4914f54d6f113030a6bbaab48695 Mon Sep 17 00:00:00 2001 From: Nanaloveyuki Date: Sun, 14 Jun 2026 01:55:23 +0800 Subject: [PATCH] :memo: refine async runtime helper docs --- docs/api/async-runtime-mode-label.md | 1 + docs/api/async-runtime-mode.md | 1 + docs/api/async-runtime-supports-background-worker.md | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/api/async-runtime-mode-label.md b/docs/api/async-runtime-mode-label.md index b18c50e..ab57b7b 100644 --- a/docs/api/async-runtime-mode-label.md +++ b/docs/api/async-runtime-mode-label.md @@ -36,6 +36,7 @@ Detailed rules explaining key parameters and behaviors - The returned value is intended for diagnostics and stable output, not just debugging prints. - It keeps mode serialization logic in one place. - This helper is used by async runtime JSON helpers. +- `async_runtime_state_to_json(...)` serializes the `mode` field through this helper, so runtime snapshots and direct label rendering share the same canonical text. - Labels are more stable for telemetry and docs than ad hoc manual matching at call sites. - The current canonical labels are exactly `native_worker` for `NativeWorker` and `compatibility` for `Compatibility`. diff --git a/docs/api/async-runtime-mode.md b/docs/api/async-runtime-mode.md index 5dcf683..0a740f7 100644 --- a/docs/api/async-runtime-mode.md +++ b/docs/api/async-runtime-mode.md @@ -39,6 +39,7 @@ Detailed rules explaining key parameters and behaviors - `async_runtime_supports_background_worker()` is a narrower boolean probe built on the same idea. - `async_runtime_state()` packages this mode together with the current background-worker capability into one `AsyncRuntimeState` snapshot. - In the current backend implementations, `NativeWorker` pairs with `background_worker=true` and `Compatibility` pairs with `background_worker=false`. +- Concretely, the native runtime entrypoint returns `native_worker_async_runtime_mode()`, while the compatibility stub returns `compatibility_async_runtime_mode()`. - This API is intentionally small and useful for lightweight branching. - The mode result describes runtime behavior only; it should not be read as proof that every backend has been equally re-verified in the current release cycle. diff --git a/docs/api/async-runtime-supports-background-worker.md b/docs/api/async-runtime-supports-background-worker.md index 5cf4682..0945397 100644 --- a/docs/api/async-runtime-supports-background-worker.md +++ b/docs/api/async-runtime-supports-background-worker.md @@ -36,6 +36,7 @@ Detailed rules explaining key parameters and behaviors - `true` indicates native worker capability. - `false` indicates compatibility-mode behavior. - This helper is derived from backend-specific async runtime implementation choice. +- In the current backend split, the native implementation returns `true` while the compatibility stub returns `false`, matching the same mode pair exposed through `async_runtime_mode()` and `async_runtime_state()`. - The async library still targets multiple backends even when this helper returns `false`. - Use it when an enum branch is unnecessary and a boolean capability check is enough.