Repository navigation
feat(graph): route javascript/typescript Code nodes to the node worker + multi-language tests - #313
Conversation
…r + multi-language tests A Code node executes on the mesh by its Language. C# runs in-process on the Activity hub's Roslyn kernel; a foreign language routes to the stable address where that language's worker participant registers. Previously only `python` was routed (→ py/python-kernel); everything else fell through to in-process. Extend the dispatch so `javascript`/`typescript` route to `node/node-kernel` (the node worker, clients/typescript), extracted into a testable CodeNodeType.ResolveKernelAddress(language, activityPath). Tests (MultiLanguageCodeExecutionTest): - ResolveKernelAddress mapping for every language: python → py/python-kernel; javascript/typescript → node/node-kernel; csharp / null / json / sql / markdown → in-process (the activity path). Case- insensitive. This pins the js/ts additions and the C# default. - A real end-to-end C# run: a Code node executes and drives its ActivityLog to Succeeded with the captured output — the same surface every language's output lands on. Real python/node INTERPRETER execution is exercised by the worker SDK tests (clients/python, clients/typescript) and, once a language gate is deployed, an integration run. The node worker itself + feature-flagged runtimes + node hub examples are the follow-up phases. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds first-phase multi-language execution routing for Graph Code nodes by mapping their Language to a stable “kernel” worker address (keeping C# in-process on the Activity hub), and introduces an integration test suite that verifies dispatch and a real C# end-to-end execution path.
Changes:
- Introduce
CodeNodeType.ResolveKernelAddress(language, activityPath)and routeSubmitCodeRequestvia that mapping (python→py/python-kernel,javascript/typescript→node/node-kernel, otherwise in-process). - Add
MultiLanguageCodeExecutionTestcovering dispatch mappings (theory) and a full C# execution that drives anActivityLogtoSucceededand captures output.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/MeshWeaver.AI.Test/MultiLanguageCodeExecutionTest.cs | Adds dispatch + end-to-end execution tests for multi-language Code-node routing and C# execution output surfacing. |
| src/MeshWeaver.Graph/Configuration/CodeNodeType.cs | Adds ResolveKernelAddress and uses it to route SubmitCodeRequest to the appropriate language worker kernel. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// <see cref="CodeConfiguration"/>, validates <c>IsExecutable</c>, dispatches | ||
| /// <see cref="SubmitCodeRequest"/> to the internal kernel address, and posts | ||
| /// an <see cref="ExecuteScriptResponse"/> with the submission id + output-area | ||
| /// <see cref="SubmitCodeRequest"/> to the <see cref="ResolveKernelAddress">language kernel</see>, | ||
| /// and posts an <see cref="ExecuteScriptResponse"/> with the submission id + output-area |
| /// <para>These pin BOTH halves: the language→kernel dispatch (<see cref="CodeNodeType.ResolveKernelAddress"/>, | ||
| /// exercised for every language including the js/ts additions) and a real end-to-end C# run driving the | ||
| /// ActivityLog to <c>Succeeded</c> with its output — the same surface every language's output lands on. |
Test Results (shard 4) 10 files ± 0 10 suites ±0 4m 25s ⏱️ -18s Results for commit 3a622b7. ± Comparison against base commit ab78017. This pull request removes 166 and adds 19 tests. Note that renamed tests count towards both. |
Test Results 56 files ± 0 56 suites ±0 22m 31s ⏱️ +15s Results for commit 3a622b7. ± Comparison against base commit ab78017. This pull request removes 166 and adds 19 tests. Note that renamed tests count towards both. |
First phase of multi-language Code-node execution on the mesh.
What
A Code node executes by its
Language: C# runs in-process on the Activity hub's Roslyn kernel; a foreign language routes to the stable address where that language's worker participant registers. Onlypythonwas routed before (→py/python-kernel). This addsjavascript/typescript→node/node-kernel(the node worker inclients/typescript), via a testableCodeNodeType.ResolveKernelAddress(language, activityPath).Tests —
MultiLanguageCodeExecutionTestpython→py/python-kernel;javascript/typescript→node/node-kernel;csharp/null/json/sql/markdown→ in-process (the activity path); case-insensitive.Succeededwith the captured output — the identical surface every language's output lands on.CI-safe and fast (13 tests, ~3s). Release
-warnaserrorclean.Scope / follow-ups (tracked)
Real python/node interpreter execution is exercised by the worker SDK tests (
clients/python,clients/typescript) today; a full mesh integration run lands once a language gate is deployed. Still to come, per the plan:worker.ts, executes js/ts Code nodes) + Node hub examples (define/run a hub in Node).py/pandas+py/python-kernelon memex so the doc examples are live.🤖 Generated with Claude Code