Skip to content

Commit 26e1f36

Browse files
committed
Merge branch 'main' into feature/lifecycle-formal-verification-0ebv6vfh08pal
2 parents 00d6e05 + a0f2e03 commit 26e1f36

44 files changed

Lines changed: 6031 additions & 773 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/mutation-testing.yml‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ jobs:
3636
fetch-depth: 0
3737
persist-credentials: false
3838

39-
- name: Fetch pull request base
40-
if: github.event_name == 'pull_request'
41-
env:
42-
BASE_REPOSITORY_URL: ${{ github.server_url }}/${{ github.repository }}.git
43-
BASE_SHA: ${{ github.event.pull_request.base.sha }}
44-
run: git fetch --no-tags "$BASE_REPOSITORY_URL" "$BASE_SHA"
45-
4639
- name: Setup Node.js and pnpm
4740
if: github.event_name == 'pull_request'
4841
uses: ./.github/actions/setup-node-pnpm
@@ -56,9 +49,10 @@ jobs:
5649
- name: Enforce executable-line scope and run advisory mutation testing
5750
if: github.event_name == 'pull_request'
5851
env:
59-
BASE_SHA: ${{ github.event.pull_request.base.sha }}
6052
HEAD_SHA: ${{ github.sha }}
61-
run: node scripts/stryker-diff.mjs ci --base "$BASE_SHA" --head "$HEAD_SHA"
53+
run: |
54+
BASE_SHA="$(git rev-parse "$HEAD_SHA^1")"
55+
node scripts/stryker-diff.mjs ci --base "$BASE_SHA" --head "$HEAD_SHA"
6256
6357
- name: Upload mutation reports
6458
id: mutation_report

‎packages/types/src/__tests__/deepseek-v4-pro.test.ts‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ describe("DeepSeek V4 Pro 0813 provider catalogs", () => {
1010
expect(model?.contextWindow).toBeGreaterThanOrEqual(1_000_000)
1111
})
1212

