Repository navigation
fix(expiry-guardian): 声明 hostLogger,插件能真正启动 - #204
Merged
MyPrototypeWhat merged 1 commit intoDec 4, 2026
Merged
Conversation
Collaborator
|
这次提交里带上了两份 Mimosa 本地会话文件:
它们是本地工具的会话状态,不是插件功能代码,也不在运行时 payload 里。当前 main 和这个插件目录里都没有 |
start() 的第一条语句给 hostLogger 赋值,而这个标识符全文件从未声明。本包是 ESM,严格模式下给未声明的标识符赋值会抛 ReferenceError,宿主加载插件必然 失败 —— 面板、MCP 端点、定时判定全部不存在。 这条从插件合入的第一次提交(MiniMax-AI#47)起就在,也就是它从第一天起就没能启动过。 没有测试调用过 start(),所以没人发现。 新增 tests/start-lifecycle.test.mjs:真的调用 start(context),要求它 resolve、真的监听端口、dispose 跑完;另加一条根因守卫,检查 hostLogger 是 模块级已声明的变量、且 start() 里那次注入还在。在未改的代码上红(1/5), 改完绿(6/6)。 版本号 2.0.1。一致性脚本里加上新测试。
Apageoflove
force-pushed
the
fix/expiry-guardian-start
branch
from
December 4, 2026 04:56
9264b79 to
ea34273
Compare
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.
插件从合入的第一天起就没能启动过。
start()的第一条语句是hostLogger = context.logger ?? null;,而hostLogger在整个文件里从未声明。这个包是 ESM(package.json 里"type": "module"),严格模式下给未声明的标识符赋值会抛 ReferenceError —— 宿主加载它必然失败,面板、MCP 端点、定时判定全部不存在。实测(未改的代码):
git log -S hostLogger显示这行从第一次提交(5664d58 / PR #47)起就在。没人发现是因为没有测试调用过start()—— 现有测试只覆盖纯函数decide()。改的是在模块作用域声明
hostLogger(放在inflightSnapshot/lastGoodSnapshot那一段旁边),start()里那次注入保留 —— 注释写明它是给模块级重试辅助函数用的 Host 日志出口。新增
tests/start-lifecycle.test.mjs:真的调用start(context),要求它 resolve、真的监听端口(logger 收到expiryGuardian.listening)、dispose 跑完;另加一条根因守卫,检查hostLogger是顶格声明的模块级变量、且start()里那次注入还在。未改的代码上 1/5 通过(ReferenceError),改完 6/6。插件自带测试 85/85,仓库根
npm run check0 error。版本号 2.0.1。
验证范围:只有 Node 22 上的测试是实测的。真实 Host 和 Electron 我没跑过 —— 这一层是仅个人判断。
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.