From 56fbfdea968d3c07b5efdf5310bae1bb68993d5c Mon Sep 17 00:00:00 2001 From: can1357 Date: Sat, 27 Jun 2026 01:21:33 +0200 Subject: [PATCH] fix(pr-3347): use worktree-local cleanup helper in ai tests --- packages/ai/test/auth-broker-oauth-extra-fields.test.ts | 2 +- packages/ai/test/auth-broker-refresher.test.ts | 2 +- packages/ai/test/auth-broker-remote-store.test.ts | 2 +- packages/ai/test/auth-broker-snapshot-cache.test.ts | 2 +- packages/ai/test/auth-broker-wire.test.ts | 2 +- packages/ai/test/auth-storage-account-identity.test.ts | 2 +- packages/ai/test/auth-storage-antigravity-selection.test.ts | 2 +- packages/ai/test/auth-storage-api-key-login.test.ts | 2 +- packages/ai/test/auth-storage-broker-no-sentinel.test.ts | 2 +- packages/ai/test/auth-storage-codex-selection.test.ts | 2 +- packages/ai/test/auth-storage-config-override.test.ts | 2 +- packages/ai/test/auth-storage-credential-origin.test.ts | 2 +- packages/ai/test/auth-storage-email-dedupe.test.ts | 2 +- packages/ai/test/auth-storage-force-refresh-rotate.test.ts | 2 +- packages/ai/test/auth-storage-oauth-refresh-race.test.ts | 2 +- packages/ai/test/auth-storage-refresh-skew.test.ts | 2 +- packages/ai/test/auth-storage-sqlite-busy.test.ts | 2 +- packages/ai/test/aws-credentials.test.ts | 2 +- packages/ai/test/issue-1417-repro.test.ts | 2 +- packages/ai/test/issue-957-repro.test.ts | 2 +- packages/ai/test/model-cache.test.ts | 2 +- packages/ai/test/remote-auth-store.test.ts | 2 +- packages/ai/test/request-debug.test.ts | 2 +- packages/ai/test/stream.test.ts | 3 ++- 24 files changed, 25 insertions(+), 24 deletions(-) diff --git a/packages/ai/test/auth-broker-oauth-extra-fields.test.ts b/packages/ai/test/auth-broker-oauth-extra-fields.test.ts index 84d0649b4..ccd8c566e 100644 --- a/packages/ai/test/auth-broker-oauth-extra-fields.test.ts +++ b/packages/ai/test/auth-broker-oauth-extra-fields.test.ts @@ -9,7 +9,7 @@ import { RemoteAuthCredentialStore, startAuthBroker, } from "@oh-my-pi/pi-ai/auth-broker"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; // MCP OAuth credentials extend the base OAuthCredential with refresh material // (tokenUrl/clientId/clientSecret/resource) embedded so token refresh works for diff --git a/packages/ai/test/auth-broker-refresher.test.ts b/packages/ai/test/auth-broker-refresher.test.ts index 346ae5d99..bdfec3efe 100644 --- a/packages/ai/test/auth-broker-refresher.test.ts +++ b/packages/ai/test/auth-broker-refresher.test.ts @@ -5,7 +5,7 @@ import * as path from "node:path"; import { AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai"; import { AuthBrokerRefresher } from "@oh-my-pi/pi-ai/auth-broker"; import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; const ANTHROPIC_ENV = ["ANTHROPIC_API_KEY", "ANTHROPIC_OAUTH_TOKEN"] as const; const savedEnv: Partial> = {}; diff --git a/packages/ai/test/auth-broker-remote-store.test.ts b/packages/ai/test/auth-broker-remote-store.test.ts index 603ccf5c7..589f0a160 100644 --- a/packages/ai/test/auth-broker-remote-store.test.ts +++ b/packages/ai/test/auth-broker-remote-store.test.ts @@ -10,7 +10,7 @@ import { type SnapshotResponse, startAuthBroker, } from "@oh-my-pi/pi-ai/auth-broker"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; const ANTHROPIC_ENV = ["ANTHROPIC_API_KEY", "ANTHROPIC_OAUTH_TOKEN"] as const; const savedEnv: Partial> = {}; diff --git a/packages/ai/test/auth-broker-snapshot-cache.test.ts b/packages/ai/test/auth-broker-snapshot-cache.test.ts index bc56eee8f..36f443c5b 100644 --- a/packages/ai/test/auth-broker-snapshot-cache.test.ts +++ b/packages/ai/test/auth-broker-snapshot-cache.test.ts @@ -7,7 +7,7 @@ import { type SnapshotResponse, writeAuthBrokerSnapshotCache, } from "@oh-my-pi/pi-ai/auth-broker"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; const TOKEN = "broker-cache-token"; const URL = "http://127.0.0.1:8765"; diff --git a/packages/ai/test/auth-broker-wire.test.ts b/packages/ai/test/auth-broker-wire.test.ts index 6197c737c..256c3c73d 100644 --- a/packages/ai/test/auth-broker-wire.test.ts +++ b/packages/ai/test/auth-broker-wire.test.ts @@ -11,7 +11,7 @@ import { startAuthBroker, } from "@oh-my-pi/pi-ai/auth-broker"; import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; const ANTHROPIC_ENV = ["ANTHROPIC_API_KEY", "ANTHROPIC_OAUTH_TOKEN"] as const; const savedEnv: Partial> = {}; diff --git a/packages/ai/test/auth-storage-account-identity.test.ts b/packages/ai/test/auth-storage-account-identity.test.ts index 567fe4d38..47022320c 100644 --- a/packages/ai/test/auth-storage-account-identity.test.ts +++ b/packages/ai/test/auth-storage-account-identity.test.ts @@ -4,7 +4,7 @@ import * as os from "node:os"; import * as path from "node:path"; import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; const PROVIDER = "unit-oauth-identity"; diff --git a/packages/ai/test/auth-storage-antigravity-selection.test.ts b/packages/ai/test/auth-storage-antigravity-selection.test.ts index f909559ed..6763ce5e9 100644 --- a/packages/ai/test/auth-storage-antigravity-selection.test.ts +++ b/packages/ai/test/auth-storage-antigravity-selection.test.ts @@ -16,7 +16,7 @@ import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; import type { OAuthCredentials } from "@oh-my-pi/pi-ai/registry/oauth/types"; import type { UsageLimit, UsageProvider, UsageReport } from "@oh-my-pi/pi-ai/usage"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; const HOUR_MS = 60 * 60 * 1000; diff --git a/packages/ai/test/auth-storage-api-key-login.test.ts b/packages/ai/test/auth-storage-api-key-login.test.ts index fcc406496..e50e0fd4f 100644 --- a/packages/ai/test/auth-storage-api-key-login.test.ts +++ b/packages/ai/test/auth-storage-api-key-login.test.ts @@ -8,7 +8,7 @@ import { AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-sto import * as deepseekModule from "@oh-my-pi/pi-ai/registry/deepseek"; import * as kagiModule from "@oh-my-pi/pi-ai/registry/kagi"; import * as ollamaCloudModule from "@oh-my-pi/pi-ai/registry/ollama-cloud"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; function countCredentialRows(dbPath: string, provider: string): number { const db = new Database(dbPath, { readonly: true }); diff --git a/packages/ai/test/auth-storage-broker-no-sentinel.test.ts b/packages/ai/test/auth-storage-broker-no-sentinel.test.ts index f4a10a29e..36054716a 100644 --- a/packages/ai/test/auth-storage-broker-no-sentinel.test.ts +++ b/packages/ai/test/auth-storage-broker-no-sentinel.test.ts @@ -9,7 +9,7 @@ import { SqliteAuthCredentialStore, } from "@oh-my-pi/pi-ai/auth-storage"; import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; describe("AuthStorage broker sentinel refresh", () => { let tempDir = ""; diff --git a/packages/ai/test/auth-storage-codex-selection.test.ts b/packages/ai/test/auth-storage-codex-selection.test.ts index a43b95e48..fa84ae886 100644 --- a/packages/ai/test/auth-storage-codex-selection.test.ts +++ b/packages/ai/test/auth-storage-codex-selection.test.ts @@ -6,7 +6,7 @@ import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; import type { OAuthCredentials } from "@oh-my-pi/pi-ai/registry/oauth/types"; import type { UsageLimit, UsageProvider, UsageReport } from "@oh-my-pi/pi-ai/usage"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; const WEEK_MS = 7 * 24 * 60 * 60 * 1000; const HOUR_MS = 60 * 60 * 1000; diff --git a/packages/ai/test/auth-storage-config-override.test.ts b/packages/ai/test/auth-storage-config-override.test.ts index 17b33672e..0369ad092 100644 --- a/packages/ai/test/auth-storage-config-override.test.ts +++ b/packages/ai/test/auth-storage-config-override.test.ts @@ -3,7 +3,7 @@ import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; import { withEnv } from "./helpers"; const SUPPRESS_ANTHROPIC_ENV = { diff --git a/packages/ai/test/auth-storage-credential-origin.test.ts b/packages/ai/test/auth-storage-credential-origin.test.ts index 6032a3ce7..822ffeff4 100644 --- a/packages/ai/test/auth-storage-credential-origin.test.ts +++ b/packages/ai/test/auth-storage-credential-origin.test.ts @@ -3,7 +3,7 @@ import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; import { withEnv } from "./helpers"; // Clear every env var the providers under test alias, so ambient shell / ~/.env diff --git a/packages/ai/test/auth-storage-email-dedupe.test.ts b/packages/ai/test/auth-storage-email-dedupe.test.ts index 78ddf1756..b0c62af4f 100644 --- a/packages/ai/test/auth-storage-email-dedupe.test.ts +++ b/packages/ai/test/auth-storage-email-dedupe.test.ts @@ -4,7 +4,7 @@ import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; import { AuthStorage, type FetchImpl, type OAuthCredential, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; import { registerOAuthProvider, unregisterOAuthProviders } from "../src/registry/oauth"; const LEGACY_TIMESTAMP = 1_700_000_000; diff --git a/packages/ai/test/auth-storage-force-refresh-rotate.test.ts b/packages/ai/test/auth-storage-force-refresh-rotate.test.ts index b6c872906..1d01f76e4 100644 --- a/packages/ai/test/auth-storage-force-refresh-rotate.test.ts +++ b/packages/ai/test/auth-storage-force-refresh-rotate.test.ts @@ -4,7 +4,7 @@ import * as os from "node:os"; import * as path from "node:path"; import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; import { registerOAuthProvider, unregisterOAuthProviders } from "@oh-my-pi/pi-ai/registry/oauth"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; const PROVIDER = "unit-rotate-oauth"; const SOURCE = "auth-storage-force-refresh-rotate-test"; diff --git a/packages/ai/test/auth-storage-oauth-refresh-race.test.ts b/packages/ai/test/auth-storage-oauth-refresh-race.test.ts index 2895d8455..6b9323958 100644 --- a/packages/ai/test/auth-storage-oauth-refresh-race.test.ts +++ b/packages/ai/test/auth-storage-oauth-refresh-race.test.ts @@ -9,7 +9,7 @@ import { SqliteAuthCredentialStore, } from "@oh-my-pi/pi-ai/auth-storage"; import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; import { withEnv } from "./helpers"; const SUPPRESS_ANTHROPIC_ENV = { diff --git a/packages/ai/test/auth-storage-refresh-skew.test.ts b/packages/ai/test/auth-storage-refresh-skew.test.ts index 3f62aff49..f4da6fb41 100644 --- a/packages/ai/test/auth-storage-refresh-skew.test.ts +++ b/packages/ai/test/auth-storage-refresh-skew.test.ts @@ -4,7 +4,7 @@ import * as os from "node:os"; import * as path from "node:path"; import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; import { registerOAuthProvider, unregisterOAuthProviders } from "@oh-my-pi/pi-ai/registry/oauth"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; describe("AuthStorage OAuth refresh skew", () => { let tempDir = ""; diff --git a/packages/ai/test/auth-storage-sqlite-busy.test.ts b/packages/ai/test/auth-storage-sqlite-busy.test.ts index c49ec4896..f1582dc46 100644 --- a/packages/ai/test/auth-storage-sqlite-busy.test.ts +++ b/packages/ai/test/auth-storage-sqlite-busy.test.ts @@ -14,7 +14,7 @@ import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; import { isSqliteBusyError, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; interface SqliteBusyShape extends Error { code: string; diff --git a/packages/ai/test/aws-credentials.test.ts b/packages/ai/test/aws-credentials.test.ts index eb091573b..ecb263ff0 100644 --- a/packages/ai/test/aws-credentials.test.ts +++ b/packages/ai/test/aws-credentials.test.ts @@ -7,7 +7,7 @@ import { resolveAwsCredentials, tokenizeCredentialProcessCommand, } from "@oh-my-pi/pi-ai/providers/aws-credentials"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; // `credential_process` integration coverage. Drives a real `Bun.spawn` // against a fixture script so the JSON envelope contract, exit-code diff --git a/packages/ai/test/issue-1417-repro.test.ts b/packages/ai/test/issue-1417-repro.test.ts index 19605f85e..275bf4ade 100644 --- a/packages/ai/test/issue-1417-repro.test.ts +++ b/packages/ai/test/issue-1417-repro.test.ts @@ -5,7 +5,7 @@ import * as path from "node:path"; import type { ModelSpec } from "@oh-my-pi/pi-ai/types"; import { readModelCache } from "@oh-my-pi/pi-catalog/model-cache"; import { resolveProviderModels } from "@oh-my-pi/pi-catalog/model-manager"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; const TTL_MS = 24 * 60 * 60 * 1000; diff --git a/packages/ai/test/issue-957-repro.test.ts b/packages/ai/test/issue-957-repro.test.ts index 5c69ff5a5..ba5794c85 100644 --- a/packages/ai/test/issue-957-repro.test.ts +++ b/packages/ai/test/issue-957-repro.test.ts @@ -4,7 +4,7 @@ import * as os from "node:os"; import * as path from "node:path"; import { AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; import * as kimiOauth from "@oh-my-pi/pi-ai/registry/oauth/kimi"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; afterEach(() => { vi.restoreAllMocks(); diff --git a/packages/ai/test/model-cache.test.ts b/packages/ai/test/model-cache.test.ts index 6023c8c09..f91cbcbaf 100644 --- a/packages/ai/test/model-cache.test.ts +++ b/packages/ai/test/model-cache.test.ts @@ -6,7 +6,7 @@ import * as path from "node:path"; import type { Model } from "@oh-my-pi/pi-ai/types"; import { buildModel } from "@oh-my-pi/pi-catalog/build"; import { readModelCache, writeModelCache } from "@oh-my-pi/pi-catalog/model-cache"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; const TTL_MS = 24 * 60 * 60 * 1000; diff --git a/packages/ai/test/remote-auth-store.test.ts b/packages/ai/test/remote-auth-store.test.ts index fc19dd1ba..6bfdb4278 100644 --- a/packages/ai/test/remote-auth-store.test.ts +++ b/packages/ai/test/remote-auth-store.test.ts @@ -10,7 +10,7 @@ import { startAuthBroker, } from "@oh-my-pi/pi-ai/auth-broker"; import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; const ANTHROPIC_ENV = ["ANTHROPIC_API_KEY", "ANTHROPIC_OAUTH_TOKEN"] as const; const savedEnv: Partial> = {}; diff --git a/packages/ai/test/request-debug.test.ts b/packages/ai/test/request-debug.test.ts index 505402395..3c9b1da1f 100644 --- a/packages/ai/test/request-debug.test.ts +++ b/packages/ai/test/request-debug.test.ts @@ -8,7 +8,7 @@ import type { AssistantMessage, FetchImpl, Model, ModelSpec } from "@oh-my-pi/pi import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; import { wrapFetchForRequestDebug } from "@oh-my-pi/pi-ai/utils/request-debug"; import { buildModel } from "@oh-my-pi/pi-catalog/build"; -import { removeWithRetries } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; const enc = new TextEncoder(); diff --git a/packages/ai/test/stream.test.ts b/packages/ai/test/stream.test.ts index e471f97d5..c49900ff5 100644 --- a/packages/ai/test/stream.test.ts +++ b/packages/ai/test/stream.test.ts @@ -9,7 +9,8 @@ import { complete, getEnvApiKey, stream } from "@oh-my-pi/pi-ai/stream"; import type { Api, Context, ImageContent, Model, OptionsForApi, Tool, ToolResultMessage } from "@oh-my-pi/pi-ai/types"; import { buildModel } from "@oh-my-pi/pi-catalog/build"; import { getBundledModel } from "@oh-my-pi/pi-catalog/models"; -import { $which, removeWithRetries } from "@oh-my-pi/pi-utils"; +import { $which } from "@oh-my-pi/pi-utils"; +import { removeWithRetries } from "../../utils/src/temp"; import { type } from "arktype"; import { e2eApiKey, resolveApiKey } from "./oauth";