fix(bettergi): 单个 JS 脚本的 manifest.json 坏了不再让整个脚本列表拿不到 - #783
ColinHouse wants to merge 4 commits into
Conversation
manifest.json 是玩家订阅或手放的第三方文件,list_js_scripts 只用它取显示名。 解析失败改为记一条 warning、显示名退回目录名并继续列下一个,接口不再 500。 Closes AUTO-MAS-Project#724 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
审查者指南(小型 PR 中折叠显示)审查者指南调整 BetterGI 一条龙 JS 脚本枚举逻辑:manifest.json 解析失败时记录警告、使用目录名作为显示名并继续枚举,从而避免单个第三方脚本损坏导致整个脚本列表接口失败;同时补充变更日志。 具备容错能力的 BetterGI JS 脚本枚举时序图sequenceDiagram
participant API as JS脚本列表API
participant Enumerator as list_js_scripts
participant Manifest as manifest.json
participant Logger as BetterGILogger
API->>Enumerator: list_js_scripts(root)
loop 每个脚本目录
Enumerator->>Manifest: read_file(manifest)
alt manifest解析成功
Manifest-->>Enumerator: data
Enumerator->>Enumerator: 使用manifest.name或目录名
else OSError或ValueError
Manifest-->>Enumerator: 解析异常
Enumerator->>Logger: warning(...)
Enumerator->>Enumerator: 使用目录名作为显示名
end
Enumerator->>Enumerator: 继续枚举下一个脚本
end
Enumerator-->>API: 返回完整脚本列表
文件级变更
可能关联的问题
提示和命令与 Sourcery 交互
自定义使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's Guide调整 BetterGI 一条龙 JS 脚本枚举逻辑:manifest.json 解析失败时记录警告、使用目录名作为显示名并继续枚举,从而避免单个第三方脚本损坏导致整个脚本列表接口失败;同时补充变更日志。 Sequence diagram for resilient BetterGI JS script enumerationsequenceDiagram
participant API as JS脚本列表API
participant Enumerator as list_js_scripts
participant Manifest as manifest.json
participant Logger as BetterGILogger
API->>Enumerator: list_js_scripts(root)
loop 每个脚本目录
Enumerator->>Manifest: read_file(manifest)
alt manifest解析成功
Manifest-->>Enumerator: data
Enumerator->>Enumerator: 使用manifest.name或目录名
else OSError或ValueError
Manifest-->>Enumerator: 解析异常
Enumerator->>Logger: warning(...)
Enumerator->>Enumerator: 使用目录名作为显示名
end
Enumerator->>Enumerator: 继续枚举下一个脚本
end
Enumerator-->>API: 返回完整脚本列表
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b87632c5b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -0,0 +1 @@ | |||
| BetterGI专项 一条龙的 JS 脚本列表不再因为某个脚本的 manifest.json 格式有误而整体加载失败 | |||
There was a problem hiding this comment.
Describe only the user-visible symptom in the changelog
Rewrite this release-note sentence without naming manifest.json or its formatting as the implementation cause. The repository requires changelog fragments to omit internal details, state the observable symptom rather than its cause, and retain only a user-recognizable trigger; describing an anomalous third-party script causing the JS script list to fail would satisfy that requirement.
AGENTS.md reference: AGENTS.md:L39-L40
Useful? React with 👍 / 👎.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
摘要
User/JsScript/下任意一个脚本的manifest.json不是严格 JSON(例如尾逗号)时,GET /api/scripts/bettergi/js-scripts整个返回 500,一条龙表单的 JS 脚本候选列表全部拿不到list_js_scripts()只用 manifest 取显示名,本就有「显示名退回目录名」的兜底;现在解析失败记一条 warning、显示名按目录名、继续列下一个,不静默吞错JSONDecodeError,修复后返回[("AAA-Good", "好脚本"), ("BBB-Bad", "BBB-Bad")];pytest tests/task -k bettergi31 passed;ruff(0.15.14)通过;pytest tests --collect-only退出码 0Closes #724
🤖 Generated with Claude Code
Sourcery 总结
改进 BetterGI JS 脚本发现机制,使其能够容忍单个无效的清单文件,而不会中断其余脚本列表的加载。
错误修复:
Original summary in English
Sourcery 摘要
让 BetterGI JS 脚本发现机制能够容忍无效的清单文件,同时保留其余脚本条目。
错误修复:
Original summary in English
Sourcery 总结
允许在单个清单文件无效时继续发现 BetterGI JS 脚本。
错误修复:
Original summary in English
Sourcery 总结
使 BetterGI JS 脚本发现机制能够容忍单个无效的清单文件。
错误修复:
Original summary in English
Summary by Sourcery
Make BetterGI JS script discovery resilient to individual invalid manifest files.
Bug Fixes: