Skip to content

Commit f43a14f

Browse files
committed
🐛 Keep the Deno storage suites inside the Node typecheck (#291)
The Node typecheck covers every source under `packages/`, and the runtime exclusion manifest governs only what runs. A Deno-only test still has to typecheck under `tsconfig.node.json`, and three things in the new suites did not. The restart child read `Deno.args`; it now reads `process.argv`, which both runtimes provide and which says nothing about where the file runs. A directory listing used `toSorted()`, outside the ES2022 lib that project targets — and it never needed sorting, because every assertion on it is about one entry or none. Two accumulator arrays inferred as `never[]` under settings `deno check` does not share, and now carry their types. Verified with the commands CI runs rather than the four repository gates alone: `pnpm exec tsc --project tsconfig.node.json --noEmit`, `pnpm test:node` under Node 22 (2533 passing), and `pnpm test:bun` (2533 passing).
1 parent 3c25acb commit f43a14f

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎packages/workflow/tests/support/restart-child.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
import { appendFileSync } from "node:fs";
21+
import process from "node:process";
2122
import { durableCall, durableRun } from "@executablemd/durable-streams";
2223
import type { Workflow } from "@executablemd/durable-streams";
2324
import { main } from "effection";
@@ -42,7 +43,9 @@ function work(marker: string): () => Workflow<string> {
4243
}
4344

4445
main(function* () {
45-
const [root, runId, marker] = Deno.args;
46+
// `process.argv` rather than `Deno.args`: this file is Deno-only to run, and
47+
// still has to typecheck under the Node project like every other source.
48+
const [root, runId, marker] = process.argv.slice(2);
4649

4750
yield* useWorkflowRunStorage({ root });
4851

‎packages/workflow/tests/workflow-run-storage.test.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { readFileSync, readdirSync, writeFileSync } from "node:fs";
1616
import { describe, it } from "@executablemd/test-support/bdd";
1717
import { expect } from "@executablemd/test-support/expect";
1818
import { exists } from "@effectionx/fs";
19+
import type { Result } from "effection";
1920
import {
2021
type GitWorkflowDefinitionV1,
2122
WORKFLOW_RUN_STATUSES,
@@ -30,7 +31,9 @@ import {
3031
WorkflowRunIdMismatchError,
3132
WorkflowRunNotFoundError,
3233
WorkflowRunStorage,
34+
type WorkflowRunStatus,
3335
WorkflowSchemaVersionError,
36+
type WorkflowStopReason,
3437
} from "../mod.ts";
3538
import { APPLICATION_ID, hashRunId } from "../deno.ts";
3639
import {
@@ -49,7 +52,7 @@ const { create, lookup } = WorkflowRunStorage.operations;
4952

5053
/** Every entry in the storage root, so a test can prove nothing else appeared. */
5154
function entries(root: string): string[] {
52-
return readdirSync(root).toSorted();
55+
return readdirSync(root);
5356
}
5457

5558
describe("Tier WS — creating and finding a run", () => {
@@ -115,7 +118,7 @@ describe("Tier WS — creating and finding a run", () => {
115118
},
116119
];
117120

118-
const errors = [];
121+
const errors: { field: string; result: Result<WorkflowRunDatabase> }[] = [];
119122
for (const attempt of attempts) {
120123
const result = yield* create(request(attempt.overrides));
121124
errors.push({ field: attempt.field, result });
@@ -217,7 +220,7 @@ describe("Tier WS — what a run retains", () => {
217220

218221
const stored = yield* withStorage(root, function* () {
219222
const database = yield* createRun();
220-
const seen = [];
223+
const seen: { status: WorkflowRunStatus; reason: WorkflowStopReason | undefined }[] = [];
221224

222225
for (const status of WORKFLOW_RUN_STATUSES) {
223226
const updated = yield* database.updateRunState({

0 commit comments

Comments
 (0)