From 83dc4fdaf6a54cfcc344b6a4765581348682ec00 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Tue, 15 Sep 2026 11:50:30 +0800 Subject: [PATCH] test(06-14): register blocked delete/insert heterogeneous stream order (G-06-04-C) and map coverage - add correct-expectation it.skip for the heterogeneous route after delete(1) (anchor #06-04-3) - add correct-expectation it.skip for the heterogeneous route after insert(2, 9, [true, 5]) (anchor #06-04-4) - add file-inline expectRouteStream helper (stream-only typed reads with index 1..N and terminal null) - append the create-or-append 06-14 section to 06-COVERAGE-MAP.md; existing 5 skips unchanged --- .../phases/06-unit-tests/06-COVERAGE-MAP.md | 16 +++++++ .../data-common/src/replay/array.test.ts | 44 +++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/.planning/phases/06-unit-tests/06-COVERAGE-MAP.md b/.planning/phases/06-unit-tests/06-COVERAGE-MAP.md index 60dd804..d4119cd 100644 --- a/.planning/phases/06-unit-tests/06-COVERAGE-MAP.md +++ b/.planning/phases/06-unit-tests/06-COVERAGE-MAP.md @@ -336,3 +336,19 @@ D-40:真实英雄操作经 `replay.route.add(...)`(mover 方向步)录制 `restores the equipped mapping through the container across all compressions`(锚定 `#06-09-2`); 既有 `#06-09-1..5` 的 skip 全部保持原样。 本计划**无新增码**;`06-TEST-FINDINGS.md` 无新增 `#06-13-N` 缺陷条目。 + +## 06-14 录像读取流专项验证补齐(D-46) + +本计划为 **G-06-04-C(A + B)** 的补测,**不引入新码**(复用既有可达码 148–155,其中 155 为 +「变更后读过期流」的告警断言);阶段结构为 构件(仅流读复杂序列)→ 组合(既有流断言强化 + +变更后 `expired`)→ 完整(增删后流读次序正确预期 skip)。 + +| 缺口 | 用例 | 文件 | 计划 | +| --- | --- | --- | --- | +| G-06-04-C/A | `reads a heterogeneous route exclusively through a read stream`、`starts a complex route read stream at a middle index` | `data-common/src/replay/array.test.ts` | 06-14 | +| G-06-04-C/B | `expectHeterogeneousRead`(helper 强化,服务 3 条既有用例)、`reads a sequence of steps through a read stream`、`expands buffers and still reads every step back`、`expires a read stream after the heterogeneous route is mutated` | `data-common/src/replay/array.test.ts` | 06-14 | +| G-06-04-C(附带) | `reads the new order after deleting a middle step from a heterogeneous route`(`it.skip`,`#06-04-3`)、`reads the new order after inserting a step into a heterogeneous route`(`it.skip`,`#06-04-4`) | `data-common/src/replay/array.test.ts` | 06-14 | + +本计划**无新增码**;两条为受阻塞的正确预期 `it.skip`(锚定既有 `#06-04-3`/`#06-04-4`, +并确认既有 `#06-04-1`/`#06-04-2` 两条 skip 不变);不削弱也不删除任何既有用例或跳过。 +`06-TEST-FINDINGS.md` 无新增 `#06-14-N` 缺陷条目(受阻塞项复用既有锚点)。 diff --git a/packages-user/data-common/src/replay/array.test.ts b/packages-user/data-common/src/replay/array.test.ts index e65ee0c..ac8e1ce 100644 --- a/packages-user/data-common/src/replay/array.test.ts +++ b/packages-user/data-common/src/replay/array.test.ts @@ -154,6 +154,19 @@ function expectHeterogeneousRead( expect(stream.read()).toBeNull(); } +// 仅经读取流逐条验证异质序列:每参数类型与值、流索引 1..N 递进,末尾断言 null 与索引等于步数 +function expectRouteStream( + array: ReplayArray, + expectedSteps: ReadonlyArray +): void { + const stream = array.createReadStream(0); + expectedSteps.forEach(([command, params], i) => { + expectStepTyped(stream.read()!, command, params, i + 1); + }); + expect(stream.read()).toBeNull(); + expect(stream.index).toBe(expectedSteps.length); +} + describe('ReplayArray single operations', () => { // 验证 add 追加一条录像步并在原索引读回指令与参数 it('appends one step and reads it back at the original index', () => { @@ -494,6 +507,37 @@ describe('ReplayArray stream and buffer combination', () => { expect(stream.read()).toEqual({ command: 3, params: [30], index: 3 }); }); + // 疑似 bug:delete 中间步后索引数组未按删除位置回退,异质序列后续步骤读到错误参数,详见 06-TEST-FINDINGS.md #06-04-3,修复后取消 skip + it.skip('reads the new order after deleting a middle step from a heterogeneous route', () => { + const array = createHeterogeneousArray(); + array.delete(1); + + expect(array.length).toBe(5); + const remaining = heterogeneousSteps.filter( + (_, stepIndex) => stepIndex !== 1 + ); + expectRouteStream(array, remaining); + }); + + // 疑似 bug:insert 的参数缓冲区位移方向相反,异质序列新次序读流会读到错误参数,详见 06-TEST-FINDINGS.md #06-04-4,修复后取消 skip + it.skip('reads the new order after inserting a step into a heterogeneous route', () => { + const array = createHeterogeneousArray(); + array.insert(2, 9, [true, 5]); + + expect(array.length).toBe(7); + const reordered: ReadonlyArray = + [ + heterogeneousSteps[0], + heterogeneousSteps[1], + [9, [true, 5]], + heterogeneousSteps[2], + heterogeneousSteps[3], + heterogeneousSteps[4], + heterogeneousSteps[5] + ]; + expectRouteStream(array, reordered); + }); + // 验证 getCommandArray 与 getParamArray 暴露内部缓冲区的直接内容 it('exposes the underlying command and param buffers', () => { const array = createArray();