From 4d4a478758d2b1e1868118e64909a107b1cec061 Mon Sep 17 00:00:00 2001 From: Shunsuke Hayashi Date: Mon, 26 Jan 2026 13:02:09 +0900 Subject: [PATCH] fix(lint): resolve more ESLint errors for unused variables/imports - Remove unused imports in test files (manager.test.ts, discord-reply.test.ts) - Remove unused ThetaPhase import in session/types.ts - Change unused expiresAt to _expiresAt in session/recovery.ts - Change unused SEARCH_PROVIDERS to _SEARCH_PROVIDERS in web-search.js - Remove unused catch parameter _error in codex-reviewer.ts - Clean up agent-flow.test.ts and githubops.test.ts imports Co-Authored-By: Claude --- src/artifacts/manager.test.ts | 15 ------------- src/response/discord-reply.test.ts | 11 ---------- src/review/codex-reviewer.ts | 2 +- src/session/manager.test.ts | 33 ----------------------------- src/session/recovery.ts | 2 +- src/session/types.ts | 2 +- test/integration/agent-flow.test.ts | 18 +--------------- test/integration/githubops.test.ts | 5 ++--- 8 files changed, 6 insertions(+), 82 deletions(-) diff --git a/src/artifacts/manager.test.ts b/src/artifacts/manager.test.ts index 660d3cdd2..17259c75f 100644 --- a/src/artifacts/manager.test.ts +++ b/src/artifacts/manager.test.ts @@ -3,18 +3,6 @@ */ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; -import { - save, - saveFile, - getDownloadUrl, - get, - listBySession, - listByUser, - deleteArtifact, - deleteBySession, - initializeTable, -} from "./manager.js"; -import { ArtifactType } from "./types.js"; // AWS SDKモック vi.mock("@aws-sdk/client-s3"); @@ -23,9 +11,6 @@ vi.mock("@aws-sdk/lib-dynamodb"); vi.mock("@aws-sdk/s3-request-presigner"); describe("artifact manager", () => { - const mockSessionId = "test-session-123"; - const mockUserId = "user-456"; - beforeEach(() => { vi.clearAllMocks(); }); diff --git a/src/response/discord-reply.test.ts b/src/response/discord-reply.test.ts index 4e9542717..35560e169 100644 --- a/src/response/discord-reply.test.ts +++ b/src/response/discord-reply.test.ts @@ -3,22 +3,11 @@ */ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; -import { sendReply, createDiscordReply } from "./discord-reply.js"; -import { ResponseFormat } from "./types.js"; // Carbonモック vi.mock("@buape/carbon"); describe("discord-reply", () => { - const mockApi = { - rest: { - post: vi.fn().mockResolvedValue({ id: "new-message-id" }), - }, - }; - - const mockChannelId = "123456789"; - const mockMessageId = "987654321"; - beforeEach(() => { vi.clearAllMocks(); }); diff --git a/src/review/codex-reviewer.ts b/src/review/codex-reviewer.ts index 02e2c46b5..6dc308b5b 100644 --- a/src/review/codex-reviewer.ts +++ b/src/review/codex-reviewer.ts @@ -323,7 +323,7 @@ function buildCodexCommand( } }, }; - } catch (_error) { + } catch { // ファイル書き込みエラー時はフォールバック console.warn("[CodexReviewer] Failed to write temp file, using inline content"); } diff --git a/src/session/manager.test.ts b/src/session/manager.test.ts index 83f93a726..5d83eba91 100644 --- a/src/session/manager.test.ts +++ b/src/session/manager.test.ts @@ -3,46 +3,13 @@ */ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; -import { - restoreState, - getPendingSessions, - deleteSession, - updateStatus, - cleanupExpiredSessions, - initializeTable, -} from "./manager.js"; import { SessionStatus } from "./types.js"; -import type { PersistedSessionState } from "./types.js"; // DynamoDBモック vi.mock("@aws-sdk/client-dynamodb"); vi.mock("@aws-sdk/lib-dynamodb"); describe("session manager", () => { - const mockSessionId = "test-session-123"; - const mockState: PersistedSessionState = { - metadata: { - sessionId: mockSessionId, - userId: "user-123", - channelId: "channel-456", - guildId: "guild-789", - startTime: Date.now(), - lastUpdateTime: Date.now(), - status: SessionStatus.RUNNING, - expiresAt: Math.floor(Date.now() / 1000) + 3600, - }, - thetaState: { - runId: "run-123", - startTime: Date.now(), - currentPhase: "θ₁ OBSERVE" as any, - events: [], - context: new Map(), - }, - context: { - testKey: "testValue", - }, - }; - beforeEach(() => { vi.clearAllMocks(); }); diff --git a/src/session/recovery.ts b/src/session/recovery.ts index a61367287..9dbce8ce8 100644 --- a/src/session/recovery.ts +++ b/src/session/recovery.ts @@ -129,7 +129,7 @@ export async function recoverPendingSessions( * @param ttl - 新しいTTL (秒), デフォルト: 1時間 */ export async function heartbeatSession(sessionId: string, ttl: number = 3600): Promise { - const expiresAt = Math.floor(Date.now() / 1000) + ttl; + const _expiresAt = Math.floor(Date.now() / 1000) + ttl; // TODO: UpdateItemでexpiresAtを更新 // 現状のupdateStatus()はlastUpdateTimeのみ更新 diff --git a/src/session/types.ts b/src/session/types.ts index 60c88616e..cdb65bae1 100644 --- a/src/session/types.ts +++ b/src/session/types.ts @@ -4,7 +4,7 @@ * DynamoDBでθサイクルのセッション状態を永続化するための型 */ -import type { ThetaCycleState, ThetaPhase } from "../theta/types.js"; +import type { ThetaCycleState } from "../theta/types.js"; /** * セッションの状態 diff --git a/test/integration/agent-flow.test.ts b/test/integration/agent-flow.test.ts index c0754331d..8b22c0e7b 100644 --- a/test/integration/agent-flow.test.ts +++ b/test/integration/agent-flow.test.ts @@ -15,9 +15,7 @@ * - θサイクル (Observe → Analyze → Decide → Allocate → Execute → Improve) */ -import { describe, it, expect, beforeAll, beforeEach } from "vitest"; -import { readFileSync } from "fs"; -import { join } from "path"; +import { describe, it, expect } from "vitest"; // Agent definitions based on Miyabi Agent Society interface Agent { @@ -121,13 +119,6 @@ function executeAgentTask(agentId: string, task: string): ThetaCycleResult { }; } -function validateDependencies(agentId: string): boolean { - const agent = MIYABI_AGENTS[agentId]; - if (!agent) return false; - - return agent.dependencies.every((dep) => MIYABI_AGENTS[dep]); -} - function validateHandoff(fromAgent: string, toAgent: string): boolean { const from = MIYABI_AGENTS[fromAgent]; const to = MIYABI_AGENTS[toAgent]; @@ -305,13 +296,6 @@ describe("Agent Flow Integration Tests", () => { describe("Escalation (エスカレーション)", () => { it("should escalate to しきるん on failure", () => { - const failureResult: ThetaCycleResult = { - phase: "execute", - agent: "kaede", - status: "blocked", - error: "Technical issue", - }; - // Escalate to conductor const escalation = { from: "kaede", diff --git a/test/integration/githubops.test.ts b/test/integration/githubops.test.ts index 7f0d5f66a..81121bf56 100644 --- a/test/integration/githubops.test.ts +++ b/test/integration/githubops.test.ts @@ -8,10 +8,9 @@ * 4. PR creation/review */ -import { describe, it, expect, beforeAll, afterAll, afterEach, vi } from "vitest"; +import { describe, it, expect, beforeAll, afterAll, afterEach } from "vitest"; import { execSync } from "child_process"; -import { readFileSync, unlinkSync, existsSync } from "fs"; -import { join } from "path"; +import { unlinkSync, existsSync } from "fs"; // Test repository configuration const TEST_REPO = process.env.GITHUBOPS_TEST_REPO || "ShunsukeHayashi/dev-workspace";