Skip to content

jsr: per-dispatch context for AsyncEnginePool — delete the duplicated __jsr* host-fn half in async_job_pool #242

Description

@IstiN

From the ai-teammate review round on #226 (lib/src/js/async_job_pool.dart:190).

The __jsr* host-function protocol is implemented twice: the adapter-owned dispatchAsyncJob/waitAsyncJob (this repo) and AsyncEnginePool's host-fn half (quickjs_runtime). Same host-fn names, same __jsError sentinel, same {ok, result, error} envelope. The prelude JS half lives in the package while the host-fn half lives here — a jsr minor bump changing the prelude's expectations breaks the adapter at runtime instead of compile time.

Mitigation in place: test/js/async_prelude_contract_test.dart tripwire (landed in 7b4171c) + lockstep doc comments.

Proper fix: extend quickjs_runtime (fork + PR per GOAL.md rule) so attachMainRuntime accepts a per-dispatch context provider (or dispatch takes an optional context), then delete dispatchAsyncJob/waitAsyncJob and delegate.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions