Skip to content

Commit 0facd98

Browse files
committed
test: make legacy fixtures platform independent
1 parent bb96a6f commit 0facd98

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

tests/integration/companion.test.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,11 @@ for (const scenario of ['explicit-resume', 'choice-resume', 'choice-fresh']) tes
569569
input: PassThrough.from([`${JSON.stringify({ version: 1, source: 'explicit', task: 'recover candidate',
570570
options: { execution: 'foreground', ...(scenario === 'explicit-resume' ? { resume: 'resume' } : {}) } })}\n`]),
571571
dependencies: { planRescueActivation: (/** @type {any} */ input) => planRescueActivation({ ...input, listChildren: async () => [host] }) } });
572-
const childRuntime = { cwd: workspace, env: { ...context.env, CODEX_THREAD_ID: childId, FAKE_ZCODE_RECORD: record },
572+
// A persisted candidate exists outside the fake peer's in-memory session map.
573+
// Windows intentionally launches that peer from tmpdir, so the fixture must
574+
// state the candidate's durable workspace instead of inheriting process.cwd().
575+
const childRuntime = { cwd: workspace, env: { ...context.env, CODEX_THREAD_ID: childId,
576+
FAKE_ZCODE_RECORD: record, FAKE_ZCODE_WORKSPACE: workspace },
573577
dependencies: { readCodexThreadSpawnChildIdentity: async () => activatedLegacyHost(host) } };
574578
let output = await runDirectInvocation(['invoke-prepared', 'rescue'], childRuntime);
575579
if (scenario !== 'explicit-resume') {

tests/state.test.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
writeFile,
2020
} from 'node:fs/promises';
2121
import { tmpdir } from 'node:os';
22-
import { basename, join } from 'node:path';
22+
import { basename, isAbsolute, join } from 'node:path';
2323
import { fileURLToPath } from 'node:url';
2424
import test from 'node:test';
2525

@@ -141,6 +141,8 @@ test('StateStore transient continuation matrix rejects child, key, turn, permiss
141141
await store.transitionJob(workspace, first.job.id, ['queued'], 'running', { startedAt: new Date().toISOString(), zcodeSessionId: 'legacy-session' });
142142
await store.finishJob(workspace, first.job.id, ['running'], 'succeeded');
143143
const before = (await store.listJobs(workspace)).length;
144+
const foreignOrigin = join(base.root, 'foreign-origin');
145+
assert.equal(isAbsolute(foreignOrigin), true);
144146
const genuine = [
145147
[await brandedStateAuthority(base.dataRoot, workspace, 'legacy-bound', 'sibling-turn', first.binding.key,
146148
{ childAgentId: 'sibling' }), 'sibling-turn', 'workspace-write'],
@@ -151,7 +153,7 @@ test('StateStore transient continuation matrix rejects child, key, turn, permiss
151153
[await brandedStateAuthority(base.dataRoot, workspace, 'legacy-bound', 'path-turn', first.binding.key,
152154
{ agentPathDigest: '8'.repeat(64) }), 'path-turn', 'workspace-write'],
153155
[await brandedStateAuthority(base.dataRoot, workspace, 'legacy-bound', 'origin-turn', first.binding.key,
154-
{ originWorkspace: '/private/foreign' }), 'origin-turn', 'workspace-write'],
156+
{ originWorkspace: foreignOrigin }), 'origin-turn', 'workspace-write'],
155157
[await brandedStateAuthority(base.dataRoot, workspace, 'legacy-adopt', 'kind-turn'), 'kind-turn', 'workspace-write'],
156158
];
157159
for (const [authority, turn, permissionMode] of genuine) {

0 commit comments

Comments
 (0)