diff --git a/client/src/components/lanes/__tests__/AddLaneModal.test.tsx b/client/src/components/lanes/__tests__/AddLaneModal.test.tsx index 453be98..1ffb1fe 100644 --- a/client/src/components/lanes/__tests__/AddLaneModal.test.tsx +++ b/client/src/components/lanes/__tests__/AddLaneModal.test.tsx @@ -34,6 +34,10 @@ vi.mock("../../../lib/api", () => ({ })); function laneFixture(over: Partial = {}): Lane { + // `as Lane`: spreading a Partial widens every field it may carry to + // `T | undefined`, which no longer satisfies Lane's required fields. The + // base object below still lists all of them, so the cast asserts what the + // literal already proves. return { id: 9, title: "", @@ -64,7 +68,7 @@ function laneFixture(over: Partial = {}): Lane { slot: null, ports: {}, ...over, - }; + } as Lane; } const SUGGESTIONS: CwdSuggestion[] = [ diff --git a/client/src/components/lanes/__tests__/DestructiveLaneModal.test.tsx b/client/src/components/lanes/__tests__/DestructiveLaneModal.test.tsx index 2cdd703..c546e38 100644 --- a/client/src/components/lanes/__tests__/DestructiveLaneModal.test.tsx +++ b/client/src/components/lanes/__tests__/DestructiveLaneModal.test.tsx @@ -21,6 +21,10 @@ import { DestructiveLaneModal } from "../DestructiveLaneModal"; import type { Lane, LanePurgePreflight, LaneWorktreePreflight } from "../../../lib/types"; function makeLane(overrides: Partial = {}): Lane { + // `as Lane`: spreading a Partial widens every field it may carry to + // `T | undefined`, which no longer satisfies Lane's required fields. The + // base object below still lists all of them, so the cast asserts what the + // literal already proves. return { id: 1, title: "demo", @@ -50,7 +54,7 @@ function makeLane(overrides: Partial = {}): Lane { slot: null, ports: {}, ...overrides, - }; + } as Lane; } function worktreePreflight(overrides: Partial = {}): LaneWorktreePreflight { diff --git a/client/src/components/lanes/__tests__/LaneCard.test.tsx b/client/src/components/lanes/__tests__/LaneCard.test.tsx index ec25250..6320d15 100644 --- a/client/src/components/lanes/__tests__/LaneCard.test.tsx +++ b/client/src/components/lanes/__tests__/LaneCard.test.tsx @@ -12,7 +12,7 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; import { render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import LaneCard from "../LaneCard"; -import type { Lane } from "../../../lib/types"; +import type { Lane, LaneRuntime } from "../../../lib/types"; import { api } from "../../../lib/api"; vi.mock("../../../lib/api", () => ({ @@ -48,6 +48,10 @@ vi.mocked(api.locks.list).mockReset(); vi.mocked(api.locks.list).mockResolvedValue({ locks: [] }); function makeLane(overrides: Partial = {}): Lane { + // `as Lane`: spreading a Partial widens every field it may carry to + // `T | undefined`, which no longer satisfies Lane's required fields. The + // base object below still lists all of them, so the cast asserts what the + // literal already proves. return { id: 1, title: "demo", @@ -78,7 +82,7 @@ function makeLane(overrides: Partial = {}): Lane { slot: null, ports: {}, ...overrides, - }; + } as Lane; } describe("LaneCard status badge", () => { @@ -396,6 +400,9 @@ describe("LaneCard — named locks", () => { describe("agents install / mcp sync / integration badges / sync check", () => { beforeEach(() => { + // Only the fields this describe block's assertions read; `as LaneRuntime` + // keeps the double from having to restate a shape the component never + // touches here. vi.mocked(api.lanes.runtime).mockResolvedValue({ available: true as const, provisioned: true as const, @@ -403,7 +410,7 @@ describe("agents install / mcp sync / integration badges / sync check", () => { slot: 1, profileDir: "/work/demo/.ccam/profile", ports: {}, - }); + } as unknown as LaneRuntime); vi.mocked(api.lanes.integration).mockImplementation((_id, name) => Promise.resolve({ enabled: name === "tracker" }) ); diff --git a/client/src/lib/api.ts b/client/src/lib/api.ts index d136408..9204a12 100644 --- a/client/src/lib/api.ts +++ b/client/src/lib/api.ts @@ -394,6 +394,7 @@ import type { LaneGitFacts, LaneRuntime, ModelPricing, + NamedLock, Session, SessionDrillIn, SessionStats, diff --git a/client/src/pages/__tests__/Workspace.test.tsx b/client/src/pages/__tests__/Workspace.test.tsx index 1605db0..fbf6b0c 100644 --- a/client/src/pages/__tests__/Workspace.test.tsx +++ b/client/src/pages/__tests__/Workspace.test.tsx @@ -24,6 +24,7 @@ type LaneFixture = { pipeline_nodes: never[]; detected_signal: string | null; run_id: string | null; + active_feature_id?: number | null; }; let lanesToReturn: LaneFixture[] = [ @@ -583,7 +584,8 @@ describe("Workspace — proof gallery", () => { ], }); // Set active_feature_id and ensure features list is populated - lanesToReturn[0].active_feature_id = 1; + // (indexed access is `| undefined` under noUncheckedIndexedAccess) + lanesToReturn[0]!.active_feature_id = 1; vi.mocked(api.lanes.features.list).mockResolvedValue({ features: [ {