fix(api): 修复自动墙检父节点筛选与启用语义

统一自动墙检查询逻辑,兼容 parent_id 为 null 或 0 的父节点
将 gfw_check_enabled 的空值视为开启,避免页面显示已启用却未入队

同时调整管理端自动墙检统计仅计算父节点
并更新 CI 配置以忽略 .helloagents 变更触发后端发布
This commit is contained in:
yinjianm
2026-04-28 14:53:19 +08:00
parent 4c66d1fbe0
commit a62a124710
18 changed files with 506 additions and 13 deletions
+10 -2
View File
@@ -15,6 +15,10 @@ class ServerGfwCheckServiceTest extends TestCase
public function test_start_automatic_checks_only_enqueues_enabled_parent_nodes_without_active_task(): void
{
$eligible = $this->makeServer(['name' => 'eligible-parent']);
$zeroParent = $this->makeServer([
'name' => 'zero-parent',
'parent_id' => 0,
]);
$active = $this->makeServer(['name' => 'active-parent']);
$stale = $this->makeServer(['name' => 'stale-parent']);
$this->makeServer([
@@ -41,15 +45,19 @@ class ServerGfwCheckServiceTest extends TestCase
$result = app(ServerGfwCheckService::class)->startAutomaticChecks();
$this->assertSame(3, $result['total']);
$this->assertSame(4, $result['total']);
$this->assertSame(1, $result['active']);
$this->assertSame(1, $result['expired']);
$this->assertSame([$eligible->id, $stale->id], array_column($result['started'], 'id'));
$this->assertSame([$eligible->id, $zeroParent->id, $stale->id], array_column($result['started'], 'id'));
$this->assertCount(1, $result['skipped']);
$this->assertDatabaseHas('server_gfw_checks', [
'server_id' => $eligible->id,
'status' => ServerGfwCheck::STATUS_PENDING,
]);
$this->assertDatabaseHas('server_gfw_checks', [
'server_id' => $zeroParent->id,
'status' => ServerGfwCheck::STATUS_PENDING,
]);
$this->assertDatabaseHas('server_gfw_checks', [
'id' => $staleCheck->id,
'status' => ServerGfwCheck::STATUS_FAILED,