Skip to content

Commit 12b1148

Browse files
Johnny-CheungDeliciousBuding
authored andcommitted
fix(branch): 对齐
1 parent f117a23 commit 12b1148

2 files changed

Lines changed: 18 additions & 24 deletions

File tree

docs/operations/deployment-record.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ curl http://api.hub.vectorcontrol.tech/api/public/stats
7676

7777
| 时间 (UTC) | 镜像 | 变更 | 验证 |
7878
|:--|:--|:--|:--|
79-
| 2026-05-27 07:13 | `ghcr.io/tokendancelab/agenthub-hub:latest` -> `sha256:ce796233a6c8...` | 本机预构建镜像 tar(SHA256 `897f4939354a94d2e4f9d9a890972166e79e7df1794797666e5f25a54b1ae5f2`,35,283,968 bytes,约 34 MB)传输到 hk2 后 `docker load`,发布 commit `abb4bd0`:`/edge/devices/register` OpenAPI 路径、请求体、`{code,message,data}` envelope 和 `Device` response schema 对齐 Hub 实际合同;Hub `DeviceHandler` 新增 response DTO,把存储层 JSON 字符串 `capabilities` 解码为数组后返回,避免设备注册/列表响应泄漏 DB 存储形态;无新 migration;服务器未执行 build;旧 latest 已保留为 `ghcr.io/tokendancelab/agenthub-hub:rollback-202605270713-3be43e6` | 本地验证:OpenAPI/handler 红绿测试、`hub-server && go test ./internal/handler -run "Test(DeviceHandler_Register_Success\|OpenAPIEdgeDeviceRegisterMatchesHubRouteAndEnvelope)" -count=1 -v`、`hub-server && go test ./internal/handler -run "Test(DeviceHandler_Register\|EdgeHubProtocol)" -count=1 -v`、`hub-server && go test ./internal/handler -count=1`、`hub-server && go test ./... -short -count=1`、OpenAPI YAML 解析、目标文件 `git diff --check` 和本机 Docker build 通过;部署态三容器 healthy;本地与公网 `/health` 返回 `status=ok`、`migrations=39`;运行容器 image `sha256:ce796233a6c8e14841d437e724bf70604ec0a9024bfea2f296c3bb8d23f02e46`;清理远端/本地传输 tar,并删除最旧 rollback `rollback-202605270520-fdaf419`,保留 latest + 3 个 rollback;观测 Hub 7.199 MiB/256 MiB、PG 28.86 MiB/512 MiB、Redis 4.523 MiB/384 MiB,根盘 8.8 GiB 可用(70% 使用) |
8079
| 2026-05-27 05:58 | `ghcr.io/tokendancelab/agenthub-hub:latest` -> `sha256:e827a90917e8...` | 本机预构建镜像 tar(35,281,408 bytes,约 34 MB)传输到 hk2 后 `docker load`,发布 commit `bb65507`:附件上传 handler staging temp file 改用系统临时目录,最终 blob 仍通过 `AttachmentService.StoreBlob` 写入配置的 `Upload.Dir` / S3 storage,避免 configured upload dir 场景下遗留 `./uploads` 临时目录,也避免本地 storage 根为 `.` 时 temp 目录与最终文件路径冲突;无新 migration;服务器未执行 build;旧 latest 已保留为 `ghcr.io/tokendancelab/agenthub-hub:rollback-202605270558-53dc56a` | 本地验证:handler 红绿测试、`hub-server && go test ./internal/handler -run TestAttachmentUploadUsesConfiguredLocalStorageDir -count=1 -v`、`hub-server && go test ./internal/handler ./internal/service -run "TestAttachment|TestLocalStorage|TestSaveAttachment|TestS3Storage" -count=1`、`hub-server && go test ./... -short -count=1`、目标文件 `git diff --check` 和本机 Docker build 通过;部署态三容器 healthy;本地与公网 `/health` 返回 `status=ok`、`migrations=39`;运行容器 image `sha256:e827a90917e80d3e073b6268bca993aa0e400cc7d10f3aeeec762709e3bbd059`;清理远端/本地传输 tar,并删除最旧 rollback `rollback-202605270509-78b6abb`,保留 latest + 3 个 rollback;观测 Hub 7.316 MiB/256 MiB、PG 28.66 MiB/512 MiB、Redis 4.523 MiB/384 MiB,根盘 8.8 GiB 可用(70% 使用) |
8180
| 2026-05-27 05:38 | `ghcr.io/tokendancelab/agenthub-hub:latest` -> `sha256:5c631cfe0614...` | 本机预构建镜像 tar(35,281,920 bytes,约 34 MB)传输到 hk2 后 `docker load`,发布 commit `e8f0260`:`SendMessage` 写入 jsonb 前统一 normalize content;text 继续包装为 `{"text": ...}`,非 text 必须是 JSON object 并按类型校验必需字段后 compact marshal,`deploy_card` 不再跳过 JSON 校验,避免 raw client JSON 或 invalid JSON 进入持久层;无新 migration;服务器未执行 build;旧 latest 已保留为 `ghcr.io/tokendancelab/agenthub-hub:rollback-202605270538-c2673cc` | 本地验证:service 红绿测试、`hub-server && go test ./internal/service -run "TestSendMessage_(NormalizesNonTextContentBeforeJsonbWrite|RejectsInvalidDeployCardJSONBeforeDBLookup)" -count=1`、`hub-server && go test ./internal/service -run TestSendMessage -count=1`、`hub-server && go test ./... -short -count=1`、目标文件 `git diff --check` 和本机 Docker build 通过;部署态三容器 healthy;本地与公网 `/health` 返回 `status=ok`、`migrations=39`;运行容器 image `sha256:5c631cfe0614e6b0b8c7b8ffee1dd78d48da34432a3fa6b247d985ad280f1d9c`;清理远端/本地传输 tar,并删除最旧 rollback `rollback-202605270452-7b98bdf`,保留 latest + 3 个 rollback;观测 Hub 6.41 MiB/256 MiB、PG 28.66 MiB/512 MiB、Redis 4.637 MiB/384 MiB,根盘 8.4 GiB 可用(72% 使用) |
8281
| 2026-05-27 05:20 | `ghcr.io/tokendancelab/agenthub-hub:latest` -> `sha256:8e0da3f777e4...` | 本机预构建镜像 tar(35,282,944 bytes,约 34 MB)传输到 hk2 后 `docker load`,发布 commit `d1d26a7`:普通离线 `pending_tasks` 和 target/device 专属 `pending_tasks:*:device:*:target:*` Redis list 写入后设置 24 小时 TTL,target index set 同步设置 TTL;与 DB `pending_agent_tasks.expire_at` 对齐,避免 stale offline task queue key 永久驻留;无新 migration;服务器未执行 build;旧 latest 已保留为 `ghcr.io/tokendancelab/agenthub-hub:rollback-202605270520-fdaf419` | 本地验证:cache 红绿测试、`hub-server && go test ./internal/cache -run "TestPending(TasksExpire|TargetTasksExpireWithIndex)" -count=1`、`hub-server && go test ./internal/cache ./internal/service ./internal/app -run "Test(PendingTask|PendingTarget|DispatchTask|TriggerAgentTask|OnRouteSet)" -count=1`、`hub-server && go test ./... -short -count=1`、目标文件 `git diff --check` 和本机 Docker build 通过;部署态三容器 healthy;本地与公网 `/health` 返回 `status=ok`、`migrations=39`;运行容器 image `sha256:8e0da3f777e4967cf22e73a1cf4d515064be56bf588350417066da49bc37e56c`;清理远端/本地传输 tar,并删除最旧 rollback `rollback-202605270434-18606aa`,保留 latest + 3 个 rollback;观测 Hub 9.039 MiB/256 MiB、PG 28.66 MiB/512 MiB、Redis 4.52 MiB/384 MiB,根盘 8.4 GiB 可用(71% 使用) |

