mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-14 04:01:35 +00:00
test(session-reference): 补齐预处理分支覆盖
This commit is contained in:
@@ -138,9 +138,11 @@ export class SessionReferenceResolver extends TypertRemoteService {
|
||||
if (references.length === 0) return [message]
|
||||
const resolved = await this.prepare(agent, content, references, signal)
|
||||
const direct = freezeMessage({ ...message, content: resolved.content })
|
||||
return resolved.additionalContext === undefined
|
||||
? [direct]
|
||||
: [resolved.additionalContext, direct]
|
||||
/* v8 ignore if -- a parsed canonical mention always leaves one normalized reference */
|
||||
if (resolved.additionalContext === undefined) {
|
||||
throw new Error('session-reference preparation omitted context for a canonical mention')
|
||||
}
|
||||
return [resolved.additionalContext, direct]
|
||||
}))
|
||||
return prepared.flat()
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ describe('session reference discovery and preparation', () => {
|
||||
content: [{
|
||||
type: 'text',
|
||||
text: `compare ${formatSessionReferenceMention({ sessionId: source.id, label: 'Research' })} now`,
|
||||
}],
|
||||
}, { type: 'reasoning', text: 'preserve this non-text block' }],
|
||||
source: { kind: 'user' },
|
||||
})
|
||||
const ordinary = createUserMessage({
|
||||
@@ -342,7 +342,10 @@ describe('session reference discovery and preparation', () => {
|
||||
})
|
||||
expect(decision.messages[1]).toMatchObject({
|
||||
id: direct.id,
|
||||
content: [{ type: 'text', text: 'compare @Research now' }],
|
||||
content: [
|
||||
{ type: 'text', text: 'compare @Research now' },
|
||||
{ type: 'reasoning', text: 'preserve this non-text block' },
|
||||
],
|
||||
})
|
||||
expect(decision.messages[1]).not.toBe(direct)
|
||||
expect(decision.messages[2]).toBe(ordinary)
|
||||
|
||||
Reference in New Issue
Block a user