chore(deadcode): remove stale session test facades

This commit is contained in:
Vincent Koc
2026-06-22 22:07:37 +08:00
parent 8744e86e67
commit 83cfb6112c
6 changed files with 9 additions and 22 deletions

View File

@@ -2,6 +2,7 @@
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { setActivePluginRegistry } from "../../plugins/runtime.js";
import { createSessionConversationTestRegistry } from "../../test-utils/session-conversation-registry.js";
import { parseSessionThreadInfo } from "./thread-info.js";
import type { SessionEntry } from "./types.js";
const storeState = vi.hoisted(() => {
@@ -37,7 +38,6 @@ vi.mock("./targets.js", () => ({
}));
let extractDeliveryInfo: typeof import("./delivery-info.js").extractDeliveryInfo;
let parseSessionThreadInfo: typeof import("./delivery-info.js").parseSessionThreadInfo;
const buildEntry = (deliveryContext: SessionEntry["deliveryContext"]): SessionEntry => ({
sessionId: "session-1",
@@ -46,7 +46,7 @@ const buildEntry = (deliveryContext: SessionEntry["deliveryContext"]): SessionEn
});
beforeAll(async () => {
({ extractDeliveryInfo, parseSessionThreadInfo } = await import("./delivery-info.js"));
({ extractDeliveryInfo } = await import("./delivery-info.js"));
});
beforeEach(() => {

View File

@@ -19,7 +19,6 @@ import { readSessionStoreSnapshot } from "./store.js";
import { resolveAllAgentSessionStoreTargetsSync } from "./targets.js";
import { parseSessionThreadInfo } from "./thread-info.js";
import type { SessionEntry } from "./types.js";
export { parseSessionThreadInfo };
function hasRoutableDeliveryContext(context?: {
channel?: string;

View File

@@ -1,11 +1,8 @@
// Session store writer tests cover serialized session writes and cleanup.
import { afterEach, describe, expect, it } from "vitest";
import { createDeferred } from "../../test-utils/deferred.js";
import {
clearSessionStoreCacheForTest,
getSessionStoreWriterQueueSizeForTest,
withSessionStoreWriterForTest,
} from "./store.js";
import { runExclusiveSessionStoreWrite } from "./store-writer.js";
import { clearSessionStoreCacheForTest, getSessionStoreWriterQueueSizeForTest } from "./store.js";
describe("session store writer", () => {
afterEach(() => {
@@ -18,13 +15,13 @@ describe("session store writer", () => {
const releaseFirst = createDeferred();
const order: string[] = [];
const first = withSessionStoreWriterForTest(storePath, async () => {
const first = runExclusiveSessionStoreWrite(storePath, async () => {
order.push("first:start");
firstStarted.resolve();
await releaseFirst.promise;
order.push("first:end");
});
const second = withSessionStoreWriterForTest(storePath, async () => {
const second = runExclusiveSessionStoreWrite(storePath, async () => {
order.push("second");
});
@@ -40,7 +37,7 @@ describe("session store writer", () => {
});
it("rejects empty store paths before enqueuing work", async () => {
await expect(withSessionStoreWriterForTest("", async () => undefined)).rejects.toThrow(
await expect(runExclusiveSessionStoreWrite("", async () => undefined)).rejects.toThrow(
/storePath must be a non-empty string/,
);
expect(getSessionStoreWriterQueueSizeForTest()).toBe(0);

View File

@@ -2,14 +2,6 @@
import { runQueuedStoreWrite } from "../../shared/store-writer-queue.js";
import { WRITER_QUEUES } from "./store-writer-state.js";
/** Runs a callback under the same per-store writer queue used in production. */
export async function withSessionStoreWriterForTest<T>(
storePath: string,
fn: () => Promise<T>,
): Promise<T> {
return await runExclusiveSessionStoreWrite(storePath, fn);
}
export async function runExclusiveSessionStoreWrite<T>(
storePath: string,
fn: () => Promise<T>,

View File

@@ -82,7 +82,6 @@ export {
drainSessionStoreWriterQueuesForTest,
getSessionStoreWriterQueueSizeForTest,
} from "./store-writer-state.js";
export { withSessionStoreWriterForTest } from "./store-writer.js";
export {
loadSessionStore,
readSessionEntries,

View File

@@ -4,10 +4,10 @@ import os from "node:os";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { resetSessionWriteLockStateForTest } from "../agents/session-write-lock.js";
import { runExclusiveSessionStoreWrite } from "../config/sessions/store-writer.js";
import {
clearSessionStoreCacheForTest,
getSessionStoreWriterQueueSizeForTest,
withSessionStoreWriterForTest,
} from "../config/sessions/store.js";
import { resetFileLockStateForTest } from "../infra/file-lock.js";
import { createDeferred } from "./deferred.js";
@@ -67,7 +67,7 @@ describe("cleanupSessionStateForTest", () => {
});
let running: Promise<void> | undefined;
try {
running = withSessionStoreWriterForTest(storePath, async () => {
running = runExclusiveSessionStoreWrite(storePath, async () => {
started.resolve();
await release.promise;
});