docs/roadmap.md

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
> 以下 P0-P2 项在 M5 批次(2026-05-24)中全部修复,保留作为记录。
4343
44-
参考:`docs/archive/review-archive/edge-server-audit.md``docs/archive/review-archive/hub-server-audit.md``docs/review/hub-server-testing.md``docs/review/backend-engineering-standards.md`
44+
参考:`docs/review/edge-server-audit.md``docs/review/hub-server-audit.md``docs/review/hub-server-testing.md``docs/review/backend-engineering-standards.md`
4545

4646
| 严重度 | 层面 | 核心问题 | 报告索引 | 状态 |
4747
|:--:|------|------|:--:|:--:|
@@ -138,13 +138,13 @@ Hub 调度(远程):
138138
### 3.1 Q2 2026(当前 -- 工程基础收敛)
139139

140140
> **目标**:代码质量达标、测试覆盖完整、CI/CD 完善、消除全局状态。
141-
> **参考**`docs/archive/review-archive/edge-server-audit.md``docs/archive/review-archive/hub-server-audit.md``docs/review/hub-server-testing.md``docs/review/backend-engineering-standards.md`
141+
> **参考**`docs/review/edge-server-audit.md``docs/review/hub-server-audit.md``docs/review/hub-server-testing.md``docs/review/backend-engineering-standards.md`
142142
143143
---
144144

