Skip to content

Commit 9d8e173

Browse files
lukeboyettclaude
andcommitted
fix(trajectory): tighten test types for partial skill entries
CI check-test-types was failing on src/trajectory/metadata.test.ts because tsgo:test is stricter than local pnpm check. Rejected sourceInfo: {} and bare 'undefined' assignments against typed SourceInfo / string fields. Fill sourceInfo with a real SourceInfo shape for the valid 'alpha' entry, cast the intentionally-partial entries to ResolvedSkillEntry via an 'as unknown as' bridge so the intent (simulating a symlink-escape reject leaking through) stays explicit without weakening the type on the valid branch. Tests: 6 passed (unchanged). tsgo:core:test clean. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent df818ae commit 9d8e173

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

src/trajectory/metadata.test.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { afterEach, describe, expect, it, vi } from "vitest";
2+
import type { SkillSnapshot } from "../agents/skills.js";
23
import { REDACTED_SENTINEL } from "../config/redact-snapshot.js";
34
import {
45
redactPathForSupport,
@@ -7,6 +8,8 @@ import {
78
import { createEmptyPluginRegistry } from "../plugins/registry-empty.js";
89
import { resetPluginRuntimeStateForTest, setActivePluginRegistry } from "../plugins/runtime.js";
910

11+
type ResolvedSkillEntry = NonNullable<SkillSnapshot["resolvedSkills"]>[number];
12+
1013
const loadPluginManifestRegistry = vi.hoisted(() => vi.fn(() => ({ plugins: [] })));
1114

1215
vi.mock("../infra/git-commit.js", () => ({
@@ -194,18 +197,24 @@ describe("trajectory metadata", () => {
194197
filePath: "/tmp/workspace/skills/alpha/SKILL.md",
195198
baseDir: "/tmp/workspace/skills/alpha",
196199
source: "workspace",
197-
sourceInfo: {},
200+
sourceInfo: {
201+
path: "/tmp/workspace/skills/alpha/SKILL.md",
202+
source: "workspace",
203+
scope: "project",
204+
origin: "top-level",
205+
baseDir: "/tmp/workspace/skills/alpha",
206+
},
198207
disableModelInvocation: false,
199208
},
200209
{
201-
name: undefined as unknown as string,
210+
name: undefined,
202211
description: undefined,
203-
filePath: undefined as unknown as string,
204-
baseDir: undefined as unknown as string,
212+
filePath: undefined,
213+
baseDir: undefined,
205214
source: "workspace",
206215
sourceInfo: undefined,
207216
disableModelInvocation: false,
208-
},
217+
} as unknown as ResolvedSkillEntry,
209218
],
210219
},
211220
});
@@ -225,14 +234,14 @@ describe("trajectory metadata", () => {
225234
skills: [{ name: "fallback-skill" }],
226235
resolvedSkills: [
227236
{
228-
name: undefined as unknown as string,
237+
name: undefined,
229238
description: undefined,
230-
filePath: undefined as unknown as string,
231-
baseDir: undefined as unknown as string,
239+
filePath: undefined,
240+
baseDir: undefined,
232241
source: "workspace",
233242
sourceInfo: undefined,
234243
disableModelInvocation: false,
235-
},
244+
} as unknown as ResolvedSkillEntry,
236245
],
237246
},
238247
});

0 commit comments

Comments
 (0)