test: expand failure and recovery coverage
This commit is contained in:
14
TASKLIST.md
14
TASKLIST.md
@@ -1109,7 +1109,7 @@
|
|||||||
|
|
||||||
### YNX-1105 编写失败路径测试矩阵
|
### YNX-1105 编写失败路径测试矩阵
|
||||||
**状态**
|
**状态**
|
||||||
- [x] 持续补齐中,关键路径已覆盖并继续收尾连接/恢复场景(2026-04-09)
|
- [x] 持续补齐中,关键路径已覆盖并继续收尾剩余少量边界场景(2026-04-09)
|
||||||
|
|
||||||
**进展补充(2026-04-09)**
|
**进展补充(2026-04-09)**
|
||||||
- 基于本轮锁定的 v1 边界,`AF-04` 暂保持未覆盖并标记为“语义待确认”,因为当前实现仍把错误 secret 统一归入 `invalid_signature`
|
- 基于本轮锁定的 v1 边界,`AF-04` 暂保持未覆盖并标记为“语义待确认”,因为当前实现仍把错误 secret 统一归入 `invalid_signature`
|
||||||
@@ -1117,6 +1117,8 @@
|
|||||||
- 已补充 `CF-05`:`hello` 缺失 payload 时返回 `MALFORMED_MESSAGE` 且保持连接可继续诊断
|
- 已补充 `CF-05`:`hello` 缺失 payload 时返回 `MALFORMED_MESSAGE` 且保持连接可继续诊断
|
||||||
- 已补充 `SR-04`:Client 首次运行/无凭证状态会自动补 keypair,并在 `hello_ack(pair_required)` 后进入完整配对流,不需要手工预置 state
|
- 已补充 `SR-04`:Client 首次运行/无凭证状态会自动补 keypair,并在 `hello_ack(pair_required)` 后进入完整配对流,不需要手工预置 state
|
||||||
- 已同步将 `CF-07`(保留字 rule 注册拒绝)在失败路径矩阵里标记为已覆盖,和现有 Client/Server rule registry 测试保持一致
|
- 已同步将 `CF-07`(保留字 rule 注册拒绝)在失败路径矩阵里标记为已覆盖,和现有 Client/Server rule registry 测试保持一致
|
||||||
|
- 本轮新增 `CF-01` / `CF-02`:补齐 client transport 在网络分区与首次建连失败时的指数退避重连测试
|
||||||
|
- 本轮新增 `SR-02`:补齐 server restart 后 active session 不恢复、但 durable trust record 保留且客户端需要重新 hello/auth 的恢复测试
|
||||||
|
|
||||||
**目标**
|
**目标**
|
||||||
- 系统性覆盖 pairing/auth 失败路径
|
- 系统性覆盖 pairing/auth 失败路径
|
||||||
@@ -1184,16 +1186,22 @@
|
|||||||
- 已新增 `Yonexus.Client/tests/runtime-flow.test.ts`:
|
- 已新增 `Yonexus.Client/tests/runtime-flow.test.ts`:
|
||||||
- SR-04:客户端在无 secret/首次运行状态下启动后可自动进入 `pair_required`,无需手工 bootstrap 本地 state
|
- SR-04:客户端在无 secret/首次运行状态下启动后可自动进入 `pair_required`,无需手工 bootstrap 本地 state
|
||||||
- 已同步更新 `tests/failure-path/MATRIX.md`,标记 CF-05、CF-07、SR-04 为已覆盖
|
- 已同步更新 `tests/failure-path/MATRIX.md`,标记 CF-05、CF-07、SR-04 为已覆盖
|
||||||
|
- 已新增 `Yonexus.Client/tests/transport-reconnect.test.ts`
|
||||||
|
- CF-02:首次连接失败时按 1s → 2s 指数退避继续重试,成功后恢复 connected
|
||||||
|
- CF-01:已建立连接在异常 close(network partition)后会按退避策略发起重连
|
||||||
|
- 已扩展 `Yonexus.Server/tests/state-recovery.test.ts`
|
||||||
|
- SR-02:server restart 后不恢复内存 session,保留 durable paired trust,并要求 client 重新 `hello` 后进入 `auth_required`
|
||||||
|
- 已同步更新 `tests/failure-path/MATRIX.md`,标记 CF-01、CF-02、SR-02 为已覆盖
|
||||||
|
|
||||||
**当前剩余未覆盖重点**
|
**当前剩余未覆盖重点**
|
||||||
- AF-04:当前实现未单独暴露 `invalid_secret` 分支,需先决定是否保留该错误码语义
|
- AF-04:当前实现未单独暴露 `invalid_secret` 分支,需先决定是否保留该错误码语义
|
||||||
- RP-03 / RP-04:管理员主动撤销与 key rotation 语义仍未实现
|
- RP-03 / RP-04:管理员主动撤销与 key rotation 语义仍未实现
|
||||||
- PF-08 / PF-10、CF-01 / CF-02、SR-02 等剩余连接/恢复边界场景测试
|
- PF-08 / PF-10 以及少量连接/恢复边界场景仍待补齐
|
||||||
|
|
||||||
**待完成**
|
**待完成**
|
||||||
- AF-04:当前实现未单独暴露 `invalid_secret` 分支,需先决定是否保留该错误码语义
|
- AF-04:当前实现未单独暴露 `invalid_secret` 分支,需先决定是否保留该错误码语义
|
||||||
- RP-03 / RP-04:管理员主动撤销与 key rotation 语义仍未实现
|
- RP-03 / RP-04:管理员主动撤销与 key rotation 语义仍未实现
|
||||||
- PF-08 / PF-10、CF-01 / CF-02 / CF-07、SR-02 / SR-04 等剩余边界场景测试
|
- PF-08 / PF-10 等剩余边界场景测试
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Submodule Yonexus.Client updated: 9fd9b50842...b10ebc541e
Submodule Yonexus.Server updated: e038fb7666...b67166fd12
@@ -61,8 +61,8 @@ This document defines the systematic test coverage for pairing and authenticatio
|
|||||||
|
|
||||||
| ID | Scenario | Trigger | Expected Behavior | Status |
|
| ID | Scenario | Trigger | Expected Behavior | Status |
|
||||||
|----|----------|---------|-------------------|--------|
|
|----|----------|---------|-------------------|--------|
|
||||||
| CF-01 | Network partition | Connection drops mid-auth | Client retries with backoff | ⬜ |
|
| CF-01 | Network partition | Connection drops mid-auth | Client retries with backoff | ✅ |
|
||||||
| CF-02 | Server unreachable | Initial connect fails | Exponential backoff retry | ⬜ |
|
| CF-02 | Server unreachable | Initial connect fails | Exponential backoff retry | ✅ |
|
||||||
| CF-03 | Duplicate connection | Same ID connects twice | Old connection closed, new accepted | ✅ |
|
| CF-03 | Duplicate connection | Same ID connects twice | Old connection closed, new accepted | ✅ |
|
||||||
| CF-04 | Protocol version mismatch | Unsupported version | Connection rejected with error | ✅ |
|
| CF-04 | Protocol version mismatch | Unsupported version | Connection rejected with error | ✅ |
|
||||||
| CF-05 | Malformed hello | Invalid payload / missing required hello fields | Error response, connection maintained | ✅ |
|
| CF-05 | Malformed hello | Invalid payload / missing required hello fields | Error response, connection maintained | ✅ |
|
||||||
@@ -87,7 +87,7 @@ This document defines the systematic test coverage for pairing and authenticatio
|
|||||||
| ID | Scenario | Condition | Expected Recovery | Status |
|
| ID | Scenario | Condition | Expected Recovery | Status |
|
||||||
|----|----------|-----------|-------------------|--------|
|
|----|----------|-----------|-------------------|--------|
|
||||||
| SR-01 | Server restart with pending pairing | Pairing in progress | Preserve pairing state, code valid | ✅ |
|
| SR-01 | Server restart with pending pairing | Pairing in progress | Preserve pairing state, code valid | ✅ |
|
||||||
| SR-02 | Server restart with active sessions | Online clients | All marked offline, reconnect required | ⬜ |
|
| SR-02 | Server restart with active sessions | Online clients | All marked offline, reconnect required | ✅ |
|
||||||
| SR-03 | Client restart with credentials | Has secret + keys | Resume with auth, no re-pairing | ✅ |
|
| SR-03 | Client restart with credentials | Has secret + keys | Resume with auth, no re-pairing | ✅ |
|
||||||
| SR-04 | Client restart without credentials | First run | Full pairing flow required | ✅ |
|
| SR-04 | Client restart without credentials | First run | Full pairing flow required | ✅ |
|
||||||
| SR-05 | Corrupted server store | File unreadable | Surface corruption error clearly for operator handling | ✅ |
|
| SR-05 | Corrupted server store | File unreadable | Surface corruption error clearly for operator handling | ✅ |
|
||||||
@@ -134,7 +134,7 @@ npm test -- failure-paths
|
|||||||
|
|
||||||
- AF-04 (`invalid_secret`) 仍未单独覆盖:现有实现把“错误 secret 导致的验签失败”统一落到 `invalid_signature`,是否拆分错误码仍待确认。
|
- AF-04 (`invalid_secret`) 仍未单独覆盖:现有实现把“错误 secret 导致的验签失败”统一落到 `invalid_signature`,是否拆分错误码仍待确认。
|
||||||
- RP-04(key rotation)当前仍视为 v2+ 议题;v1 尚未承诺“无重配对换 key”语义,因此暂不强行补测试。
|
- RP-04(key rotation)当前仍视为 v2+ 议题;v1 尚未承诺“无重配对换 key”语义,因此暂不强行补测试。
|
||||||
- 本轮已补齐 AF-01/02/03/05/06/09/10/11、RP-01/02、CF-03/04/05/07、HF-01/02、PF-09、SR-01/03/04/05/06。
|
- 本轮已补齐 AF-01/02/03/05/06/09/10/11、RP-01/02、CF-01/02/03/04/05/07、HF-01/02、PF-09、SR-01/02/03/04/05/06。
|
||||||
|
|
||||||
### Adding New Test Cases
|
### Adding New Test Cases
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user