145145
#### 3.1.1 Edge Server 工程完善(~12 天)
146146

147-
> 参考:`docs/archive/review-archive/edge-server-audit.md` 全部 13 项发现
147+
> 参考:`docs/review/edge-server-audit.md` 全部 13 项发现
148148
149149
##### P0 -- 阻断级
150150

@@ -214,7 +214,7 @@ Hub 调度(远程):
214214

215215
#### 3.1.2 Hub Server 工程完善(~18 天)
216216

217-
> 参考:`docs/archive/review-archive/hub-server-audit.md` 全部 P0-P3 发现 + `docs/review/hub-server-testing.md` 测试改进计划
217+
> 参考:`docs/review/hub-server-audit.md` 全部 P0-P3 发现 + `docs/review/hub-server-testing.md` 测试改进计划
218218
219219
##### P0 -- 阻断级
220220

@@ -427,7 +427,7 @@ Hub 调度(远程):
427427
- `docs/architecture/adr/` — 5 篇:Hub-Edge双层/WS+NDJSON/Zustand+TanStack/Go进程编排/Worktree隔离
428428

429429
- [x] **文档与代码一致性修复** `[1d]`
430-
- Hub Server 准确性矩阵(`docs/archive/review-archive/hub-server-audit.md` 第 10 节)31 项对比中 15 项不一致
430+
- Hub Server 准确性矩阵(`docs/review/hub-server-audit.md` 第 10 节)31 项对比中 15 项不一致
431431
- 修复关键项:消息撤回 2min vs 5min、CORS/Rate-limit middleware 文档声明但不存在
432432
- 验收:移除文档中未实现的端点声明
433433

