fix(types): correct GitHubOperations interface and test type assertions

- Tighten GitHubOperations.findPrForBranch and mergePr param types to
  match the literal unions in FindPrParams/MergePrParams, fixing the
  GitHubClient assignability error in dashboard.ts and serve.ts
- Cast MockStore as unknown as TaskStore at mesh-routes.test.ts call
  site to satisfy TaskStore shape without implementing 117 methods
- Double-cast AgentGenerationSession via unknown in agent-generation.test.ts
  to silence the unsafe conversion diagnostic

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-10 21:16:42 -07:00
parent 1a3ff011d3
commit 1bf4db2277
3 changed files with 5 additions and 5 deletions

View File

@@ -22,7 +22,7 @@ import type { Settings, TaskDetail, PrInfo } from "@fusion/core";
* Defined locally to avoid importing from @fusion/dashboard.
*/
interface GitHubOperations {
findPrForBranch(params: { head: string; state: string }): Promise<PrInfo | null>;
findPrForBranch(params: { head: string; state?: "open" | "closed" | "all" }): Promise<PrInfo | null>;
createPr(params: { title: string; body: string; head: string }): Promise<PrInfo>;
getPrMergeStatus(base?: string, head?: string, number?: number): Promise<{
prInfo: PrInfo;
@@ -31,7 +31,7 @@ interface GitHubOperations {
mergeReady: boolean;
blockingReasons: string[];
}>;
mergePr(params: { number: number; method: string }): Promise<PrInfo>;
mergePr(params: { number: number; method?: "merge" | "squash" | "rebase" }): Promise<PrInfo>;
}
/**

View File

@@ -1,6 +1,6 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { EventEmitter } from "node:events";
import type { Task } from "@fusion/core";
import type { Task, TaskStore } from "@fusion/core";
import { request } from "../test-request.js";
import { createServer } from "../server.js";
@@ -137,7 +137,7 @@ describe("POST /api/mesh/sync", () => {
});
const store = new MockStore();
app = createServer(store);
app = createServer(store as unknown as TaskStore);
});
it("should merge peers and return sync response", async () => {

View File

@@ -45,7 +45,7 @@ describe("agent-generation module", () => {
const mockIp = getUniqueIp();
const session = await startAgentGeneration(mockIp, "Test role");
expect((session as Record<string, unknown>).ip).toBeUndefined();
expect((session as unknown as Record<string, unknown>).ip).toBeUndefined();
});
it("enforces rate limiting", async () => {