Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ jobs:
# Bun's default 5s per-test timeout when mixed into the normal unit-test run
# in a slow CI env like GHA.
- name: Test (Bun, fast suite)
run: bun test --path-ignore-patterns 'examples/runtime-matrix.bun.test.ts' --max-concurrency 1
run: bun test --path-ignore-patterns 'examples/runtime-matrix.test.ts' --max-concurrency 1

# Run the cross-runtime E2E example matrix separately with a longer timeout
# and no test-level contention. This keeps CI stable while still enforcing
# the Node 24+ / Deno / Bun compatibility promise.
- name: Test cross-runtime example matrix
run: bun test examples/runtime-matrix.bun.test.ts --timeout 30000 --max-concurrency 1
run: bun test examples/runtime-matrix.test.ts --timeout 30000 --max-concurrency 1

# The --allow-dirty is needed because in CI the deno.lock file may be modified.
- name: JSR check
Expand Down
1,809 changes: 1,809 additions & 0 deletions .railgun/2026-04-17-code-review-of-cross-runtime-test-migration-round2.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
OpenAI Codex v0.118.0 (research preview)
--------
workdir: /Users/mason/Documents/CODE/axhxrx-megarepo/script/.claude/worktrees/agent-af2de0ad
model: gpt-5.4
provider: openai
approval: never
sandbox: read-only
reasoning effort: xhigh
reasoning summaries: none
session id: 019d9b11-70ab-7d11-ac82-414a15ae6cd8
--------
user
commit HEAD
→ Inspect HEAD commit diff and changed files
• Analyze changed code for correctness and regressions
• Summarize prioritized review findings in required JSON

## Code Review: /Users/mason/Documents/CODE/axhxrx-megarepo/script/.claude/worktrees/agent-af2de0ad @ HEAD

3 findings (1 P1, 2 P2)

The test rename was not propagated to the GitHub Actions workflow, so CI will break immediately. The new package scripts/config also introduce avoidable regressions around Bun test execution and Deno package exclusion patterns.

[P1] Update CI paths after renaming the runtime matrix test
/Users/mason/Documents/CODE/axhxrx-megarepo/script/.claude/worktrees/agent-af2de0ad/examples/runtime-matrix.test.ts:1-6
Renaming this file leaves `.github/workflows/ci.yml` pointing at `examples/runtime-matrix.bun.test.ts` in both Bun test steps. On the next GitHub Actions run, the dedicated matrix step will fail with “filter did not match any test files”, and the fast-suite ignore pattern will stop excluding this expensive test.

[P2] Exclude the runtime matrix from the default Bun test script
/Users/mason/Documents/CODE/axhxrx-megarepo/script/.claude/worktrees/agent-af2de0ad/package.json:31-31
This new `test` script runs plain `bun test`, which now includes `examples/runtime-matrix.test.ts` under Bun’s default timeout/concurrency settings. The existing workflow already has to split that file out with `--timeout 30000` and `--max-concurrency 1`; without the same exclusion here, `bun run test` is likely to time out or become flaky on slower machines and CI runners.

[P2] Keep Deno exclude globs aligned with the `*.test.ts` rename
/Users/mason/Documents/CODE/axhxrx-megarepo/script/.claude/worktrees/agent-af2de0ad/deno.jsonc:23-29
These globs still only exclude `*.bun.test.ts`, so after the rename the published Deno/JSR package will start including the entire test suite and test helpers. That is a behavior change from the previous package contents, and it pulls `node:test`/`@std/expect` files into the distributable unless the patterns are updated to match the new filenames.

---

## Fixes applied (round 2)

[P1] CI workflow: updated `.github/workflows/ci.yml` to reference
`examples/runtime-matrix.test.ts` in both the `--path-ignore-patterns`
and the dedicated matrix step. CI will now find the renamed file.

[P2] package.json test script: split the default `test` into
`bun test --path-ignore-patterns 'examples/runtime-matrix.test.ts' --max-concurrency 1`
for the fast suite, followed by a separate
`bun test examples/runtime-matrix.test.ts --timeout 30000 --max-concurrency 1`
for the heavy runtime matrix. This matches what CI already does.

[P2] deno.jsonc: dropped the stale `*.bun.test.ts`/`*.bun.ts` exclude and
`check.exclude` blocks, and added a `publish.exclude` that covers
`src/test` plus `**/*.test.ts`. Verified with `deno publish --dry-run`
that no `*.test.ts` files and no `src/test/` files ship to JSR.

