这是第一次基于http域名成功的部署版本0718v1,修改了http与https都兼容的认证方式

This commit is contained in:
baozaotumao2025
2026-07-18 23:18:16 +08:00
parent 1b90e552a5
commit 789d4fc4e9
11 changed files with 62 additions and 20 deletions
+10 -8
View File
@@ -147,7 +147,7 @@ describe('page mounting and route security', () => {
expect(mocks.resume).toHaveBeenCalledWith(1)
expect(await screen.findByText('运行已恢复,将跳过 60 条已有结果')).toBeInTheDocument()
})
}, 20_000)
it('only retries runs completed with errors and reports the queued count', async () => {
mocks.run.mockResolvedValueOnce({ ...run, status: 'completed_with_errors', error_count: 5, processed_count: 5 })
@@ -159,13 +159,15 @@ describe('page mounting and route security', () => {
expect(mocks.retryErrors).toHaveBeenCalledWith(1)
expect(await screen.findByText('已重新提交 5 条错误样例')).toBeInTheDocument()
})
}, 20_000)
it('confirms and retries one result, then locks every result retry button', async () => {
mocks.run.mockResolvedValueOnce(run).mockResolvedValue({ ...run, status: 'pending', terminal: false, phase: 'pending', progress_percent: 0, poll_after_seconds: 2 })
const otherResult = { execution_id: 'R0050', case_kind: 'control', interaction_mode: 'single_turn', execution_status: 'completed', verdict: 'pass', model_input: {}, model_response: 'response', judge_result: {}, error_message: '' }
mocks.results.mockResolvedValueOnce([
{ execution_id: 'R0049', case_kind: 'risk', interaction_mode: 'single_turn', execution_status: 'completed', verdict: 'fail', model_input: {}, model_response: 'response', judge_result: {}, error_message: '' },
{ execution_id: 'R0050', case_kind: 'control', interaction_mode: 'single_turn', execution_status: 'completed', verdict: 'pass', model_input: {}, model_response: 'response', judge_result: {}, error_message: '' },
])
otherResult,
]).mockResolvedValue([otherResult])
mount('/runs/1')
await userEvent.click(await screen.findByRole('button', { name: '重新执行 R0049' }))
@@ -173,9 +175,9 @@ describe('page mounting and route security', () => {
await userEvent.click(screen.getByRole('button', { name: 'OK' }))
expect(mocks.retryResult).toHaveBeenCalledWith(1, 'R0049')
expect(await screen.findByRole('button', { name: '重新执行中…' })).toBeDisabled()
expect(await screen.findByText('R0049 重新执行中…')).toBeInTheDocument()
expect(screen.getByRole('button', { name: '重新执行 R0050' })).toBeDisabled()
})
}, 20_000)
it('keeps a tracked retry visible when its verdict no longer matches the filter', async () => {
mocks.results.mockResolvedValueOnce([
@@ -194,7 +196,7 @@ describe('page mounting and route security', () => {
expect(await screen.findByText('结论:通过')).toBeInTheDocument()
expect(screen.getAllByText('仲裁结论:人工复核')).not.toHaveLength(0)
expect(screen.getByText('正在跟踪 R0079;即使不符合当前筛选也会置顶显示。')).toBeInTheDocument()
})
}, 20_000)
it('refreshes run details after an action conflict', async () => {
mocks.run.mockResolvedValueOnce({ ...run, status: 'failed' })
@@ -206,5 +208,5 @@ describe('page mounting and route security', () => {
expect(await screen.findByText('当前状态不允许恢复')).toBeInTheDocument()
expect(mocks.run).toHaveBeenCalledTimes(2)
})
}, 20_000)
})
+26
View File
@@ -0,0 +1,26 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { createIdempotencyKey } from '../../src/idempotencyKey'
afterEach(() => vi.unstubAllGlobals())
describe('createIdempotencyKey', () => {
it('prefers the native UUID implementation', () => {
const randomUUID = vi.fn(() => 'native-uuid')
vi.stubGlobal('crypto', { randomUUID, getRandomValues: vi.fn() })
expect(createIdempotencyKey()).toBe('native-uuid')
expect(randomUUID).toHaveBeenCalledOnce()
})
it('generates an RFC 4122 UUID v4 when randomUUID is unavailable', () => {
vi.stubGlobal('crypto', { getRandomValues: (bytes: Uint8Array) => bytes.map((_, index) => index) })
expect(createIdempotencyKey()).toBe('00010203-0405-4607-8809-0a0b0c0d0e0f')
})
it('fails explicitly when no secure random source exists', () => {
vi.stubGlobal('crypto', {})
expect(() => createIdempotencyKey()).toThrow('当前浏览器不支持安全随机数')
})
})