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 <noreply@anthropic.com>
This commit is contained in:
parent
4ec77dc3f4
commit
4d4a478758
@ -3,18 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
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モック
|
// AWS SDKモック
|
||||||
vi.mock("@aws-sdk/client-s3");
|
vi.mock("@aws-sdk/client-s3");
|
||||||
@ -23,9 +11,6 @@ vi.mock("@aws-sdk/lib-dynamodb");
|
|||||||
vi.mock("@aws-sdk/s3-request-presigner");
|
vi.mock("@aws-sdk/s3-request-presigner");
|
||||||
|
|
||||||
describe("artifact manager", () => {
|
describe("artifact manager", () => {
|
||||||
const mockSessionId = "test-session-123";
|
|
||||||
const mockUserId = "user-456";
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,22 +3,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import { sendReply, createDiscordReply } from "./discord-reply.js";
|
|
||||||
import { ResponseFormat } from "./types.js";
|
|
||||||
|
|
||||||
// Carbonモック
|
// Carbonモック
|
||||||
vi.mock("@buape/carbon");
|
vi.mock("@buape/carbon");
|
||||||
|
|
||||||
describe("discord-reply", () => {
|
describe("discord-reply", () => {
|
||||||
const mockApi = {
|
|
||||||
rest: {
|
|
||||||
post: vi.fn().mockResolvedValue({ id: "new-message-id" }),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const mockChannelId = "123456789";
|
|
||||||
const mockMessageId = "987654321";
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -323,7 +323,7 @@ function buildCodexCommand(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} catch (_error) {
|
} catch {
|
||||||
// ファイル書き込みエラー時はフォールバック
|
// ファイル書き込みエラー時はフォールバック
|
||||||
console.warn("[CodexReviewer] Failed to write temp file, using inline content");
|
console.warn("[CodexReviewer] Failed to write temp file, using inline content");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,46 +3,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
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 { SessionStatus } from "./types.js";
|
||||||
import type { PersistedSessionState } from "./types.js";
|
|
||||||
|
|
||||||
// DynamoDBモック
|
// DynamoDBモック
|
||||||
vi.mock("@aws-sdk/client-dynamodb");
|
vi.mock("@aws-sdk/client-dynamodb");
|
||||||
vi.mock("@aws-sdk/lib-dynamodb");
|
vi.mock("@aws-sdk/lib-dynamodb");
|
||||||
|
|
||||||
describe("session manager", () => {
|
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(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -129,7 +129,7 @@ export async function recoverPendingSessions(
|
|||||||
* @param ttl - 新しいTTL (秒), デフォルト: 1時間
|
* @param ttl - 新しいTTL (秒), デフォルト: 1時間
|
||||||
*/
|
*/
|
||||||
export async function heartbeatSession(sessionId: string, ttl: number = 3600): Promise<void> {
|
export async function heartbeatSession(sessionId: string, ttl: number = 3600): Promise<void> {
|
||||||
const expiresAt = Math.floor(Date.now() / 1000) + ttl;
|
const _expiresAt = Math.floor(Date.now() / 1000) + ttl;
|
||||||
|
|
||||||
// TODO: UpdateItemでexpiresAtを更新
|
// TODO: UpdateItemでexpiresAtを更新
|
||||||
// 現状のupdateStatus()はlastUpdateTimeのみ更新
|
// 現状のupdateStatus()はlastUpdateTimeのみ更新
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* DynamoDBでθサイクルのセッション状態を永続化するための型
|
* DynamoDBでθサイクルのセッション状態を永続化するための型
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { ThetaCycleState, ThetaPhase } from "../theta/types.js";
|
import type { ThetaCycleState } from "../theta/types.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* セッションの状態
|
* セッションの状態
|
||||||
|
|||||||
@ -15,9 +15,7 @@
|
|||||||
* - θサイクル (Observe → Analyze → Decide → Allocate → Execute → Improve)
|
* - θサイクル (Observe → Analyze → Decide → Allocate → Execute → Improve)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, it, expect, beforeAll, beforeEach } from "vitest";
|
import { describe, it, expect } from "vitest";
|
||||||
import { readFileSync } from "fs";
|
|
||||||
import { join } from "path";
|
|
||||||
|
|
||||||
// Agent definitions based on Miyabi Agent Society
|
// Agent definitions based on Miyabi Agent Society
|
||||||
interface Agent {
|
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 {
|
function validateHandoff(fromAgent: string, toAgent: string): boolean {
|
||||||
const from = MIYABI_AGENTS[fromAgent];
|
const from = MIYABI_AGENTS[fromAgent];
|
||||||
const to = MIYABI_AGENTS[toAgent];
|
const to = MIYABI_AGENTS[toAgent];
|
||||||
@ -305,13 +296,6 @@ describe("Agent Flow Integration Tests", () => {
|
|||||||
|
|
||||||
describe("Escalation (エスカレーション)", () => {
|
describe("Escalation (エスカレーション)", () => {
|
||||||
it("should escalate to しきるん on failure", () => {
|
it("should escalate to しきるん on failure", () => {
|
||||||
const failureResult: ThetaCycleResult = {
|
|
||||||
phase: "execute",
|
|
||||||
agent: "kaede",
|
|
||||||
status: "blocked",
|
|
||||||
error: "Technical issue",
|
|
||||||
};
|
|
||||||
|
|
||||||
// Escalate to conductor
|
// Escalate to conductor
|
||||||
const escalation = {
|
const escalation = {
|
||||||
from: "kaede",
|
from: "kaede",
|
||||||
|
|||||||
@ -8,10 +8,9 @@
|
|||||||
* 4. PR creation/review
|
* 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 { execSync } from "child_process";
|
||||||
import { readFileSync, unlinkSync, existsSync } from "fs";
|
import { unlinkSync, existsSync } from "fs";
|
||||||
import { join } from "path";
|
|
||||||
|
|
||||||
// Test repository configuration
|
// Test repository configuration
|
||||||
const TEST_REPO = process.env.GITHUBOPS_TEST_REPO || "ShunsukeHayashi/dev-workspace";
|
const TEST_REPO = process.env.GITHUBOPS_TEST_REPO || "ShunsukeHayashi/dev-workspace";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user