Repository navigation
fix: DSH Desktop 插件树加载崩溃(v0.7.23 回归) - #93
Conversation
cordis 4 的 ctx 是 Proxy:直接访问未在 inject 声明的属性会抛 "cannot get property without inject"(而非返回 undefined),v0.7.23 把 webServer 移出 inject 后 `if (ctx.webServer)` 守卫失效;且去掉 inject 后 cordis 不再等待宿主 webServer 服务就绪,桌面端 apply 时 服务未提供即崩。修复:恢复 webServer 到 inject(cordis 等宿主就绪 再 apply)+ apply/register 守卫改 ctx.reflect.get(免 inject 读取、 未提供返回 undefined 不抛错,未来 headless 移出 inject 也安全)。 真实 cordis + dsh-host-webserver 插件实测:API 路由 200、未知路径 404、headless 静默不激活。新增 webServer-optional 回归测试(真实 cordis 两种宿主形态)。714 测试全绿。 Co-authored-by: Anans-Ivresse <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThe plugin restores ChangeswebServer readiness and regression fix
Estimated code review effort: 2 (Simple) | ~15 minutes Severity of issue fixed: Medium Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
修复内容
v0.7.23 的「webServer 可选化」导致 DSH Desktop 插件树加载崩溃(Windows 重启即报
cannot get property "webServer" without inject)。根因:cordis 4 的 ctx 是 Proxy——直接访问未在 inject 声明的属性会抛错而非返回 undefined,
if (ctx.webServer)守卫失效;且去掉 inject 后 cordis 不再等待宿主 webServer 服务就绪,apply 时服务未提供即崩。修复:
webServer到 inject 声明(cordis 等宿主服务就绪后再 apply,路由注册不落时序)ctx.reflect.get(免 inject 读取、未提供返回 undefined 不抛错,未来 headless 移出 inject 也安全)验证:
dsh-host-webserver插件本地实测:GET /api/dsh-mneme/list→ 200 JSON、未知路径 → 404 JSON、headless 无 webServer → 静默不激活test/webServer-optional.test.js回归测试(真实 cordis 两种宿主形态)Summary by CodeRabbit
Bug Fixes
Documentation
Tests