fix(skillhub): preserve catalog scope boundaries - #3826
Conversation
Signed-off-by: xd-bobo <caojianbo@xd.com>
|
| Filename | Overview |
|---|---|
| apps/desktop/src/main/skillhub/autoSyncService.ts | 自动同步已按 catalog scope 查询和匹配,但允许同 slug 的多 scope 配置进入仅有一个文件系统安装槽的流程。 |
| apps/desktop/src/main/skillhub/registry/registryService.ts | 将迁移写回移至逐 skill 锁内,并按 previous scope 精确更新 registry 条目。 |
| apps/desktop/src/main/skillhub/registry/migrations.ts | 将顶层迁移标记替换为逐安装记录标记,以便识别降级后新增的旧格式条目。 |
| apps/desktop/src/main/skillhub/marketService.ts | 可见性修改完成后按来源 catalog scope 更新对应本地安装记录。 |
| apps/desktop/src/main/learn-host/controller.ts | Hub Learn 全流程规范化并保留 catalog scope,缺省值统一为 market。 |
| apps/desktop/src/renderer/features/skillhub/hooks/useMarketList.ts | 本地安装状态按 catalog scope 与 slug 组合匹配,避免同名市场记录串联。 |
| apps/mobile/src/session/desktopSlashCommands.ts | Mobile Learn 解析器支持显式 market/team scope,并兼容旧语法默认 market。 |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
C[自动同步配置<br/>scope + slug] --> S[Skill Hub scoped sync]
S --> A[AutoSync 顺序处理]
A --> I[Install Service]
I --> P[全局路径<br/>~/.agents/skills/slug]
I --> R[Registry 条目<br/>slug + installPath]
P -. 同 slug 的不同 scope 冲突 .-> P
Prompt To Fix All With AI
### Issue 1
apps/desktop/src/main/skillhub/autoSyncService.ts:653-656
**同名多目录安装槽冲突**
当自动同步配置同时包含同一 slug 的 market 与 team 记录时,新的组合键去重会保留两条记录,但安装路径和 registry 安装槽仍只按 slug 区分;第一条安装后,第二条会因目标目录已存在而被静默跳过,导致其中一个目录的目标版本和内容未被安装。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(skillhub): preserve catalog scope bo..." | Re-trigger Greptile
|
@xd-bobo 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/main/skillhub/autoSyncService.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
命中 UI 路径(apps/desktop/src/renderer/features/skillhub/SkillhubDetailView.tsx / apps/desktop/src/renderer/features/skillhub/components/VisibilityEditorDialog.tsx / apps/desktop/src/renderer/features/skillhub/hooks/useMarketList.ts 等)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范。 |
Signed-off-by: xd-bobo <caojianbo@xd.com>
|
@MagicLizi 两项均已核对并处理:
当前 GitHub checks 19/19 通过,无失败或运行中检查。 |
MagicLizi
left a comment
There was a problem hiding this comment.
代码重审通过:当前 head 未发现 P0/P1,全部 conversation 已 resolve。catalog scope 贯穿 Learn/自动同步/安装状态/可见性/移动端协议;registry 迁移改为锁内逐安装记录;账号切换写门禁 fail-closed。heavy 软命中 2 处均为测试里的 fs.writeFileSync,不是外发或越权。
|
合了。公开目录和组织目录里同名 Skill 不再串数据,账号切换时也不会拿着旧身份去写——这块边界终于钉死了。 |
这次改了什么
摘要
修复 Cindy Skill Hub 在公开目录、组织目录和原生管理视图之间丢失 catalog scope 的问题,避免同 slug Skill 被查询、同步、学习或更新成另一目录的记录。同时收紧账号切换期间的写入边界,并让旧 XD 客户端留下的 registry 数据在升级时安全迁移。
变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
UI 变化
不涉及:本 PR 命中 Renderer 文件,但只修正隐藏的目录 scope、安装状态派生和 IPC 参数,不改变布局、样式、文案或交互入口,因此无需截图。
docs/design-rules/DESIGN.md所约束的视觉属性怎么验证的
自动验证
另执行 Skill Hub、Learn、Registry、IPC、安装和 Mobile slash command 定向测试,全部通过。
手工验证
不涉及:本次为目录作用域与持久化边界修复,使用定向单测覆盖 market/team 同 slug、旧 registry 迁移、并发写回、移动端解析和账号切换场景。
未执行的验证
未启动 Desktop 或 Mobile 做人工 UI 验证;本 PR 无视觉变化。未运行完整
pnpm test:all,已按仓库门禁运行test:unit:related。风险
风险分类
影响与回滚
提交前检查
git commit -s,见 DCO)