1
0
Files
DiAL/openspec/changes/archive/2026-05-11-simplify-judgment-model/proposal.md

39 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.
## Why
当前系统使用 `success` + `matched` 两层判定模型,但实际实现中 `success` 始终等于 `matched`(两者永远同值),导致两层模型退化为单层。`success` 字段没有提供任何独立信息,反而增加了理解成本和维护负担。此外,分组排序使用字母序而非 YAML 配置中的首现顺序,与 spec 要求不一致。
## What Changes
- **BREAKING**: 移除 `success` 字段,将判定模型简化为 `matched` 单层判定
- 数据库 `check_results` 表移除 `success`
- 所有 CheckResult 类型(服务端、共享、前端)移除 `success` 字段
- UP/DOWN 判定统一为 `matched=true` / `matched=false`
- availability 计算简化为 `matched=true 占比`
- avgDurationMs 仅计算 `matched=true` 记录的平均耗时
- 修复分组排序:非 default 分组按 YAML 首现顺序(即 `id` 顺序)排列,而非字母序
- `command-runner` 添加 `stdin: "ignore"`,符合 spec 要求
## Capabilities
### New Capabilities
### Modified Capabilities
- `probe-engine`: 移除结果记录中的 `success` 字段,简化为 `matched` + `failure`
- `probe-api`: `CheckResult``RecentSample` 移除 `success` 字段UP 判定改为 `matched`
- `probe-data-store`: 数据库 schema 移除 `success` 列;可用率定义简化;排序规则修正
- `probe-dashboard`: UP/DOWN 判定改为 `matched`
- `card-dashboard`: UP/DOWN 判定改为 `matched`
- `command-checker`: 移除所有 `success` 引用;确保 stdin 禁用
- `target-grouping`: 排序规则明确为按 id 排序YAML 首现顺序)
## Impact
- **数据库**: `check_results` 表结构变更(移除列),已有数据库需删除重建(项目未上线,无向前兼容要求)
- **API**: `CheckResult` 响应移除 `success` 字段,`RecentSample.up` 计算逻辑变更
- **前端**: 所有依赖 `success` 字段的组件需更新TargetCard、TargetDetailModal、TargetGroup
- **测试**: 5 个测试文件需同步移除 `success` 相关断言
- **README**: 目标状态判定模型说明需更新