Files
yinjianm a62a124710 fix(api): 修复自动墙检父节点筛选与启用语义
统一自动墙检查询逻辑,兼容 parent_id 为 null 或 0 的父节点
将 gfw_check_enabled 的空值视为开启,避免页面显示已启用却未入队

同时调整管理端自动墙检统计仅计算父节点
并更新 CI 配置以忽略 .helloagents 变更触发后端发布
2026-04-28 14:53:19 +08:00

77 lines
3.3 KiB
Markdown
Raw Permalink 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.
# 任务清单: fix-admin-node-gfw-null-enabled
> **@status:** completed | 2026-04-28 14:48
```yaml
@feature: fix-admin-node-gfw-null-enabled
@created: 2026-04-28
@status: completed
@mode: R2
```
## LIVE_STATUS
```json
{"status":"completed","completed":4,"failed":0,"pending":0,"total":4,"percent":100,"current":"代码修复、前端构建和知识库同步已完成;后端目标测试因本机缺少 PHP 未执行","updated_at":"2026-04-28 14:50:00"}
```
## 进度概览
| 完成 | 失败 | 跳过 | 总数 |
|------|------|------|------|
| 4 | 0 | 0 | 4 |
---
## 任务列表
### 1. 后端墙检启用语义
- [√] 1.1 修改 `app/Services/ServerGfwCheckService.php`
- 预期变更: 抽出父节点和启用过滤查询方法,让自动墙检入队同时覆盖 `parent_id = NULL``parent_id = 0`,并让最新墙状态查询把 `NULL` 启用值视为开启。
- 完成标准: `startAutomaticChecks()``getLatestStatusesForServers()` 的查询条件均与项目父节点判断和 `isGfwCheckEnabled()` 语义一致。
- 验证方式: 阅读代码并运行 `php artisan test --filter=ServerGfwCheckServiceTest`
- depends_on: []
### 2. 前端统计口径
- [√] 2.1 修改 `admin-frontend/src/utils/nodes.ts`
- 预期变更: `countAutoGfwCheckNodes()` 只统计开启墙检托管的父节点,避免把不会独立检测的子节点计入自动墙检数量。
- 完成标准: 统计口径与 `startAutomaticChecks()` 的父节点范围一致。
- 验证方式: 运行 `npm run build``admin-frontend`)。
- depends_on: [1.1]
### 3. 回归测试
- [√] 3.1 修改 `tests/Unit/ServerGfwCheckServiceTest.php`
- 预期变更: 补充 `parent_id = 0` 父节点会被自动入队、显式关闭仍跳过的测试。
- 完成标准: 新测试能失败于旧父节点查询语义,成功于修复后的查询语义。
- 验证方式: 运行 `php artisan test --filter=ServerGfwCheckServiceTest`
- depends_on: [1.1]
### 4. 知识库与验收
- [√] 4.1 同步知识库并执行目标验证
- 预期变更: 更新节点管理上下文或模块文档,记录 `gfw_check_enabled` 空值按开启处理的长期约定;执行后端目标测试和前端构建。
- 完成标准: 知识库反映代码事实;验证结果明确记录。
- 验证方式: 检查 `.helloagents/context.md` 或相关模块文档,查看测试/构建输出。
- depends_on: [2.1, 3.1]
---
## 执行日志
| 时间 | 任务 | 状态 | 备注 |
|------|------|------|------|
| 2026-04-28 14:41 | DESIGN | completed | 已完成上下文收集、唯一方案规划与方案包创建 |
| 2026-04-28 14:45 | 1.1/2.1/3.1 | completed | 已完成后端查询语义、前端统计口径和回归测试用例修改 |
| 2026-04-28 14:50 | 4.1 | completed | 前端构建通过;知识库已同步;后端目标测试因本机缺少 PHP 未执行 |
---
## 执行备注
- 本次修复不新增迁移,优先保证查询语义对历史空值数据鲁棒。
- 当前工作树存在其他未提交变更和未完成 CI 方案包,本方案只修改墙检相关文件。
- 验证记录:`ADMIN_BUILD_OUT_DIR=dist npm run build` 通过;`php artisan test --filter=ServerGfwCheckServiceTest` 因本机 `php` 不在 PATH 未执行;`git diff --check` 对本次代码文件通过,仅提示 Windows 换行转换。