Skip to content

Commit 268e581

Browse files
authored
test(server): correct Windows path and settings assertions (#30983)
1 parent c72de52 commit 268e581

3 files changed

Lines changed: 27 additions & 15 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,7 @@ describe("ClaudeAdapterV2 attachments", () => {
20562056
yield* deliver;
20572057
const retried = offeredMessages.at(-1)!.message.content;
20582058
assert.notInclude(JSON.stringify(retried), '"type":"document"');
2059-
assert.include(JSON.stringify(retried), documentPath);
2059+
assert.include(JSON.stringify(retried), JSON.stringify(documentPath).slice(1, -1));
20602060
assert.isBelow(Buffer.byteLength(JSON.stringify(offeredMessages)), 32_000_000);
20612061
return;
20622062
}
@@ -2105,7 +2105,7 @@ describe("ClaudeAdapterV2 attachments", () => {
21052105
typeof sent === "string" ? [] : sent.filter((block) => block.type === "image"),
21062106
budget === "partial-images" ? 1 : 0,
21072107
);
2108-
assert.include(JSON.stringify(sent), imagePath);
2108+
assert.include(JSON.stringify(sent), JSON.stringify(imagePath).slice(1, -1));
21092109
yield* runtime.steerTurn({
21102110
threadId,
21112111
runId: RunId.make("run-claude-attachments"),
@@ -2124,7 +2124,7 @@ describe("ClaudeAdapterV2 attachments", () => {
21242124
: steered.filter((block) => block.type === "image"),
21252125
0,
21262126
);
2127-
assert.include(JSON.stringify(steered), imagePath);
2127+
assert.include(JSON.stringify(steered), JSON.stringify(imagePath).slice(1, -1));
21282128
assert.isBelow(
21292129
Buffer.byteLength(
21302130
JSON.stringify(offeredMessages.map((message) => message.message)),
@@ -2186,7 +2186,7 @@ describe("ClaudeAdapterV2 attachments", () => {
21862186
0,
21872187
budget,
21882188
);
2189-
assert.include(JSON.stringify(sent), documentPath);
2189+
assert.include(JSON.stringify(sent), JSON.stringify(documentPath).slice(1, -1));
21902190
return;
21912191
}
21922192
if (!resumed) {
@@ -2399,7 +2399,7 @@ describe("ClaudeAdapterV2 attachments", () => {
23992399
);
24002400
if (scenario === "text-only")
24012401
assert.equal(sent, ultrathink ? "Ultrathink:\nContinue." : "Continue.");
2402-
else assert.include(JSON.stringify(sent), documentPath);
2402+
else assert.include(JSON.stringify(sent), JSON.stringify(documentPath).slice(1, -1));
24032403
}
24042404
}).pipe(
24052405
Effect.provide(
@@ -4459,8 +4459,8 @@ describe("ClaudeAdapterV2 background wake turns", () => {
44594459
"false",
44604460
);
44614461

4462-
// Claude Code keeps the local file at the repository root, the main checkout's root in a
4463-
// worktree, and that file beats the user's settings.
4462+
// POSIX resolves local settings at the repository root; Windows uses cwd.
4463+
// Local settings beat user settings wherever they are found.
44644464
const repo = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-claude-repo-" });
44654465
const worktree = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-claude-wt-" });
44664466
const worktreeGitDir = path.join(repo, ".git", "worktrees", "wt");
@@ -4478,11 +4478,23 @@ describe("ClaudeAdapterV2 background wake turns", () => {
44784478
`{"env":{"ENABLE_TOOL_SEARCH":"${value}"}}`,
44794479
);
44804480
const userAuto = '{"env":{"ENABLE_TOOL_SEARCH":"auto"}}';
4481+
const platform = yield* HostProcess.Platform;
44814482
yield* rootLocal("auto");
4482-
assert.equal(yield* openedToolSearch("{}", worktree), "true");
4483+
assert.equal(yield* openedToolSearch("{}", repo), "true");
4484+
assert.equal(
4485+
yield* openedToolSearch("{}", worktree),
4486+
platform === "win32" ? undefined : "true",
4487+
);
44834488
yield* rootLocal("false");
4484-
assert.isUndefined(yield* openedToolSearch(userAuto, worktree));
4485-
assert.isUndefined(yield* openedToolSearch(userAuto, path.join(repo, "packages", "app")));
4489+
assert.isUndefined(yield* openedToolSearch(userAuto, repo));
4490+
assert.equal(
4491+
yield* openedToolSearch(userAuto, worktree),
4492+
platform === "win32" ? "true" : undefined,
4493+
);
4494+
assert.equal(
4495+
yield* openedToolSearch(userAuto, path.join(repo, "packages", "app")),
4496+
platform === "win32" ? "true" : undefined,
4497+
);
44864498

44874499
// Project settings beat user settings, and the process env applies only when no file sets it.
44884500
const project = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-claude-project-" });

‎apps/server/src/provider/Drivers/CodexDriver.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ it.layer(layerTest)("CodexDriver", (it) => {
253253
expect(restored.auth.email).toBe("[email protected]");
254254
expect(restored.runtimePaths?.homePath).toBe(sharedHome);
255255
expect(restored.runtimePaths?.shadowHomePath).toContain(
256-
`providers/codex/${instanceId}/shadow`,
256+
NodePath.join("providers", "codex", instanceId, "shadow"),
257257
);
258258
const scan = yield* instance.snapshotForCwd!(serverConfig.stateDir).pipe(Effect.exit);
259259
expect(Exit.isFailure(scan)).toBe(true);

‎apps/server/src/provider/userInputAttachments.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ describe("question answer paths", () => {
293293
attachmentsDir: config.attachmentsDir,
294294
attachmentsByQuestionId: { q: [file] },
295295
});
296-
expect(answers.q).toContain(`text extracted to: "${path}.txt"`);
296+
expect(answers.q).toContain(`text extracted to: ${JSON.stringify(path + ".txt")}`);
297297
expect(NodeFS.readFileSync(`${path}.txt`, "utf8")).toContain("Vessel: Larkspur");
298298
expect(NodeFS.readFileSync(`${path}.txt`, "utf8")).toContain("301");
299299
expect(NodeFS.readFileSync(`${path}.txt`, "utf8")).toContain("42");
@@ -354,7 +354,7 @@ describe("question answer paths", () => {
354354
attachmentsDir: config.attachmentsDir,
355355
attachmentsByQuestionId: { q: [file] },
356356
});
357-
expect(answers.q).toContain(path);
357+
expect(answers.q).toContain(JSON.stringify(path));
358358
expect(answers.q).not.toContain("text extracted");
359359
expect(NodeFS.existsSync(`${path}.txt`)).toBe(false);
360360
expect(NodeFS.readFileSync(path, "utf8")).toBe("invalid document");
@@ -1146,7 +1146,7 @@ describe("question answer paths", () => {
11461146
expect(answers.q).toEqual([
11471147
"First",
11481148
"Second",
1149-
`Attached file "spec \\"final\\".txt": "${path}"`,
1149+
`Attached file "spec \\"final\\".txt": ${JSON.stringify(path)}`,
11501150
]);
11511151
expect(answers.other).toBe("No file");
11521152
expect(original.q).toEqual(["First", "Second"]);
@@ -1157,7 +1157,7 @@ describe("question answer paths", () => {
11571157
attachmentsByQuestionId: { ["__proto__"]: [attachment] },
11581158
});
11591159
expect(Object.keys(specialKey)).toEqual(["__proto__"]);
1160-
expect(specialKey["__proto__"]).toContain(path);
1160+
expect(specialKey["__proto__"]).toContain(JSON.stringify(path));
11611161
}).pipe(Effect.provide(layer)),
11621162
);
11631163
it.effect("does not send an unavailable attachment path", () =>

0 commit comments

Comments
 (0)