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
12 changes: 0 additions & 12 deletions quest/m0/host-independent-tests.md

This file was deleted.

9 changes: 8 additions & 1 deletion test/review.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,14 @@ function setup(host: "CLAUDECODE" | "CODEX_THREAD_ID" | null = "CLAUDECODE"): Se
vi.stubEnv("PATH", `${bin}:${process.env.PATH}`);
vi.stubEnv("FAKE_LOG", log);
// The session's own profile would change the logged-out errors.
const unset = [...HOST_CREDENTIALS, "CLAUDECODE", "CODEX_THREAD_ID", "CLAUDE_CONFIG_DIR", "CODEX_HOME"];
const unset = [
...HOST_CREDENTIALS,
"CLAUDECODE",
"CODEX_THREAD_ID",
"CLAUDE_CONFIG_DIR",
"CODEX_HOME",
"OPENAI_BASE_URL",
];
for (const name of [
...unset,
"FAKE_LOGGED_OUT",
Expand Down
22 changes: 17 additions & 5 deletions test/usage.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { execFileSync } from "node:child_process";
import { mkdirSync, writeFileSync } from "node:fs";
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
import { join } from "node:path";

import { describe, expect, test } from "vitest";
Expand All @@ -18,6 +18,15 @@ const OWNED = "f1913a12-44c4-438c-a9d9-06e5b1192c04";
const GONE = "83a08f0e-6ef1-4b41-ad0c-58b37fc993f8";
const BOTH = "5d2c7f3e-8a41-4b6e-9f0d-2c6a1e7b4d93";

// Checkouts since deleted: directories the test created and removed, so no host path of the same name is read.
const removed = () => {
const path = tempDir();
rmSync(path, { recursive: true });
return path;
};
const WORK = removed();
const OTHER_WORK = removed();

const lines = (...records: unknown[]) => `${records.map((r) => JSON.stringify(r)).join("\n")}\n`;

/** A Claude Code log line; the message stands in for a prompt the report must never read out. */
Expand All @@ -41,7 +50,7 @@ const codexLog = (
payload: {
id: THREAD,
timestamp,
cwd: extra.cwd ?? "/work",
cwd: extra.cwd ?? WORK,
source: extra.source ?? "exec",
git: branch ? { branch, repository_url: extra.url ?? "https://github.com/acme/proj.git" } : undefined,
},
Expand Down Expand Up @@ -415,11 +424,11 @@ describe("usage", () => {
// below it, which may be another repository's and so is not charged to this one.
writeFileSync(
join(claudeHome, "projects", "-work", `${OWNED}.jsonl`),
lines(claude("2026-11-06T14:00:00Z", "quest/m0/a", { cwd: "/work" })),
lines(claude("2026-11-06T14:00:00Z", "quest/m0/a", { cwd: WORK })),
);
writeFileSync(
join(claudeHome, "projects", "-work", `${GONE}.jsonl`),
lines(claude("2026-11-06T14:00:00Z", "quest/m0/a", { cwd: "/work/nested" })),
lines(claude("2026-11-06T14:00:00Z", "quest/m0/a", { cwd: join(WORK, "nested") })),
);
const codexHome = join(dir, "codex");
const day = join(codexHome, "sessions", "2026", "11", "06");
Expand All @@ -432,7 +441,10 @@ describe("usage", () => {
);
writeFileSync(
join(day, "rollout-c-22222222-2222-2222-2222-222222222222.jsonl"),
codexLog("2026-11-06T13:00:00Z", "quest/m0/a", { url: "https://github.com/other/repo.git", cwd: "/other" }),
codexLog("2026-11-06T13:00:00Z", "quest/m0/a", {
url: "https://github.com/other/repo.git",
cwd: OTHER_WORK,
}),
);

const body10 = [
Expand Down
Loading