Repository navigation
[Bug] fs-local | asar 内路径 stat({bigint:true}) 抛 Cannot mix BigInt,filesystem 技能提供者整块被跳过 #9861
Replies: 1 comment
Confirmed at source, and the defect is visible in the signatureEvery claim of yours verifies against the tree at the current head (
The shape of the defect is one line above the throwThe helper both callers use already admits the wider type ( async function probeStats<T extends Stats | BigIntStats>(
absolutePath: string,
readStats: (path: string) => Promise<T>,
): Promise<T | null>
That is worth stating before the patch, because the minimal fix and the correct fix differ in where they land: masking with On the fixYour option A is correct and semantics-preserving for both input types — One correction to the impact framing, in your favour: nothing here depends on the archive being damaged or the path being absent — I have not run this in an Electron host, so the asar-side behaviour ( |
Uh oh!
There was an error while loading. Please reload this page.
环境
项 值
运行体 Electron
43.0.0/ Node24.17.0/win32形态 桌面打包版(
resources/app.asar,281,491,121 字节)缺陷包
@deepseek-ai/dsh-fs-local(packages/fs/fs-local),打包副本;npx 缓存另有0.1.5-rc.2同样复现触发条件 目标路径位于
app.asar内(纯 Node / 非打包环境不复现)English summary (for triage)
dsh-fs-local假定fs.stat/lstat(path, { bigint: true })必然返回BigIntStats,但 Electron 的 asar 层会静默忽略bigint选项,对 asar 内路径返回普通Stats(mode为 Number)。于是Number(info.mode & 511n)抛TypeError,filesystem 技能提供者被整体跳过。harness.log中以约 15 秒为周期持续重复(实测 8 分钟内 33 条,重启后仍复现):可观察后果:该路径下确实存在的技能(实测 17 个文件、4 个技能目录:
agent-experience、cordis-composition-reference、cordis-plugin-development、editing-cordis-compositions)无法挂载,技能目录不完整。仅日志刷屏,无崩溃。dsh-fs-local中两处(lib/index.js,两处逻辑相同):实测对照(同一进程、同一 API,仅路径不同):
路径
stat(p, {bigint:true}).constructor.nametypeof modeNumber(mode & 511n)真实文件系统路径
BigIntStatsbigint438✅app.asar内路径StatsnumberTHROWTypeError: Cannot mix BigInt and other types❌即 Electron asar 层未实现
bigint分支(其内部把 asar 元数据构造成普通Stats;同族问题见 electron#42686)。异常随后被listingIoError()包装:→ 与 §2 的日志行逐字对应。
方案 A:调用方做类型归一(推荐,改动最小)
Number(...)先把BigInt/Number统一成数字,再按位掩码。掩码仍是511,语义不变。两处都要改。方案 B:对缺失字段做防御(同时覆盖 §7 的次要问题)
在 Electron(
ELECTRON_RUN_AS_NODE=1)下运行:对照:把同一路径换成一个普通目录,得到
BigIntStats且不抛错。嫌疑 结论 依据
readdirp无关 其 Windows 分支确实传{bigint:true},但自身无 BigInt 算术chokidar无关 内部为stats.mtimeMs === 0严格相等,不抛归档损坏 无关 asar 索引与全部 19,623 个打包条目完整性校验 100% 通过
路径不存在 无关 该目录在 asar 内确实存在(已确认 17 个文件)
即使打上 §4 的补丁,
versionOf()仍不完整:普通
Stats没有mtimeNs/ctimeNs字段 → 版本串里出现undefined;且 asar 内条目的四个时间戳全部等于归档容器自身的时间(实测四者相同),因此版本/新鲜度标识实际退化为常量。
影响:缓存失效判定、变更检测可能失准。不影响正确性,故列为次要。
经检索未发现与本条完全对应的上游条目。已见的相关线索(仅标题级,未读正文):
electron#42686 ——
.asar的fs.stat返回的blksize/blocks为undefinedelectron#50877 —— "return numeric blksize and blocks from asar fs.stat"
二者同属"asar 构造的
Stats是数值型残缺对象"这一族问题,但均未涉及bigint选项被忽略。本报告结论全部来自本机可复现实测,非文献引用。如需要,可提供两项本机证据:
两路径对照实测的原始输出(
BigIntStatsvsStats,含抛错堆栈)从
app.asar中抽出的dsh-fs-local/lib/index.js源码(含上述两处,行 238–262)(本报告不含任何本地绕过改动;报表方未修改归档,桌面版为原始安装状态。)
All reactions