mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
fix: 修复 4 个测试失败(路径规范化、SDK 签名变更、空消息防护)
- projectContext.test.ts: 使用 realpathSync 处理 macOS /var→/private/var 符号链接 - bedrockClient.test.ts: 适配 Bedrock SDK v0.80 Bearer 认证(原 AWS4-HMAC-SHA256) - bridge.ts: forwardSessionUpdates 添加 null guard 防止空消息导致 TypeError Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -587,6 +587,8 @@ export async function forwardSessionUpdates(
|
||||
if (nextResult.done || abortSignal.aborted) break
|
||||
const msg = nextResult.value
|
||||
|
||||
if (msg == null) continue
|
||||
|
||||
const type = msg.type as string
|
||||
|
||||
switch (type) {
|
||||
|
||||
@@ -111,7 +111,12 @@ describe('BedrockClient.buildRequest body.anthropic_beta cleanup', () => {
|
||||
const c = get()
|
||||
expect(c).not.toBeNull()
|
||||
expect(c!.headers.authorization).toBeDefined()
|
||||
expect(c!.headers.authorization.startsWith('AWS4-HMAC-SHA256')).toBe(true)
|
||||
// SDK >= 0.80 uses Bearer auth; older versions used AWS4-HMAC-SHA256 SigV4.
|
||||
// Either way the header must be present (i.e. signing was not broken).
|
||||
expect(
|
||||
c!.headers.authorization!.startsWith('AWS4-HMAC-SHA256') ||
|
||||
c!.headers.authorization!.startsWith('Bearer '),
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
test('FIX does not disturb requests that never had anthropic_beta', async () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { afterAll, beforeEach, describe, expect, test } from 'bun:test'
|
||||
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync } from 'fs'
|
||||
import { existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync } from 'fs'
|
||||
import { tmpdir } from 'os'
|
||||
import { join } from 'path'
|
||||
import { execFileSync } from 'child_process'
|
||||
@@ -56,7 +56,7 @@ describe('resolveProjectContext', () => {
|
||||
|
||||
expect(context.source).toBe('claude_project_dir')
|
||||
expect(context.scope).toBe('project')
|
||||
expect(context.projectRoot).toBe(projectDir)
|
||||
expect(context.projectRoot).toBe(realpathSync(projectDir))
|
||||
expect(context.projectName).toBe(lastPathSegment(projectDir))
|
||||
expect(context.storageDir).toContain(context.projectId)
|
||||
|
||||
@@ -99,7 +99,7 @@ describe('resolveProjectContext', () => {
|
||||
|
||||
expect(context.source).toBe('git_root')
|
||||
expect(context.scope).toBe('project')
|
||||
expect(context.projectRoot).toBe(repo)
|
||||
expect(context.projectRoot).toBe(realpathSync(repo))
|
||||
expect(context.projectName).toBe(lastPathSegment(repo))
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user