Merge pull request 'Expand dotted setting keys and mask secret pools' (#181) from fix/settings-dotted-keys into main
ci / test (push) Successful in 2m0s

This commit was merged in pull request #181.
This commit is contained in:
2026-10-04 13:48:31 +00:00
2 changed files with 35 additions and 1 deletions
+34
View File
@@ -0,0 +1,34 @@
# fix/settings-dotted-keys 任务卡
任务主记录:[Dev #181](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/181)([Backend #61](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Backend/pulls/61));状态:进行中;owner:weichen
## 基线与授权
- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 5d3a4b3ee3e69d9c47eeb2779eb1c7156c42186b
- 工作区:/home/weichen/projects/Agent-System-Dev-wt-fix-settings-dotted-keys(worktree);分支:fix/settings-dotted-keys
- 授权与交付终点:修复设置点路径死键、密钥明文返回、掩码写回。改 Backend,Dev 仓推进 gitlink。部署到 dev 环境验收,并重测小队入口。合入由所有者执行。不改 Core,不改前端,不改 svc.sh 播种时序。
## 目标与非目标
- 目标:`PUT /api/settings/user|project/{id}` 的点路径键展开成嵌套并生效;嵌套对象与点路径冲突时嵌套胜出;启动时迁移存量点路径键(在注册 Tavily 之前);`GET /api/settings` 按 schema 掩码 secret(含 `apiKeys`);写回 `••••••` 不覆盖已存密钥。
- 非目标:不按 schema 校验键名。不改前端。不改 Core。不改 svc.sh 播种时序。不修小队路径 `tool.result` 恒为 ok。
## 合同、依赖与兼容
- 合同:点路径在写入时展开。两种形态并存时嵌套胜出。GET 对 `type=secret` 或 `secret=true` 的路径,以及叶子名 `apiKey`/`api_key`/`apiKeys`/`secret`/`token`,非空值返回 `••••••`。写回该占位符视为未修改。有迁移时日志为 `settings: normalized N dotted key(s) in M scope(s)`。掩码占位符存量只记路径。
- 依赖:Backend 先合入,再把本仓 gitlink 改钉到 Backend main 的合入提交。
- 兼容:以前静默失效的点路径写入,升级后会生效。与已存在的嵌套对象冲突时,已生效的嵌套值保持不变。
## 同步记录
| 节点 | sync_base_sha | tested_head_sha | checked_at |
|---|---|---|---|
| 启动 | 5d3a4b3ee3e69d9c47eeb2779eb1c7156c42186b | 5d3a4b3ee3e69d9c47eeb2779eb1c7156c42186b | 2026-10-04T12:52:50Z |
| 同步前验收 | 3836ea88e3954878f257b7708ae5ccef947ccd79 | f2516ef1ce2dc3ffc702a3a623711978c90de626 | 2026-10-04T13:04:26Z |
| 同步前验收 | 5a791fd1c37a40fcec8178e463c3f91b0153ac28 | 6042402c79b7d992fe3b26d340d85a1df1b9caed | 2026-10-04T13:44:24Z |
## 结果与验证(完成后填写)
- 结果:Backend #61 已合入,合并提交 `fd17011`。本分支 gitlink 已钉到该提交。Dev [Dev #181](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/181)。
- 验证:Backend `go test ./...` 通过。Dev worktree `make test` 通过(boundaries、pins、libs、core、backend、frontend vitest 77、ui vitest 79、agent-command;exit 0,2026-10-04T13:05:13Z)。dev 部署 `scripts/svc.sh dev deploy --from dev@8b63e2b` 成功(pid 1759380)。库已备份 `runtime/dev/data-backup-20261004T130825Z.db`。启动日志 `normalized 4 dotted key(s) in 2 scope(s)`,`registered (1 key(s))`。库中不再有点路径键,`context.maxHistoryMessages=30` 已是嵌套值。GET 对 Tavily 密钥池返回掩码。点路径写入 `runtime.entry` 后 GET 读到嵌套值,已改回 direct。写回掩码占位符后主模型密钥长度仍为 126。web_search 探针 3 次 status=ok。
- 影响与剩余项:这次启动迁移让原先无效的点路径写入生效(dev 库的 deliverables.style、runtime.entry、project 历史窗口)。小队入口重测见仓外报告 §10:入口接通,B6 的 delegation.json 解析失败,C4 停在 HITL。合入由所有者执行。合入 Dev #181 后在 worktree 内 `make task-finish`,并把 dev 重新部署到 main。