Self-verified in a fresh off-tree directory (outside the megarepo
workspace): `bun run test`, `bun run check`, `deno test -A`,
`deno check`, `deno lint`, `dprint check`, and `deno publish --dry-run`
all pass.
19 changes: 13 additions & 6 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
"example.png",
"tools",
"tsconfig.json",
"node_modules",
"**/*.bun.test.ts",
"**/*.bun.ts"
"node_modules"
],
"check": {
"publish": {
"exclude": [
"**/*.bun.ts",
"**/*.bun.test.ts"
"src/test",
"**/*.test.ts"
]
},
"imports": {
"@axhxrx/write-new-file": "jsr:@axhxrx/write-new-file@^0.1.0"
"@axhxrx/write-new-file": "jsr:@axhxrx/write-new-file@^0.1.0",
"@std/assert": "jsr:@std/assert@^1",
"@std/expect": "jsr:@std/expect@^1"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { test } from 'bun:test';
import { spawnSync } from 'node:child_process';
import { existsSync, rmSync } from 'node:fs';
import { join } from 'node:path';
import process from 'node:process';
import { test } from 'node:test';
import { fileURLToPath } from 'node:url';

type Runtime = {
args: string[];
Expand All @@ -17,7 +18,7 @@ type ExampleCase = {
input?: string;
};

const projectRoot = join(import.meta.dir, '..');
const projectRoot = fileURLToPath(new URL('..', import.meta.url));
const leakedArtifacts = ['notes.txt', 'release-notes.md'];

const runtimes: Runtime[] = [
Expand Down Expand Up @@ -91,14 +92,15 @@ function runExample(runtime: Runtime, example: ExampleCase)
{
cleanupLeakedArtifacts();

const command = [
const [command, ...commandArgs] = [
runtime.command,
...runtime.args,
`examples/${example.file}`,
...example.args,
];
const commandText = [command, ...commandArgs].join(' ');

const result = spawnSync(command[0], command.slice(1), {
const result = spawnSync(command, commandArgs, {
cwd: projectRoot,
encoding: 'utf8',
env: {
Expand All @@ -122,15 +124,15 @@ function runExample(runtime: Runtime, example: ExampleCase)

if (result.status !== 0)
{
throw new Error(`${label} exited with code ${result.status}\n\n$ ${command.join(' ')}\n\n${output}`);
throw new Error(`${label} exited with code ${result.status}\n\n$ ${commandText}\n\n${output}`);
}

if (!output.includes(example.expectedText))
{
throw new Error(
`${label} did not print expected text: ${JSON.stringify(example.expectedText)}\n\n$ ${
command.join(' ')
}\n\n${output}`,
`${label} did not print expected text: ${
JSON.stringify(example.expectedText)
}\n\n$ ${commandText}\n\n${output}`,
);
}

Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"@axhxrx/write-new-file": "npm:@jsr/axhxrx__write-new-file@^0.1.0"
},
"devDependencies": {
"@std/assert": "npm:@jsr/std__assert",
"@std/expect": "npm:@jsr/std__expect",
"@types/bun": "^1.3.11"
},
"peerDependencies": {
Expand All @@ -22,5 +24,10 @@
"src",
"README.md",
"LICENSE"
]
}
],
"scripts": {
"check": "deno check && deno lint && bun tsc --noEmit && dprint check",
"fix": "dprint fmt",
"test": "bun test --path-ignore-patterns 'examples/runtime-matrix.test.ts' --max-concurrency 1 && bun test examples/runtime-matrix.test.ts --timeout 30000 --max-concurrency 1 && deno test --allow-read --allow-write --allow-run --allow-env --allow-net --allow-sys && node --test --test-isolation=none"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { describe, expect, test } from 'bun:test';
import { expect } from '@std/expect';
import { join } from 'node:path';
import { describe, test } from 'node:test';

import { getPathToRepoRoot } from '../../tools/getPathToRepoRoot.ts';
import { getFileInfo } from './getFileInfo.ts';
Expand Down
3 changes: 2 additions & 1 deletion src/gh/gh.bun.test.ts → src/gh/gh.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { describe, expect, test } from 'bun:test';
import { expect } from '@std/expect';
import { describe, test } from 'node:test';

import { getGhAuthUsername } from './getAuthUsername.ts';

Expand Down
5 changes: 3 additions & 2 deletions src/git/git.bun.test.ts → src/git/git.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { describe, expect, test } from 'bun:test';
import { expect } from '@std/expect';
import { mkdtempSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { describe, test } from 'node:test';

import { run } from '../sh';
import { run } from '../sh/index.ts';

import { getGitConfig, setGitConfig } from './index.ts';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { afterEach, describe, expect, test } from 'bun:test';
import { spawnSync } from 'node:child_process';
import { randomUUID } from 'node:crypto';
import { readFile, unlink } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { afterEach, describe, expect, test } from '../test/testlib.ts';

import { autoRedact } from './autoRedact.ts';
import { normalizeFileOptions } from './FileOptions.ts';
Expand Down Expand Up @@ -405,7 +405,7 @@ describe('Function step console capture', () =>
const script = new Script();
await script.file({ path, mode: 'overwrite' });

script.add(async () =>
script.add(() =>
{
console.log('FUNCTION_LOG_CAPTURED');
}).description('Function with console.log');
Expand All @@ -425,7 +425,7 @@ describe('Function step console capture', () =>
const script = new Script();
await script.file({ path, mode: 'overwrite' });

script.add(async () =>
script.add(() =>
{
console.warn('FUNCTION_WARN');
console.error('FUNCTION_ERROR');
Expand Down Expand Up @@ -491,7 +491,7 @@ describe('Integration: real script execution with file logging', () =>
.and('echo "Build complete!"');

// Step 3: Cleanup function
script.add(async () =>
script.add(() =>
{
console.log('Cleanup: removing temp files');
})
Expand Down Expand Up @@ -551,7 +551,7 @@ describe('Issue fixes', () =>
const script = new Script();
await script.file({ path, mode: 'overwrite' });

script.add(async () =>
script.add(() =>
{
console.log('Count: %d, Name: %s', 42, 'test');
console.log({ nested: { value: 123 } });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { afterEach, describe, expect, test } from 'bun:test';
import { randomUUID } from 'node:crypto';
import { mkdir, readFile, rm, unlink } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { afterEach, describe, expect, test } from '../test/testlib.ts';

import { defaultOutputContext, OutputContext } from './OutputContext.ts';

Expand Down
Loading