Skip to content

test(app-server): await progress in the TypeScript session fixture - #2083

Merged
yyhhyyyyyy merged 1 commit into
mainfrom
hui/ci-ts-progress-await
Nov 23, 2026
Merged

yyhhyyyyyy merged 1 commit into
mainfrom
hui/ci-ts-progress-await

Conversation

@yyhhyyyyyy

Copy link
Copy Markdown
Collaborator

Fixes #2082

session_typescript::node_session_typescript_tools_methods_and_generation_lifetimes (crates/dim-app-server/tests/transport_flow/session_typescript.rs:1595) expected the first management.progress notice of a session.typescript.status call to carry {phase: "started"}. It failed in CI on 2026-11-23 with left: String("settled"), right: "started".

The typescript fixture (runtime/fixtures/session-part.ts:230,233) sent started, then settled, then returned without awaiting either call. Since rutis 0.23 (#1941), a host callback invoked outside a synchronous call is dispatched asynchronously, and rutis-bridge runs each incoming call frame on its own task, so the two sends race: settled can arrive first, and started can be dropped when the reply closes the progress channel.

The fixture now awaits both calls, so each send completes before the next one and before the handler returns. The assertion, the other fixtures, npm/plugin.d.ts and the plugin guide are unchanged; #2082 records the remaining type and guide gaps for a separate change.

Evidence, one process per run with DIM_TEST_NODE, DIM_TEST_JS_RUNTIME and DIM_TEST_RUTIS_SDK set:

  • origin/main cecf65f: 100 runs, 99 passed, 1 failed at :1595 with settled and started.
  • This branch ad83418: 100 runs, 100 passed.

`session_typescript::node_session_typescript_tools_methods_and_generation_lifetimes` expected the two `progress(...)` calls of one TypeScript method to reach the host in call order. Since rutis 0.23 (#1941) an imported callback invoked outside a synchronous call is dispatched asynchronously, and rutis-bridge runs each incoming call frame on its own task, so `settled` could be delivered before `started`, or `started` could be dropped when the reply closes the progress channel.

Await both calls in `runtime/fixtures/session-part.ts` so each send completes before the next one and before the handler returns. The assertion and the other fixtures are unchanged. `npm/plugin.d.ts` and the plugin guide still describe `progress(...)` as a synchronous call; #2082 records those gaps for a separate change.

Fixes #2082

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at head ad83418.

The diagnosis is right and the fix is at the cause. Since rutis 0.23 a host callback invoked outside a synchronous call is dispatched asynchronously and each incoming call frame runs on its own task, so a fixture that sends started and then settled without awaiting either lets the two race — settled can arrive first, and started can be dropped when the reply closes the progress channel. Awaiting both calls makes each send complete before the next and before the handler returns, which restores the order the assertion describes rather than weakening it.

Leaving the assertion, the other fixtures, the type declarations and the guide untouched is the right scope: this is a fixture that made a call the runtime is entitled to treat as concurrent, not a product behaviour to change. It is also the failure I named on #2055 (node_session_typescript_tools_methods_and_generation_lifetimes), so it closes that flake at its cause rather than leaving it to reappear.

Blocking: none.

Checks are green at this head. I read the PR body and the single changed file's stat (2/2); I did not read the lines themselves or session-part.ts around them, and ran nothing.

Non-blocking:

  • runtime/fixtures/session-part.ts — if a plugin has to await each progress call to keep its notices ordered, that is a contract a plugin author will hit in production, not only in this fixture. The body says the plugin guide already covers the callback change; a sentence there stating that ordering across successive progress calls requires awaiting each one would turn this two-line fixture fix into the lesson for the next author.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed ad83418. Awaiting the fixture callbacks preserves started before settled and the terminal reply, without weakening the progress assertions or changing runtime behavior. The callback queues or drops a frame without waiting for the client, so the report and drain cancellation assertions remain meaningful. Exact Linux CI passed the regression in the public Node bindings step. The authoring example and MethodProgress return type can be clarified separately.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transport_flow session_typescript: a TypeScript method's progress notices can arrive out of order

3 participants