From 6f7d0a9fb3ccb234a352380f507a35f019ababe8 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Thu, 27 Aug 2026 11:09:33 +0000
Subject: [PATCH] test(globals): cover pipeline and parallel from rig/globals
in flat-port pattern
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add a test in the rig/globals describe block that validates pipeline() and
parallel() from rig/globals delegate to the active workflow context — the same
as call() does. This is the missing coverage for the incremental flat-port
migration pattern documented in 340-flat-workflow-port.md and
claude-workflow-conversion.md.
The flat-port style (import call/pipeline/parallel from "rig/globals" at the
module top level) is the most common first step when porting a Claude dynamic
workflow to rig. The test shows the complete trio working together, mirroring
the Claude dynamic workflow globals (agent/pipeline/parallel).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
src/workflow.test.ts | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/workflow.test.ts b/src/workflow.test.ts
index 3a14bbf..3630483 100644
--- a/src/workflow.test.ts
+++ b/src/workflow.test.ts
@@ -14,7 +14,7 @@ import {
type WorkflowEvent,
} from "rig";
import { s } from "rig";
-import { call as ambientCall } from "rig/globals";
+import { call as ambientCall, pipeline as ambientPipeline, parallel as ambientParallel } from "rig/globals";
function fakeAgent(
name: string,
@@ -468,4 +468,27 @@ describe("rig/globals", () => {
const worker = fakeAgent("worker", (value) => value);
expect(() => ambientCall(worker, 1)).toThrow("requires an active workflow run");
});
+
+ it("pipeline() and parallel() from rig/globals run inside the active context — flat Claude workflow port pattern", async () => {
+ // Mirrors the incremental migration: import call/pipeline/parallel from "rig/globals"
+ // at the module top level so a flat Claude dynamic workflow can be ported without
+ // restructuring into a workflow({ body }) immediately.
+ const worker = fakeAgent("worker", (value) => value * 10);
+ const definition = workflow({
+ meta: { name: "globals-pipeline-parallel", description: "flat port pattern" },
+ body: async () => {
+ const pipelineResult = await ambientPipeline([1, 2, 3], (item: number) => ambientCall(worker, item));
+ const parallelResult = await ambientParallel([
+ () => ambientCall(worker, 4),
+ () => ambientCall(worker, 5),
+ ]);
+ return { pipelineResult, parallelResult };
+ },
+ });
+
+ await expect(runWorkflow(definition)).resolves.toEqual({
+ pipelineResult: [10, 20, 30],
+ parallelResult: [40, 50],
+ });
+ });
});