13-
it("uses peak first-party pricing and unchanged OpenCode Go pricing", () => {
13+
it("uses current peak first-party pricing and unchanged OpenCode Go pricing", () => {
14+
expect(deepSeekModels["deepseek-flash"]).toMatchObject({
15+
supportsImages: true,
16+
outputPrice: 1.2,
17+
cacheWritesPrice: 0.3,
18+
cacheReadsPrice: 0.006,
19+
})
1420
expect(deepSeekModels["deepseek-v4-flash"]).toMatchObject({
15-
supportsImages: false,
16-
outputPrice: 1.32,
17-
cacheWritesPrice: 0.44,
18-
cacheReadsPrice: 0.014,
21+
supportsImages: true,
22+
outputPrice: 1.2,
23+
cacheWritesPrice: 0.3,
24+
cacheReadsPrice: 0.006,
1925
})
2026
expect(deepSeekModels["deepseek-v4-pro"].supportsImages).toBe(false)
2127
expect(deepSeekModels["deepseek-v4-pro"]).toMatchObject({
@@ -42,6 +48,10 @@ describe("DeepSeek V4 Pro 0813 provider catalogs", () => {
4248
expect(model.supportsPromptCache).toBe(true)
4349
expect(model.contextWindow).toBeGreaterThanOrEqual(1_000_000)
4450
expect(model.supportsReasoningEffort).toEqual(["disable", "low", "high", "max"])
51+
expect(model).toMatchObject({ outputPrice: 1.2, cacheWritesPrice: 0.3, cacheReadsPrice: 0.006 })
52+
expect(model.description).toContain("Legacy model name")
53+
expect(model).not.toHaveProperty("supportsTemperature")
54+
expect(model).not.toHaveProperty("defaultTemperature")
4555
})
4656

4757
// Self-hosted providers retain separate IDs for the preview weights and 0813 checkpoint.

‎packages/types/src/providers/deepseek.ts‎

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,38 @@ import type { ModelInfo } from "../model.js"
66
// continuation within the same turn. See: https://api-docs.deepseek.com/guides/thinking_mode
77
export type DeepSeekModelId = keyof typeof deepSeekModels
88

9-
export const deepSeekDefaultModelId: DeepSeekModelId = "deepseek-v4-flash"
9+
export const deepSeekDefaultModelId: DeepSeekModelId = "deepseek-flash"
1010

1111
export const deepSeekModels = {
12+
"deepseek-flash": {
13+
maxTokens: 384_000,
14+
contextWindow: 1_000_000,
15+
supportsImages: true,
16+
supportsPromptCache: true,
17+
supportsReasoningEffort: ["disable", "low", "high", "max"], // Updated 2026-09-10
18+
preserveReasoning: true,
19+
reasoningEffort: "high",
20+
inputPrice: 0, // the inputs are priced as cache read/write, so `inputPrice` should be 0
21+
// Static estimates use peak rates; off-peak rates are 50% lower. Effective 2026-09-10.
22+
outputPrice: 1.2,
23+
cacheWritesPrice: 0.3,
24+
cacheReadsPrice: 0.006,
25+
description: `DeepSeek-V4.1-Flash is DeepSeek's fast multimodal model with image understanding. It supports thinking and non-thinking modes, JSON output, tool calls, chat prefix completion (beta), and FIM completion (beta) in non-thinking mode.`,
26+
},
1227
"deepseek-v4-flash": {
1328
maxTokens: 384_000,
1429
contextWindow: 1_000_000,
15-
supportsImages: false,
30+
supportsImages: true,
1631
supportsPromptCache: true,
1732
supportsReasoningEffort: ["disable", "low", "high", "max"], // Updated 2026-08-13
1833
preserveReasoning: true,
1934
reasoningEffort: "high",
2035
inputPrice: 0, // the inputs are priced as cache read/write, so `inputPrice` should be 0
21-
// Static estimates use peak rates; off-peak rates are 50% lower. Effective 2026-08-16.
22-
outputPrice: 1.32,
23-
cacheWritesPrice: 0.44,
24-
cacheReadsPrice: 0.014,
25-
description: `DeepSeek-V4-Flash is DeepSeek's fast, cost-efficient V4 model. It supports thinking and non-thinking modes, JSON output, tool calls, chat prefix completion (beta), and FIM completion (beta) in non-thinking mode.`,
36+
// This retired ID is billed as the current Flash model.
37+
outputPrice: 1.2,
38+
cacheWritesPrice: 0.3,
39+
cacheReadsPrice: 0.006,
40+
description: `Legacy model name routed to the latest DeepSeek Flash model, which supports image input. Use deepseek-flash for new configurations.`,
2641
},
2742
"deepseek-v4-pro": {
2843
displayName: "DeepSeek V4 Pro 0813",
@@ -49,14 +64,12 @@ export const deepSeekModels = {
4964
supportsReasoningEffort: ["disable", "low", "high", "max"], // Updated 2026-08-13
5065
preserveReasoning: true,
5166
reasoningEffort: "high",
52-
supportsTemperature: true,
53-
defaultTemperature: 1.0,
5467
inputPrice: 0, // the inputs are priced as cache read/write, so `inputPrice` should be 0
55-
// Static estimates use peak rates; off-peak rates are 50% lower.
56-
outputPrice: 1.32,
57-
cacheWritesPrice: 0.44,
58-
cacheReadsPrice: 0.014,
59-
description: `DeepSeek-V4-Flash-Vision-Exp is DeepSeek's experimental multimodal V4 Flash model with image understanding. It supports thinking and non-thinking modes, JSON output, tool calls, chat prefix completion (beta), and image input through Chat Completions, Responses, and Anthropic-compatible APIs.`,
68+
// This retired ID is billed as the current Flash model.
69+
outputPrice: 1.2,
70+
cacheWritesPrice: 0.3,
71+
cacheReadsPrice: 0.006,
72+
description: `Legacy model name routed to the latest DeepSeek Flash model, which supports image input. Use deepseek-flash for new configurations.`,
6073
},
6174
} as const satisfies Record<string, ModelInfo>
6275

‎scripts/stryker-diff.test.mjs‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ describe("mutation testing workflow", () => {
5757
assert.ok(!workflow.includes("ref: ${{ github.event.pull_request.head.sha }}"))
5858
assert.ok(workflow.includes("HEAD_SHA: ${{ github.sha }}"))
5959
assert.ok(!workflow.includes("HEAD_SHA: ${{ github.event.pull_request.head.sha }}"))
60+
assert.ok(workflow.includes('BASE_SHA="$(git rev-parse "$HEAD_SHA^1")"'))
61+
assert.ok(!workflow.includes("github.event.pull_request.base.sha"))
6062
assert.ok(workflow.includes("steps.mutation_report.outputs.artifact-url"))
6163
assert.ok(workflow.includes("open the package's mutation.html file"))
6264
assert.ok(workflow.includes("Enforce executable-line scope and run advisory mutation testing"))
@@ -444,6 +446,49 @@ describe("selectFromGit", () => {
444446
fs.rmSync(repo, { recursive: true, force: true })
445447
}
446448
})
449+
450+
it("does not charge intervening base-branch changes to the pull request", () => {
451+
const repo = fs.mkdtempSync(path.join(os.tmpdir(), "stryker-stale-base-"))
452+
const runGit = (...args) => execFileSync("git", args, { cwd: repo, encoding: "utf8" }).trim()
453+
454+
try {
455+
runGit("init", "--initial-branch=main")
456+
runGit("config", "user.name", "Mutation Test")
457+
runGit("config", "user.email", "[email protected]")
458+
fs.mkdirSync(path.join(repo, "packages/core/src"), { recursive: true })
459+
fs.writeFileSync(path.join(repo, "packages/core/src/pr.ts"), "export const pr = false\n")
460+
fs.writeFileSync(path.join(repo, "packages/core/src/base.ts"), "export const base = false\n")
461+
runGit("add", ".")
462+
runGit("commit", "-m", "initial")
463+
const staleBaseSha = runGit("rev-parse", "HEAD")
464+
465+
runGit("checkout", "-b", "feature")
466+
fs.writeFileSync(path.join(repo, "packages/core/src/pr.ts"), "export const pr = true\n")
467+
runGit("commit", "-am", "change pull request")
468+
469+
runGit("checkout", "main")
470+
fs.writeFileSync(path.join(repo, "packages/core/src/base.ts"), "export const base = true\n")
471+
runGit("commit", "-am", "advance base branch")
472+
const currentBaseSha = runGit("rev-parse", "HEAD")
473+
runGit("merge", "--no-ff", "feature", "-m", "synthetic pull request merge")
474+
const mergeSha = runGit("rev-parse", "HEAD")
475+
const mergeResultBaseSha = runGit("rev-parse", `${mergeSha}^1`)
476+
assert.equal(mergeResultBaseSha, currentBaseSha)
477+
478+
assert.deepEqual(
479+
selectFromGit(repo, staleBaseSha, mergeSha).packages[0].files.map(({ path: filePath }) => filePath),
480+
["packages/core/src/base.ts", "packages/core/src/pr.ts"],
481+
)
482+
assert.deepEqual(
483+
selectFromGit(repo, mergeResultBaseSha, mergeSha).packages[0].files.map(
484+
({ path: filePath }) => filePath,
485+
),
486+
["packages/core/src/pr.ts"],
487+
)
488+
} finally {
489+
fs.rmSync(repo, { recursive: true, force: true })
490+
}
491+
})
447492
})
448493

449494
describe("mutation exclusions", () => {

‎src/api/index.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,15 @@ export interface ApiHandler {
130130
* Ensures model metadata has been fetched from the remote API so that getModel()
131131
* returns accurate info (context window, pricing, etc.) instead of hardcoded defaults.
132132
* Only router providers that discover models over the network implement this.
133+
*
134+
* `signal` bounds the caller's wait: when it aborts (e.g. the caller's bounded
135+
* metadata wait expired or the owning task was cancelled), the returned promise
136+
* settles with a rejection so no handler-side waiter outlives its caller.
137+
* Fetchers that observe the signal may also stop their network request; the
138+
* shared, de-duplicated catalog fetch may still complete and populate the model
139+
* cache, which is by design for concurrent waiters.
133140
*/
134-
ensureModelFetched?(): Promise<void>
141+
ensureModelFetched?(signal?: AbortSignal): Promise<void>
135142

136143
/**
137144
* Optional context window for context-management / auto-condense when it must differ from

‎src/api/providers/__tests__/deepseek.spec.ts‎

Lines changed: 51 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -240,22 +240,22 @@ describe("DeepSeekHandler", () => {
240240
expect(model.info).toBeDefined()
241241
expect(model.info.maxTokens).toBe(384_000)
242242
expect(model.info.contextWindow).toBe(1_000_000)
243-
expect(model.info.supportsImages).toBe(false)
243+
expect(model.info.supportsImages).toBe(true)
244244
expect(model.info.supportsPromptCache).toBe(true) // Should be true now
245245
expect((model.info as ModelInfo).preserveReasoning).toBe(true)
246246
})
247247

248-
it("should use deepseek-v4-flash as the default model ID for new configs", () => {
248+
it("should use deepseek-flash as the default model ID for new configs", () => {
249249
const handlerWithoutModel = new DeepSeekHandler({
250250
...mockOptions,
251251
apiModelId: undefined,
252252
})
253253
const model = handlerWithoutModel.getModel()
254254
expect(model.id).toBe(deepSeekDefaultModelId)
255-
expect(model.id).toBe("deepseek-v4-flash")
255+
expect(model.id).toBe("deepseek-flash")
256256
expect(model.info.maxTokens).toBe(384_000)
257257
expect(model.info.contextWindow).toBe(1_000_000)
258-
expect(model.info.supportsImages).toBe(false)
258+
expect(model.info.supportsImages).toBe(true)
259259
expect((model.info as ModelInfo).supportsReasoningEffort).toContain("max")
260260
})
261261

@@ -290,7 +290,6 @@ describe("DeepSeekHandler", () => {
290290
supportsPromptCache: true,
291291
preserveReasoning: true,
292292
reasoningEffort: "high",
293-
defaultTemperature: 1.0,
294293
})
295294
})
296295

@@ -369,41 +368,61 @@ describe("DeepSeekHandler", () => {
369368
expect(textChunks[0].text).toBe("Test response")
370369
})
371370

372-
it("should send images and V4 thinking controls to deepseek-v4-flash-vision-exp", async () => {
371+
it.each(["deepseek-flash", "deepseek-v4-flash", "deepseek-v4-flash-vision-exp"] as const)(
372+
"should send images and thinking controls to %s",
373+
async (modelId) => {
374+
const visionHandler = new DeepSeekHandler({
375+
...mockOptions,
376+
apiModelId: modelId,
377+
})
378+
const visionMessages: Anthropic.Messages.MessageParam[] = [
379+
{
380+
role: "user",
381+
content: [
382+
{ type: "text", text: "Describe this image." },
383+
{
384+
type: "image",
385+
source: { type: "base64", media_type: "image/png", data: "image-data" },
386+
},
387+
],
388+
},
389+
]
390+
391+
await collectStream(visionHandler.createMessage(systemPrompt, visionMessages))
392+
393+
const callArgs = mockCreate.mock.calls[0][0]
394+
expect(callArgs).toMatchObject({
395+
model: modelId,
396+
thinking: { type: "enabled" },
397+
reasoning_effort: "high",
398+
max_completion_tokens: 200_000,
399+
})
400+
expect(callArgs.temperature).toBeUndefined()
401+
expect(callArgs.messages).toContainEqual({
402+
role: "user",
403+
content: expect.arrayContaining([
404+
{ type: "text", text: expect.stringContaining("Describe this image.") },
405+
{ type: "image_url", image_url: { url: "data:image/png;base64,image-data" } },
406+
]),
407+
})
408+
},
409+
)
410+
411+
it("should use the provider default temperature when reasoning is disabled for the vision alias", async () => {
373412
const visionHandler = new DeepSeekHandler({
374413
...mockOptions,
375414
apiModelId: "deepseek-v4-flash-vision-exp",
415+
enableReasoningEffort: false,
376416
})
377-
const visionMessages: Anthropic.Messages.MessageParam[] = [
378-
{
379-
role: "user",
380-
content: [
381-
{ type: "text", text: "Describe this image." },
382-
{
383-
type: "image",
384-
source: { type: "base64", media_type: "image/png", data: "image-data" },
385-
},
386-
],
387-
},
388-
]
389417

390-
await collectStream(visionHandler.createMessage(systemPrompt, visionMessages))
418+
await collectStream(visionHandler.createMessage(systemPrompt, messages))
391419

392-
const callArgs = mockCreate.mock.calls[0][0]
393-
expect(callArgs).toMatchObject({
420+
expect(mockCreate.mock.calls[0][0]).toMatchObject({
394421
model: "deepseek-v4-flash-vision-exp",
395-
thinking: { type: "enabled" },
396-
reasoning_effort: "high",
397-
max_completion_tokens: 200_000,
398-
})
399-
expect(callArgs.temperature).toBeUndefined()
400-
expect(callArgs.messages).toContainEqual({
401-
role: "user",
402-
content: expect.arrayContaining([
403-
{ type: "text", text: expect.stringContaining("Describe this image.") },
404-
{ type: "image_url", image_url: { url: "data:image/png;base64,image-data" } },
405-
]),
422+
thinking: { type: "disabled" },
423+
temperature: 0,
406424
})
425+
expect(mockCreate.mock.calls[0][0].reasoning_effort).toBeUndefined()
407426
})
408427

409428
it("should include usage information", async () => {

0 commit comments

Comments
 (0)