fix(gig-square): 发布/修改时校验服务声明技能真实可用性,缺失技能拒绝并列出名称 (#10) - #12
Open
WuFenG-Hub wants to merge 1 commit into
Open
Conversation
…s not installed on host Publish and modify drafts now cross-check each declared providerSkill against the host's actual installed skills (SkillManager.listSkills()) via validateGigSquareModifyDraft options. Missing skills fail with errorCode 'provider_skill_not_available' and an error listing the missing skill names; already-installed skills keep the existing flow. Runtime parity: matching uses the same resolution semantics as order execution (resolveSkillById with _/- id normalization and resolveSkillByName with case-insensitive name). Callers that do not pass installedSkills keep legacy validation behavior. Closes metaid-developers#10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复点
服务发布 / 修改路径新增「宿主运行时技能可用性」交叉校验(Issue #10):
src/main/main.tspublish RPC)与修改路径(modify RPC)在validateGigSquareModifyDraft校验时传入getSkillManager().listSkills(),将自声明的providerSkills与宿主真实已安装技能交叉核对。errorCode: 'provider_skill_not_available',错误信息列出缺失技能名(如providerSkill is not available on this host: seedance)。resolveSkillById的_/-id 变体归一 +resolveSkillByName的大小写不敏感 name 匹配),已安装技能正常放行,既有发布流程无回归。installedSkills的调用方保持原有校验行为(新增可选参数,默认不开启校验)。变更文件
src/main/services/gigSquareServiceMutationService.ts:新增纯函数resolveMissingProviderSkills;validateGigSquareModifyDraft增加可选installedSkills参数与缺失技能拒绝分支。src/main/main.ts:发布与修改两条 IPC 路径传入宿主已安装技能列表。tests/gigSquareServiceMutationService.test.mjs:新增 8 条单测覆盖缺失技能拒绝(含列名)、已安装放行、大小写/_-/-` 归一匹配、无技能宿主拒绝、旧调用兼容。测试证据
node --test tests/gigSquareServiceMutationService.test.mjs:32 pass / 0 fail(含 8 条新增)。044741e8(upstream main,与 Issue 验收锚一致),无上游漂移。边界声明(未执行环节,不自报闭合)
Closes #10