Files
junhong_cmp_fiber/openspec/specs/auto-resume-on-reset/spec.md
huang ad095d73f3
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m8s
docs: 同步能力规范 — 新增购买/重置后复机 spec,更新停复机和排队激活规范
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-31 18:12:52 +08:00

38 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## ADDED Requirements
### Requirement: 流量周期重置后自动复机
系统 SHALL 在成功重置套餐流量(`data_usage_mb` 归零,`status` 恢复为 `Active`)后,对因流量耗尽而停机的卡自动触发复机操作。
#### Scenario: 3 个月套餐第 2 个月耗尽停机,第 3 个月重置后自动复机
- **GIVEN** 卡 C1 有一个 3 个月套餐(`data_reset_cycle=monthly`),第 2 个月流量耗尽(`status=2 Depleted`),卡已停机(`network_status=0``stop_reason=traffic_exhausted`),已实名
- **WHEN** 月度重置任务运行,套餐 `data_usage_mb` 归零,`status` 恢复为 `1 Active`
- **THEN** `ResetService` 调用 `ResumeCardIfStopped(ctx, "iot_card", cardID)`
- **AND** 卡自动复机(`network_status=1`
#### Scenario: 日流量套餐重置后停机卡自动复机
- **GIVEN** 卡 C2 有日流量套餐(`data_reset_cycle=daily`),当天流量耗尽停机,已实名
- **WHEN** 次日零点日流量重置任务运行
- **THEN** 卡自动复机
#### Scenario: 年流量套餐重置后停机卡自动复机
- **GIVEN** 卡 C3 有年流量套餐(`data_reset_cycle=yearly`),年内流量耗尽停机,已实名
- **WHEN** 年度重置任务运行
- **THEN** 卡自动复机
#### Scenario: 重置后卡已处于开机状态不重复复机
- **GIVEN** 卡 C4 套餐被重置,但 `network_status=1`(已开机,可能已被人工复机)
- **WHEN** `ResumeCardIfStopped` 被调用
- **THEN** 检测到卡已开机,幂等跳过,不调用 Gateway
#### Scenario: 重置后未实名卡不复机
- **GIVEN** 卡 C5 套餐被重置,`real_name_status=0`(未实名),停机中
- **WHEN** `ResumeCardIfStopped` 被调用
- **THEN** 检测到未实名,静默跳过,卡保持停机
#### Scenario: 批量重置中部分套餐的卡已停机
- **GIVEN** 月度重置扫描到 100 个套餐,其中 10 个对应的卡处于停机状态且已实名
- **WHEN** 月度重置完成
- **THEN** 10 张停机卡异步触发复机,其余 90 张正常跳过
- **AND** 单个复机失败不影响其他卡的处理