Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

test(catalog): let the contract tests run under the hermetic gate

Jack Rudenko5b5354a191da
diff --git a/packages/cli/src/providers/catalog-client-contract.test.ts b/packages/cli/src/providers/catalog-client-contract.test.ts
index dbb82b23..410a9649 100644
--- a/packages/cli/src/providers/catalog-client-contract.test.ts
+++ b/packages/cli/src/providers/catalog-client-contract.test.ts
@@ -73,14 +73,18 @@ async function runRefreshChild(urls: {
);
console.log(JSON.stringify({ outcome, sentinel }));
`;
+ const env: Record<string, string | undefined> = {
+ ...process.env,
+ HOME: tempHome,
+ CLAUDISH_CATALOG_URL: urls.catalogUrl,
+ CLAUDISH_PLANS_URL: urls.plansUrl,
+ };
+ // Safe: the loopback CLAUDISH_CATALOG_URL override and temp HOME's isolated
+ // cachePath keep this hermetic.
+ delete env.CLAUDISH_DISABLE_CATALOG_WARM;
const child = Bun.spawn([process.execPath, "-e", source], {
cwd: import.meta.dir,
- env: {
- ...process.env,
- HOME: tempHome,
- CLAUDISH_CATALOG_URL: urls.catalogUrl,
- CLAUDISH_PLANS_URL: urls.plansUrl,
- },
+ env,
stdout: "pipe",
stderr: "pipe",
});
diff --git a/packages/cli/src/providers/catalog-client.ts b/packages/cli/src/providers/catalog-client.ts
index be3892b9..74fafa49 100644
--- a/packages/cli/src/providers/catalog-client.ts
+++ b/packages/cli/src/providers/catalog-client.ts
@@ -763,7 +763,6 @@ export async function refreshCatalog(
// refresh merge against a catalog it was told to ignore.
clearCatalogIncompatibility();
-
// ── Commit ──────────────────────────────────────────────────────────────
_memCache = entries;
writeAllModelsCache(
diff --git a/scripts/guard-real-config.ts b/scripts/guard-real-config.ts
index 71ded287..e4653fd9 100644
--- a/scripts/guard-real-config.ts
+++ b/scripts/guard-real-config.ts
@@ -64,6 +64,13 @@ const GUARDED = [
"pass a temp path to readAllModelsCache/writeAllModelsCache, or seed in memory the way " +
"catalog-client.ts's _setCatalogEntriesForTest does, instead of writing the real cache",
},
+ {
+ path: join(homedir(), ".claudish", "catalog-incompatible.json"),
+ label: "REAL CATALOG CONTRACT SENTINEL",
+ remedy:
+ "pass a temp path to markCatalogIncompatible/readCatalogIncompatibility, or run the " +
+ "refresh in a child process with its own HOME, instead of writing the real sentinel",
+ },
] as const;
interface Snapshot {