@@ -624,9 +624,6 @@ Hub 调度(远程):
624624
- [x] 2026-05-27 Pending task Redis queue TTL:普通离线 `pending_tasks` 和 target/device 专属 `pending_tasks:*:device:*:target:*` Redis list 现在写入后设置 24 小时 TTL,target index set 同步设置 TTL;与 DB `pending_agent_tasks.expire_at` 对齐,避免 stale offline task queue key 永久驻留。验证通过 cache 红绿测试 `go test ./internal/cache -run "TestPending(TasksExpire|TargetTasksExpireWithIndex)" -count=1`、cache/service/app 相关测试和 `hub-server && go test ./... -short -count=1`
625625
- [x] 2026-05-27 #173 non-text message content normalization:`SendMessage` 写入 jsonb 前统一 normalize content;text 仍包装为 `{"text": ...}`,非 text 必须是 JSON object 并按类型校验必需字段后 compact marshal,`deploy_card` 不再跳过 JSON 校验,避免 raw client JSON 或 invalid JSON 进入持久层。验证通过 service 红绿测试 `go test ./internal/service -run "TestSendMessage_(NormalizesNonTextContentBeforeJsonbWrite|RejectsInvalidDeployCardJSONBeforeDBLookup)" -count=1``go test ./internal/service -run TestSendMessage -count=1``hub-server && go test ./... -short -count=1`
626626
- [x] 2026-05-27 #145 configured upload directory:附件上传 handler 不再用 hash 的最终 blob path 在当前工作目录创建 staging temp 文件,改为系统临时文件;最终 blob 仍通过 `AttachmentService.StoreBlob` 写入配置的 `Upload.Dir` / S3 storage,避免 configured upload dir 场景下遗留 `./uploads` 临时目录,也避免本地 storage 根为 `.` 时 temp 目录与最终文件路径冲突。验证通过 handler 红绿测试 `go test ./internal/handler -run TestAttachmentUploadUsesConfiguredLocalStorageDir -count=1`、attachment 相关 handler/service 测试和 `hub-server && go test ./... -short -count=1`
627-
- [x] 2026-05-27 #138 device register contract alignment:OpenAPI 已对齐 Hub 实际 `/edge/devices/register` slash route、`{code,message,data}` response envelope 和当前 `Device` response 字段;Hub handler 不再把存储层 `capabilities` JSON 字符串泄漏给客户端,注册/列表响应会返回数组。验证通过 OpenAPI 合同红绿测试 `go test ./internal/handler -run TestOpenAPIEdgeDeviceRegisterMatchesHubRouteAndEnvelope -count=1`、handler register response 红绿测试、相关 Edge protocol 测试、OpenAPI YAML 解析和 `hub-server && go test ./... -short -count=1`
628-
- [x] 2026-05-27 #142 Edge callback request body contract:OpenAPI 的 Edge task stream/done callback request body 现在明确指向 Hub 实际 schema;stream 至少要求 `content``chunk``payload` 之一,`client_msg_id` 标为 UUID,`content`/`chunk`/`final_content`/`error` 字符串字段写明 1 MiB 上限,`event_type` 写明 96 字符上限,`run_id`/`edge_run_id` 保持 128 字符上限。验证通过 OpenAPI 合同红绿测试 `go test ./internal/handler -run TestOpenAPIEdgeTaskCallbacksDocumentStreamAndDoneBodies -count=1``go test ./internal/handler -count=1`、OpenAPI YAML 解析和 `hub-server && go test ./... -short -count=1`
629-
- [x] 2026-05-27 #105 CI gate policy alignment:新增 `scripts/verify-ci-gates.ps1` 并接入 `validate` job,防止 CI gate 再次漂移;校验 Edge/Hub 覆盖率硬阈值分别为 75%/40%,`govulncheck` 为硬阻断,Go lint/gosec 保持 warning-only 可见债务,validate job 保留 whitespace、secret guard 和 OpenAPI YAML 解析。路线图验收标准同步区分 CI 硬 gate 与发布审计 gate。验证通过本地红绿执行 `pwsh -NoLogo -NoProfile -File scripts\verify-ci-gates.ps1`、OpenAPI YAML 解析、`hub-server && go test ./... -short -count=1` 和目标文件 `git diff --check`
630627
- [x] **2026-05-26:`feat/web-agent-closeout-20260526` 已合入并删除本地/远端分支。** WebAgent 产出已成为 `dev/delicious233` 主线的一部分。
631628
- [x] **2026-05-26:PR #197 已关闭。** 其中安全可独立验证的 `team-hub-authz``team-hub-reliability``team-adapter-compat` 已直接合入主线;Johnny 聚合分支因 migrations/API/process-executor-test 冲突保留单独审。
632629
- [x] 2026-05-26 Web Hub-only boundary slice:删除 `app/web/src/api/eventClient.ts``edgeAuth.ts``hooks/useHubIntegration.ts`、旧 `useChatMessages.ts`、Local Edge status/event/runners hooks,权限弹窗类型迁到 `app/web/src/types/permissions.ts`;新增 `scripts/verify-web-hub-boundary.ps1` 并接入 runtime readiness,阻断浏览器端重新引入 Local Edge loopback、`/v1/runs``/v1/events`。Web `edgeClient.ts` 只保留显式 Hub-only/stubbed 兼容面。
@@ -759,16 +756,14 @@ Hub 调度(远程):
759756
```powershell
760757
# Edge Server
761758
go test ./... -count=1 -short -race -coverprofile=coverage.out ./...
762-
go tool cover -func=coverage.out | grep total # CI 硬阈值 >= 75%
763-
go run golang.org/x/vuln/cmd/govulncheck@latest ./... # CI 硬阻断:零可利用漏洞
764-
# gosec 当前在 CI 中 warning-only,可见但不阻断;发布审计再按 4.3 执行零 HIGH/MEDIUM
759+
go tool cover -func=coverage.out | grep total # >= 80%
760+
go run golang.org/x/vuln/cmd/govulncheck@latest ./... # 零高危漏洞
761+
go run github.com/securecodewarrior/gosec/v2/cmd/gosec@latest ./... # 零高危
765762
766763
# Hub Server
767764
go test ./... -count=1 -short -race -coverprofile=coverage.out ./...
768765
# 不少于 5 个包有独立单元测试
769-
go tool cover -func=coverage.out | grep total # CI 硬阈值 >= 40%
770-
go run golang.org/x/vuln/cmd/govulncheck@latest ./... # CI 硬阻断:零可利用漏洞
771-
# gosec 当前在 CI 中 warning-only,可见但不阻断;发布审计再按 4.3 执行零 HIGH/MEDIUM
766+
go tool cover -func=coverage.out | grep total # >= 60%
772767
773768
# Desktop
774769
pnpm test:run # 全部通过
@@ -814,11 +809,9 @@ pnpm typecheck # 零错误
814809

815810
### 4.3 安全审计通过标准
816811

817-
- [x] CI 硬阻断:Edge/Hub `govulncheck` 零可利用漏洞
818-
- [x] CI 硬阻断:`scripts/check-secrets.sh` 零密钥泄露
819-
- [x] CI 可见债务:Edge/Hub `gosec` warning-only,结果必须在 Actions 中可见
820-
- [ ] 发布审计:`gosec` 零 HIGH/MEDIUM
821-
- [ ] 发布审计:`gitleaks` 零密钥泄露
812+
- [ ] `gosec`:零 HIGH/MEDIUM
813+
- [ ] `govulncheck`:零可利用漏洞
814+
- [ ] `gitleaks`:零密钥泄露
822815
- [ ] JWT secret 仅环境变量(代码中无硬编码)
823816
- [ ] 速率限制生效(登录/注册 429 拒绝)
824817
- [ ] pprof/metrics 端口仅 localhost 绑定
@@ -1145,11 +1138,13 @@ pnpm typecheck # 零错误
11451138
---
11461139
### 7.11 剩余待处理
11471140

1148-
**纯后端(0 个)**
1141+
**纯后端(3 个)**
11491142

11501143
| # | Issue | 优先级 |
11511144
|---|-------|:--:|
1152-
||||
1145+
| 142 | Document request bodies for Edge task stream/done callbacks | P2 |
1146+
| 138 | Align register request/response between OpenAPI and Hub | P2 |
1147+
| 105 | Align CI gates with documented security/coverage policy | P2 |
11531148

11541149
**B7 剩余(4 个,客户端相关)**#181, #180, #71, #114
11551150
**B6 剩余(9 个,Desktop IM/Hub 对接)**#123, #121, #119, #118, #125, #126, #102, #106, #150
@@ -1170,8 +1165,8 @@ pnpm typecheck # 零错误
11701165

11711166
| 类别 | 文档 | 用途 |
11721167
|------|------|------|
1173-
| **审计** | `docs/archive/review-archive/edge-server-audit.md` | Edge 13 项发现(S1-S13) |
1174-
| | `docs/archive/review-archive/hub-server-audit.md` | Hub 22 项发现(P0-1 ~ P3-9) |
1168+
| **审计** | `docs/review/edge-server-audit.md` | Edge 13 项发现(S1-S13) |
1169+
| | `docs/review/hub-server-audit.md` | Hub 22 项发现(P0-1 ~ P3-9) |
11751170
| | `docs/review/hub-server-testing.md` | Hub 测试覆盖率 + 改进计划 |
11761171
| | `docs/review/backend-engineering-standards.md` | 工程标准评分 + Top 10 改进 |
11771172
| **路线图** | `docs/roadmaps/client.md` | Desktop Phase 0/1/2 详细任务 |

0 commit comments

Comments
 (0)