docs(hardening): Phase 0 complete - 0.1/0.3 landed, 0.2 closed as already covered
Phase 0 of the scheduler hardening plan is done:
- 0.1 (three-path skip symmetry): landed as test_res_account_symmetry.c
(b20caf8d), mutation-injection red-proven.
- 0.2 (rejoin trigger contract): audit found the contract fully covered
by test_scheduler_decision_publish_retry.c's five rejoin tests plus
test_scheduler_connect.c's no-io callback scan -- documented in the
plan instead of adding duplicate tests.
- 0.3 (two-round zero drift): folded into 0.1's
test_two_rounds_zero_drift_with_reconciling_worker, same shape.
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
b20caf8ddf
commit
5269f8a5c4
1 changed files with 19 additions and 0 deletions
|
|
@ -59,16 +59,35 @@ scheduler 与 controller 断连后重连,走 in-place rejoin:`xcecli_join(Ho
|
||||||
|
|
||||||
**做法**:新测试 `test_res_account_symmetry.c`——构造含 UNAVAIL 与 RECONCILING worker 的 core + RUN 作业 → 连跑 3 轮 begin_session/account/rusage-delta → 断言所有 worker 的 resInUse 与 sharedInUse 恒等(不多充一分)。反证组:对称破坏注入(临时改一处 skip)时测试必须红。
|
**做法**:新测试 `test_res_account_symmetry.c`——构造含 UNAVAIL 与 RECONCILING worker 的 core + RUN 作业 → 连跑 3 轮 begin_session/account/rusage-delta → 断言所有 worker 的 resInUse 与 sharedInUse 恒等(不多充一分)。反证组:对称破坏注入(临时改一处 skip)时测试必须红。
|
||||||
|
|
||||||
|
> **执行结果(2026-10-30)**:✅ 已落地(commit b20caf8d)。三个用例全绿,注入反证完成
|
||||||
|
> (移除 resource.c bug-1801 skip → 2.5→4.5,每轮 +1 charge,正是 bug-1799 形状)。
|
||||||
|
> 链接形态:foreach-minus-TU-list(同 sched_trace_error_paths_test),真实 plugin.c
|
||||||
|
> TU 供 plugin_* 符号、真实 scheduler.c TU 供 sched_account_jobs。
|
||||||
|
|
||||||
### 0.2 rejoin 触发条件契约测试
|
### 0.2 rejoin 触发条件契约测试
|
||||||
|
|
||||||
**契约**(scheduler.c:1871-1889):`sched_check_pending_rejoin` 在 (a) `sched_needs_rejoin` flag 置位 或 (b) `xcecli_is_connection_broken()`(bug-1760 零探测判式)任一成立时发起 join;两条路都要覆盖。
|
**契约**(scheduler.c:1871-1889):`sched_check_pending_rejoin` 在 (a) `sched_needs_rejoin` flag 置位 或 (b) `xcecli_is_connection_broken()`(bug-1760 零探测判式)任一成立时发起 join;两条路都要覆盖。
|
||||||
|
|
||||||
**做法**:扩展现有 `test_scheduler_connect.c`(它已有 connect/retry 骨架)补两个用例:flag-only 触发、broken-only 触发,断言 `xcecli_join` 恰好调一次且 flag 清除。
|
**做法**:扩展现有 `test_scheduler_connect.c`(它已有 connect/retry 骨架)补两个用例:flag-only 触发、broken-only 触发,断言 `xcecli_join` 恰好调一次且 flag 清除。
|
||||||
|
|
||||||
|
> **执行结果(2026-10-30)**:审计发现契约已被既有测试**完整**锁定,无需新测试——
|
||||||
|
> `test_scheduler_decision_publish_retry.c` 的 5 个 rejoin 用例(flag-only 组合重试
|
||||||
|
> `test_rejoin_composition_retries_across_publish_calls`、无发布直调
|
||||||
|
> `test_check_pending_rejoin_invoked_directly_without_a_publish`、broken-only 被动触发
|
||||||
|
> `test_check_pending_rejoin_triggers_on_passive_broken_signal`、健康零探测
|
||||||
|
> `test_check_pending_rejoin_no_op_when_healthy_and_no_flag`、main.c 无条件调用源码扫描
|
||||||
|
> `test_main_loop_checks_pending_rejoin_unconditionally`)加上 `test_scheduler_connect.c`
|
||||||
|
> 的 `test_rejoin_callback_body_has_no_io_or_xcecli_calls`(回调无 I/O 锁死)覆盖了
|
||||||
|
> 本节契约的全部断言,含 flag 清除语义。0.2 就此关闭,不再新增重复测试。
|
||||||
|
|
||||||
### 0.3 reset+charge 对称性活体测试
|
### 0.3 reset+charge 对称性活体测试
|
||||||
|
|
||||||
与 0.1 呼应但独立:同一 core 连续两轮 session(中间无事件),断言账目零增长。这是 bug-1799 的最小复现形状——当时活体上跑了两周才被看见,这个测试让它变成 CI 秒杀。
|
与 0.1 呼应但独立:同一 core 连续两轮 session(中间无事件),断言账目零增长。这是 bug-1799 的最小复现形状——当时活体上跑了两周才被看见,这个测试让它变成 CI 秒杀。
|
||||||
|
|
||||||
|
> **执行结果(2026-10-30)**:✅ 并入 0.1 落地——`test_res_account_symmetry.c` 的
|
||||||
|
> `test_two_rounds_zero_drift_with_reconciling_worker` 即此形状(两轮无事件,账目
|
||||||
|
> 恒等),且额外断言了 shared 池与 host 池的逐轮恒等,两节目标由同一测试闭合。
|
||||||
|
|
||||||
**验收**:`/xce-build scheduler` 全绿;三个新测试在注入破坏时各自变红(手工验证一次后还原)。
|
**验收**:`/xce-build scheduler` 全绿;三个新测试在注入破坏时各自变红(手工验证一次后还原)。
|
||||||
|
|
||||||
**工作量**:1 个会话(纯 testsuite/,不碰 src)。
|
**工作量**:1 个会话(纯 testsuite/,不碰 src)。
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue