Skip to content

0.1.31

Latest

Choose a tag to compare

@imuyue imuyue released this 18 Nov 08:18

修复

  • Node 26 上存储线程无法启动。 存储 worker 曾以 --experimental-transform-types 启动,而 Node 26 移除了这个开关,worker 被直接拒绝(Initiated Worker with invalid execArgv flags),插件在 Node 26 上完全不可用。现在类型剥离只依赖 Node 自带的 strip,execArgv 不再传开关;源码里 28 处 TS 参数属性(constructor(private readonly x: T))改为显式字段加构造函数体内赋值,因为 strip-only 模式不支持参数属性。
  • Node 26 上删除尾部事件会抛 RangeError。 truncateTail 删掉 contentless FTS5 索引的行之后,sqlite3_last_insert_rowid() 会留下一个约 2^53 的值,StatementSync.run() 在 Node 26 上把它当 JS number 读取并抛 Value is too large to be represented as a JavaScript number。写语句(INSERT/UPDATE/DELETE/REPLACE)现在统一 setReadBigInts(true);25 处 .run() 的返回值本来就没有调用方使用,语义零变化。
  • Windows 上转换、修复、删除会话会 EBUSY/EPERM。 只要本进程还持有该库的连接(哪怕是 readOnly: true),Windows 就拒绝 rename 或 unlink 该库及其 -wal/-shm,重试不可能成功,因为句柄是自己的。新增 src/store-lease.ts:执行器在构造时登记释放器,removeDatabase/moveDatabase(src/transfer.ts)与 archiveSource(src/migrate.ts)先释放再动文件,worker 模式经 forget 转发到工作线程。
  • 后台预热会在库被移动或删除期间重新打开连接。 这正是上一条 EBUSY 的来源之一:releaseStore() 之后 warm-up 又把连接开了回来,rm 便失败。预热在 tail 读之前加了 existsSync 守卫——顺带修掉一个更糟的行为:对已删除的会话做非只读 open 会把它重建成一个空库。
  • 客户端三处适配器把宿主版本钉死在一个精确的构建串上。 会话恢复、工作区成员同步、工作区流恢复在 0.2.2-rc.1 上检查通过,升到同一线的 rc.3/rc.4 后就被静默关闭,而它们依赖的宿主形状并没有变。现在只设下限(>=0.2.2)加逐对象的形状探测(client/host-compat.ts):低于下限拒绝并报告,不低于则交给探测决定。
  • 初始历史补丁只认 0.2.2-rc.1 一个构建。 该补丁按整文件 SHA-256 与调用行定位,rc.3 的构建被直接拒绝。现在按受支持构建列表逐版本钉 SHA 与调用行(scripts/patch-initial-history.mjs),未列出的构建仍拒绝,而不是猜着改。
  • CI 偶发超时。 tests/migrate.spec.ts 的 overwrite 迁移要真的搬文件、建库、再把每个事件读回来校验,在 windows-latest runner 上会超过 vitest 默认的 5s。新增 vitest.config.ts(testTimeout: 20s、hookTimeout: 30s):hang 仍然失败,慢盘不再失败。

改进

  • npm 12 下 npm ci 直接失败(EALLOWREMOTE):它拒绝从配置 registry 之外的主机取 tarball,而 lockfile 里 187 条 resolved 全指向 registry.npmmirror.com。lockfile 改回 registry.npmjs.org,新增 .npmrc 用 replace-registry-host=npmjs,让镜像使用者在自己的 registry 上仍能取到包。出厂默认配置(无 userconfig)与镜像源两种情形都验证过。
  • 发布不再只看 tag。 publish.yml 通过 workflow_call 调用 ci.yml,测试不过就不发。0.1.30 就是从一个本机测试失败的树上发出去的。
  • CI 覆盖两个平台、两条 Node 线:ubuntu-latest/windows-latest × Node 24/26。文件租约、原子改名、会话目录正是两个平台分歧最大处,只在 Linux 上跑会让 Windows 专属的失败完全不可见。
  • 测试对并发与慢盘更稳:tests/shared-titles.spec.ts 里两处「stat 调用次数必须精确等于 2」改为按路径判定(意图是「不扫描未选中的产物」,而不是「调用次数」);临时目录清理对 Windows 的 ENOTEMPTY/EBUSY/EPERM 退避重试。
  • 文档补三条实测约束:Windows 上持有连接即无法改名或删除库;整段读的绝对耗时随会话线性增长(56,537 事件、84MB 实测 1377ms、峰值堆 312MB,其中约 1.0s 在解压、约 0.3s 在逐行 JSON.parse);跨会话比较要比每事件成本而不是毫秒数。
  • 仓库卫生:.gitignore 排除本地研究资料、会话库、导出文件与密钥材料。

新增

  • src/store-lease.ts:存储租约门——引用计数式 holdStore/withStoreHeld、StoreBusyError、retryWhileHeld(5s 预算)。
  • tests/store-lease.spec.ts:7 条用例,覆盖持有期间读取被拒与释放后可读、抛错也释放且重复释放不越权、持有短暂期间读等待而非失败。
  • tests/search.spec.ts 新增回归用例:contentless 索引反复删除后仍能写入并命中。
  • vitest.config.ts、client/host-compat.ts、.github/workflows/ci.yml、.npmrc。

