Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ import {
KERNEL_ASSIGNED_PORT,
probeThroughChild,
readKernelAssignedPort,
TSX,
} from './helpers/serve-process.js';
import { defineStackSourceFromLiteral, linkSpec, writeDefineStackConfig } from './helpers/define-stack-fixture.js';

Expand Down Expand Up @@ -127,7 +126,7 @@ interface Live {

function boot(argv: string[], cwd: string, env: Record<string, string | undefined>): Promise<Live> {
return new Promise((resolveBoot, rejectBoot) => {
const child = spawn(TSX, [CLI, ...argv], {
const child = spawn(process.execPath, [CLI, ...argv], {
cwd,
// `childEnv`, never a bare `...process.env` — see its header. Neither
// artifact variable leaks in from the runner: each case states its own.
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/test/build-json-advisory-parity.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ import { linkSpec } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

interface Run {
code: number;
Expand All @@ -93,7 +92,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/test/build-json-failure-conversions.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ import { LIVE_PROBE, liveProbeNodeOptions } from './helpers/live-conversion-prob

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');
const COMPILE_TS = resolve(HERE, '../src/commands/compile.ts');

/**
Expand All @@ -111,7 +110,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1', NODE_OPTIONS: liveProbeNodeOptions() }) },
(err, stdout, stderr) => {
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/test/build-json-failure-warnings.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ import { linkSpec } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');
const COMPILE_TS = resolve(HERE, '../src/commands/compile.ts');

interface Run {
Expand All @@ -105,7 +104,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ import { linkSpec } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

interface Run {
code: number;
Expand All @@ -86,7 +85,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/test/build-multi-package-artifact.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ import { linkSpec } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

interface Run { code: number; stdout: string; stderr: string }

function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/test/build-package-docs-attachment.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ import { linkSpec } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

interface Run { code: number; stdout: string; stderr: string }

function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/test/build-text-face-advisory-count.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ import { execFile } from 'node:child_process';
import { mkdtempSync, rmSync, writeFileSync, mkdirSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { CLI, TSX, childEnv } from './helpers/serve-process.js';
import { CLI, childEnv } from './helpers/serve-process.js';
import { linkSpec } from './helpers/define-stack-fixture.js';

interface Run {
Expand All @@ -94,7 +94,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/test/cloud-login-json-ndjson.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');
const CLOUD_LOGIN_SRC = resolve(HERE, '../src/commands/cloud/login.ts');
const REPO_ROOT = resolve(HERE, '../../..');
const CLI_DOCS = resolve(REPO_ROOT, 'content/docs/deployment/cli.mdx');
Expand Down Expand Up @@ -270,7 +269,7 @@ async function runCloudDeviceLogin(opts: {
});

const shell = [
`'${TSX}' '${CLI}' cloud login${opts.json ? ' --json' : ''} --no-browser`,
`'${process.execPath}' '${CLI}' cloud login${opts.json ? ' --json' : ''} --no-browser`,
`--url 'http://127.0.0.1:${port}'`,
`> '${outFile}' 2> '${errFile}'`,
].join(' ');
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/test/compile-artifact-packages.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import { linkSpec } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

interface Run {
code: number;
Expand All @@ -49,7 +48,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/test/config-miss-stdout-purity.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ import {

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

interface Run {
key: string;
Expand All @@ -80,7 +79,7 @@ interface Run {
function runCli(argv: string[], cwd: string): Promise<Omit<Run, 'key'>> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...argv],
{ cwd, maxBuffer: 32 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down Expand Up @@ -121,7 +120,7 @@ beforeAll(async () => {
// branch misses and the explicit branch resolves against a real cwd.
dir = mkdtempSync(join(tmpdir(), 'os-config-miss-e2e-'));

// Sequential: nineteen `tsx` starts at once is the kind of load that makes a
// Sequential: nineteen CLI starts at once is the kind of load that makes a
// shared box report timeouts instead of verdicts. BOTH faces are driven —
// the `--json` half is the contract this card repaired, the text half is the
// one it had to leave untouched, and only driving the second proves it.
Expand Down
11 changes: 5 additions & 6 deletions packages/cli/test/create-example-retired.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
* `RETIRED_TEMPLATES` is asserted as DATA next door in `create.test.ts`. That
* is worth nothing on its own: a registry nothing reads prints nothing. What is
* measured here is a real child process — the exit status a CI script judges by
* `$?`, and the bytes that reach a terminal. Spawned through `bin/run-dev.js` +
* tsx so the suite does not depend on `packages/cli/dist` having been built
* `$?`, and the bytes that reach a terminal. Spawned through `bin/run-dev.js`
* so the suite does not depend on `packages/cli/dist` having been built
* (`@objectstack/cli#test` depends on `^build` only), the same way
* `create-refuses-invalid-project-name.e2e.test.ts` and
* `generate-agent-retired.e2e.test.ts` spawn.
Expand All @@ -52,7 +52,7 @@
*
* `*.e2e.test.*` is a NAME-decided tier (`scripts/nightly-tiers.mjs`, #16455):
* these files are excluded from the per-PR and merge-queue population and run
* in the nightly job. That is the right lane for four cold `tsx` spawns, and it
* in the nightly job. That is the right lane for four cold CLI spawns, and it
* is where both of this pin's closest siblings already live
* (`create-refuses-invalid-project-name.e2e.test.ts`,
* `generate-agent-retired.e2e.test.ts`).
Expand All @@ -75,7 +75,6 @@ import { RETIRED_TEMPLATES, templates } from '../src/commands/create.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

/** oclif + tsx cold start with every command module loaded; ~2-10 s when healthy. */
const RUN_TIMEOUT_MS = 180_000;
Expand All @@ -93,7 +92,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 8 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down Expand Up @@ -122,7 +121,7 @@ let survivor: Run;
beforeAll(async () => {
dir = mkdtempSync(join(tmpdir(), 'os-create-example-retired-'));

// Sequential on purpose: four cold tsx starts, each loading every command
// Sequential on purpose: four cold CLI starts, each loading every command
// module, in a container several agents share.
retired = await runCli(['create', 'example', PROJECT], dir);
retiredNoName = await runCli(['create', 'example'], dir);
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/test/diff-usage-error-stream.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');
const COMMANDS_DIR = resolve(HERE, '../src/commands');

/** The refusal and its two hint lines — what must be on stderr, never stdout. */
Expand All @@ -84,7 +83,7 @@ interface Run {
function runCli(argv: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...argv],
{ cwd, maxBuffer: 32 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down Expand Up @@ -137,7 +136,7 @@ beforeAll(async () => {
// assumed, by making sure no stray `objectstack.config.*` is in reach.
dir = mkdtempSync(join(tmpdir(), 'os-diff-usage-e2e-'));

// Sequential: concurrent `tsx` starts are the kind of load that makes a
// Sequential: concurrent CLI starts are the kind of load that makes a
// shared box report timeouts instead of verdicts.
control = await runCli(['diff', '--help'], dir);
runs = {};
Expand All @@ -156,7 +155,7 @@ describe('control — the reading below is worthless without this', () => {
// negative: empty streams, non-zero exit. Rule it out before reading
// anything off the runs.
expect(existsSync(CLI)).toBe(true);
expect(existsSync(TSX)).toBe(true);
expect(existsSync(process.execPath)).toBe(true);
});

it('actually reaches `os diff` with this argv', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/test/flow-credential-literal-doors.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { writeDefineStackConfig } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

const SENTINELS = ['cli-header-sentinel', 'cli-url-sentinel', 'cli-input-sentinel'] as const;

Expand Down Expand Up @@ -119,7 +118,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
17 changes: 8 additions & 9 deletions packages/cli/test/generate-refuses-namespace-prefix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

/** oclif + tsx cold starts, five of them, sequential. */
const RUN_TIMEOUT_MS = 240_000;
Expand All @@ -75,10 +74,10 @@ interface Run {
stderr: string;
}

function runTsx(args: string[], cwd: string): Promise<Run> {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
args,
{ cwd, maxBuffer: 8 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down Expand Up @@ -165,12 +164,12 @@ beforeAll(async () => {
brokenBarrel = barrelOf(broken);
brokenFiles = objectFilesIn(broken);

// Sequential on purpose: cold tsx starts in a container several agents share.
// Sequential on purpose: cold CLI starts in a container several agents share.
// Every refusal runs BEFORE its project's control, so the barrel and file
// snapshots above are what each refusal was measured against.
residual = await runTsx([CLI, 'generate', 'object', 'order__line'], namespaced);
residualDryRun = await runTsx([CLI, 'generate', 'view', 'order__line', '--dry-run'], namespaced);
loadFailed = await runTsx([CLI, 'generate', 'object', 'customer'], broken);
residual = await runCli([CLI, 'generate', 'object', 'order__line'], namespaced);
residualDryRun = await runCli([CLI, 'generate', 'view', 'order__line', '--dry-run'], namespaced);
loadFailed = await runCli([CLI, 'generate', 'object', 'customer'], broken);

residualAfter = {
barrel: barrelOf(namespaced),
Expand All @@ -179,8 +178,8 @@ beforeAll(async () => {
};
loadFailedAfter = { barrel: barrelOf(broken), files: objectFilesIn(broken) };

namespacedControl = await runTsx([CLI, 'generate', 'object', 'order_line'], namespaced);
brokenControl = await runTsx([CLI, 'generate', 'dashboard', 'sales'], broken);
namespacedControl = await runCli([CLI, 'generate', 'object', 'order_line'], namespaced);
brokenControl = await runCli([CLI, 'generate', 'dashboard', 'sales'], broken);
}, RUN_TIMEOUT_MS);

afterAll(() => {
Expand Down
15 changes: 7 additions & 8 deletions packages/cli/test/generate-refuses-retired-generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

/** oclif + tsx cold starts, four of them, sequential. */
const RUN_TIMEOUT_MS = 240_000;
Expand All @@ -65,10 +64,10 @@ interface Run {
stderr: string;
}

function runTsx(args: string[], cwd: string): Promise<Run> {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
args,
{ cwd, maxBuffer: 8 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down Expand Up @@ -103,15 +102,15 @@ let afterInherited: string[];
beforeAll(async () => {
dir = mkdtempSync(join(tmpdir(), 'os-g-refuses-retired-'));

// Sequential on purpose: cold tsx starts in a container several agents share.
// Sequential on purpose: cold CLI starts in a container several agents share.
// Every refusal runs BEFORE the control, so the listings below are what each
// refusal was measured against.
schema = await runTsx([CLI, 'generate', 'schema'], dir);
schemaAlias = await runTsx([CLI, 'g', 'schema', '-o', 'custom.schema.json'], dir);
schema = await runCli([CLI, 'generate', 'schema'], dir);
schemaAlias = await runCli([CLI, 'g', 'schema', '-o', 'custom.schema.json'], dir);
afterSchemaRuns = readdirSync(dir);
inherited = await runTsx([CLI, 'g', 'constructor', 'thing'], dir);
inherited = await runCli([CLI, 'g', 'constructor', 'thing'], dir);
afterInherited = readdirSync(dir);
control = await runTsx([CLI, 'g', 'object', 'customer', '--dry-run'], dir);
control = await runCli([CLI, 'g', 'object', 'customer', '--dry-run'], dir);
}, RUN_TIMEOUT_MS);

afterAll(() => {
Expand Down
Loading
Loading