feat(library): 整库发布身份、写集合与收尾边界
build / build (push) Successful in 1m45s

执行时真实时钟与持久授权回读(撤销/过期即停并保留预备份)、写集合写前落盘、
租约与 attempt 身份、恢复队列与原发送身份分离、成功收尾必须释放维护后再登记终态。
This commit is contained in:
姚章浩
2026-11-01 11:35:10 +08:00
parent 5afd8c0140
commit 8d838d9cb4
82 changed files with 4809 additions and 551 deletions
+7 -3
View File
@@ -33,11 +33,15 @@ describe('发布页的同步授权与执行接线', () => {
.fn()
.mockResolvedValue(jsonResponse(202, { job: { id: 'libsync-internal-1', scope: 'internal' }, reused: false }))
vi.stubGlobal('fetch', fetchMock)
const accepted = await enqueueLibrarySync('internal', 'snap-1')
const accepted = await enqueueLibrarySync('internal', 'snap-1', 'source-bound')
expect(accepted.job_id).toBe('libsync-internal-1')
const [url, init] = fetchMock.mock.calls[0]
expect(url).toBe('/api/v1/library/syncs')
expect(JSON.parse(init.body)).toEqual({ scope: 'internal', target_snapshot_id: 'snap-1' })
expect(JSON.parse(init.body)).toEqual({
scope: 'internal',
target_snapshot_id: 'snap-1',
source_id: 'source-bound',
})
})
it('闸口未齐时把接口给的缺项原样抛出,而不是假装已启动', async () => {
@@ -50,7 +54,7 @@ describe('发布页的同步授权与执行接线', () => {
})
)
)
await expect(enqueueLibrarySync('internal', 'snap-1')).rejects.toThrow(
await expect(enqueueLibrarySync('internal', 'snap-1', 'source-bound')).rejects.toThrow(
/目标非空且没有生效版本记录;没有与目标快照匹配的有效发布授权/
)
})