适配

  • Node.js:>=24.9.0,24 与 26 都跑通整套测试(Node 26 此前完全不可用)。
  • npm:在 12 的默认 allow-remote=none 下可直接 npm ci。
  • DSH:>=0.2.2-rc.1,去掉 <0.3.0-0 上界;0.2.2-rc.4 上做了端到端验证(profile 挂载、补丁落到 session-persistence-optimizer、真实写库、控制台路由)。
  • 宿主能力判定:改为版本下限加形状探测,不再因同一线上的新构建而关闭功能。

Fixed

  • The storage worker could not start on Node 26. It was spawned with --experimental-transform-types, which Node 26 removed, so the worker was rejected outright (Initiated Worker with invalid execArgv flags) and the plugin was unusable there. Type stripping now relies only on Node's built-in strip and passes no flag; the 28 TypeScript parameter properties in the sources (constructor(private readonly x: T)) became explicit fields assigned in the constructor, because strip-only mode does not support them.
  • Deleting tail events threw RangeError on Node 26. After truncateTail deleted rows from the contentless FTS5 index, sqlite3_last_insert_rowid() was left at roughly 2^53, and StatementSync.run() reads it as a JS number and throws Value is too large to be represented as a JavaScript number. Write statements (INSERT/UPDATE/DELETE/REPLACE) now set setReadBigInts(true); no caller consumed the return value at any of the 25 .run() sites, so behaviour is unchanged.
  • Converting, repairing or deleting a session failed with EBUSY/EPERM on Windows. While this process still holds a connection to the store — even a readOnly: true one — Windows refuses to rename or unlink it or its -wal/-shm, and a retry can never outlast a handle of our own. src/store-lease.ts is new: an executor registers a releaser when it is constructed, removeDatabase/moveDatabase (src/transfer.ts) and archiveSource (src/migrate.ts) release before touching files, and worker mode forwards the release through forget.
  • Background warm-up reopened a store while it was being moved or removed. This was one source of the EBUSY above: warm-up reopened the connection right after releaseStore(), so rm failed. The tail read is now guarded by existsSync, which also fixes something worse — a non-read-only open of an already deleted session recreated it as an empty store.
  • Three client adapters pinned the host to one exact build string. Session recovery, workspace membership sync and workspace stream recovery passed their check on 0.2.2-rc.1 and were silently switched off by the next builds on the same line (rc.3/rc.4), although the host shapes they depend on had not changed. They now use a floor (>=0.2.2) plus per-object shape probes (client/host-compat.ts): below the floor they refuse and report, at or above it the probe decides.
  • The initial-history patch recognised only one 0.2.2-rc.1 build. It locates its call site by whole-file SHA-256 and exact line, so the rc.3 build was refused. It now pins a supported-build list, each with its own SHA and line (scripts/patch-initial-history.mjs); a build that is not listed is still refused rather than patched on a guess.
  • Intermittent CI timeout. The overwrite migration in tests/migrate.spec.ts really moves files, builds a store and reads every event back to verify it, which exceeded vitest's default 5s on a windows-latest runner. vitest.config.ts sets testTimeout: 20s and hookTimeout: 30s: a hang still fails, a slow disk no longer does.

Improved

  • npm ci failed outright under npm 12 (EALLOWREMOTE): it refuses tarballs whose URL points at a host other than the configured registry, and all 187 resolved entries in the lockfile pointed at registry.npmmirror.com. The lockfile now pins registry.npmjs.org and .npmrc sets replace-registry-host=npmjs, so mirror users still fetch from their own registry. Both cases were verified: factory-default config with no userconfig, and a mirror registry.
  • Publishing no longer trusts a tag. publish.yml calls ci.yml through workflow_call, so a tree that fails the suite cannot ship — 0.1.30 was published from one that failed on the maintainer's own machine.
  • CI covers two platforms and two Node lines: ubuntu-latest/windows-latest × Node 24/26. File leases, atomic renames and session directories are exactly where the platforms disagree; running only on Linux makes Windows-only failures invisible.
  • Tests are steadier under concurrency and slow disks: two assertions in tests/shared-titles.spec.ts that demanded exactly two stat calls now assert on paths instead (the intent is "no unselected artifact is touched", not "the call count"), and temp-tree cleanup retries the ENOTEMPTY/EBUSY/EPERM that Windows reports right after a handle closes.
  • Three measured constraints are now documented: a held connection blocks renaming or deleting a store on Windows; whole-session reads scale with the session (56,537 events / 84 MB measured 1377ms with a 312MB peak heap, of which about 1.0s is decompression and about 0.3s is JSON.parse per line); and cross-session comparisons must use cost per event, not milliseconds.
  • Repository hygiene: .gitignore keeps local research notes, session stores, exports and key material out of the repo.

Added

  • src/store-lease.ts — a store-lease gate: reference-counted holdStore/withStoreHeld, StoreBusyError, and retryWhileHeld with a 5s budget.
  • tests/store-lease.spec.ts — seven cases covering a refused read while held and a successful one after release, release on throw plus a second release that cannot over-release, and a read that waits rather than fails during a short hold.
  • A regression case in tests/search.spec.ts: a contentless index stays writable and searchable after repeated deletes.
  • vitest.config.ts, client/host-compat.ts, .github/workflows/ci.yml, .npmrc.

Compatibility

  • Node.js: >=24.9.0; the whole suite passes on both 24 and 26 (26 was unusable before this release).
  • npm: npm ci works under npm 12's default allow-remote=none.
  • DSH: >=0.2.2-rc.1; the upper bound <0.3.0-0 is gone. Verified end to end on 0.2.2-rc.4 — profile loads, the patch lands on session-persistence-optimizer, a real store is written, console routes answer.
  • Host capability checks: a version floor plus shape probes, so a new build on the same line no longer turns features off.