@calcit/procs 0.13.57 → 0.13.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.yarn/install-state.gz +0 -0
- package/RFCs/04-15-wasm-compilation-feasibility.md +1 -0
- package/editing-history/202608280826-wasm-stable-list-sort.md +17 -0
- package/editing-history/202608281155-document-shared-native-ffi.md +13 -0
- package/editing-history/202608281215-review-ffi-responsibility-wording.md +11 -0
- package/editing-history/202608281225-document-second-native-ffi-rollout.md +11 -0
- package/editing-history/202608281430-consume-shared-raw-abi.md +13 -0
- package/editing-history/202608281450-release-0.13.58.md +13 -0
- package/editing-history/202608282333-async-queue-byte-budget.md +19 -0
- package/editing-history/202608290048-async-runtime-shutdown.md +17 -0
- package/editing-history/202608290107-avoid-duplicate-shutdown-cancel.md +13 -0
- package/editing-history/202608290110-handle-shutdown-review.md +15 -0
- package/editing-history/202608290144-async-task-queue-metrics.md +19 -0
- package/editing-history/202608290154-ffi-metrics-report.md +19 -0
- package/editing-history/202608290227-typed-ffi-capabilities.md +17 -0
- package/editing-history/202608290240-release-0.13.59.md +13 -0
- package/lib/package.json +1 -1
- package/package.json +1 -1
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
|
@@ -253,6 +253,7 @@ WASM GC proposal(2024 年起 V8/SpiderMonkey 已发布)提供:
|
|
|
253
253
|
2. 继续补充 `calcit.core` 常见高阶路径。
|
|
254
254
|
- `foldl`、`foldl-shortcut`、`foldr-shortcut`、`sort`、`&call-spread` 仍是大量跳过项的源头。
|
|
255
255
|
- 这部分不是为了追求“理论完备”,而是为了减少真实项目中被迫绕开 core helper 的情况。
|
|
256
|
+
- 2026-08:带显式 comparator 的 `sort` / `&list:sort` 已实现稳定 WASM 排序;一参数 heterogeneous total-order 仍明确拒绝,等待类型化比较协议。
|
|
256
257
|
|
|
257
258
|
3. 持续扩大 `test-wasm.cirru` 的下游回归覆盖。
|
|
258
259
|
- 每补一个能力,都应优先加一个最小但能锁定语义边界的 WASM 用例。
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# WASM stable list sort / WASM 稳定列表排序
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 用稳定 insertion sort 替换 `sort` 与 `&list:sort` 的静默 identity stub。
|
|
6
|
+
- 排序前复制线性内存 list,保持输入不可变;comparator 复用 static、inline、native proc 与动态函数表调用路径。
|
|
7
|
+
- comparator 结果仅在大于零时移动左值,因此 equal/NaN 保持原顺序。
|
|
8
|
+
- 一参数 heterogeneous total-order 明确报 unsupported,不再生成语义错误的 WASM。
|
|
9
|
+
- 增加升序、降序、重复 key 稳定性、输入不可变、动态 comparator 与 unsupported 路径测试。
|
|
10
|
+
|
|
11
|
+
## English
|
|
12
|
+
|
|
13
|
+
- Replace the silent identity stubs for `sort` and `&list:sort` with stable insertion sort.
|
|
14
|
+
- Copy the linear-memory list before sorting to preserve input immutability, reusing static, inline, native-proc, and dynamic function-table comparator paths.
|
|
15
|
+
- Move the left value only when the comparator is greater than zero, preserving order for equal and NaN results.
|
|
16
|
+
- Reject the one-argument heterogeneous total-order form explicitly instead of generating semantically incorrect WASM.
|
|
17
|
+
- Add ascending, descending, duplicate stability, input immutability, dynamic comparator, and unsupported-path tests.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 记录共享 native FFI crate rollout / Document the shared native FFI crate rollout
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 在 FFI bindings 与升级手册中推荐使用已发布的 `calcit_native_ffi`,明确 protocol 文档与模块侧实现的职责边界。
|
|
6
|
+
- 记录首批迁移并发布的五个模块版本。
|
|
7
|
+
- 修正升级手册中的 GitHub 仓库名称,并要求稳定 crate version 而非 git hash。
|
|
8
|
+
|
|
9
|
+
## English
|
|
10
|
+
|
|
11
|
+
- Recommend the published `calcit_native_ffi` in the FFI bindings and upgrade guide, clarifying the boundary between normative protocol docs and the maintained module-side implementation.
|
|
12
|
+
- Record the first five migrated and released module versions.
|
|
13
|
+
- Fix repository names in the upgrade guide and require stable crate versions instead of git hashes.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# 修正文档责任边界措辞 / Clarify responsibility-boundary wording
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 根据 PR review 将模块职责改为非穷举表述。
|
|
6
|
+
- 明确业务参数与逻辑、thread、connection/task registry、cancel state、server lifecycle 和其他领域状态仍由模块维护。
|
|
7
|
+
|
|
8
|
+
## English
|
|
9
|
+
|
|
10
|
+
- Make the module-responsibility wording non-exhaustive in response to PR review.
|
|
11
|
+
- Clarify that modules continue to own domain arguments and behavior, threads, connection/task registries, cancellation state, server lifecycles, and other domain-specific state.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# 记录第二批 native FFI rollout / Document the second native FFI rollout
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 记录 JSON、Clipboard、Command 与 Regex 的共享 crate 发布版本。
|
|
6
|
+
- 明确 Regex 的 opaque-resource registry 仍属于模块,仅 buffer-v1 transport adapter 进入共享层。
|
|
7
|
+
|
|
8
|
+
## English
|
|
9
|
+
|
|
10
|
+
- Record the shared-crate releases for JSON, Clipboard, Command, and Regex.
|
|
11
|
+
- Clarify that Regex retains its module-owned opaque-resource registry and shares only the buffer-v1 transport adapter.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 消费共享 raw ABI / Consume the shared raw ABI
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- Calcit runtime 直接依赖 `calcit_native_ffi 0.1.2` 的 no-default-features raw contract。
|
|
6
|
+
- 删除 host 内重复的 buffer/async/blocking/resource version、symbol、function pointer、C-layout descriptor 与数值常量定义。
|
|
7
|
+
- 保留类型安全 handle/event enum、event queue、task/resource registry、lease、dylib cache 与 callback lifecycle 在 Calcit host。
|
|
8
|
+
|
|
9
|
+
## English
|
|
10
|
+
|
|
11
|
+
- Made the Calcit runtime consume the no-default-features raw contract from `calcit_native_ffi 0.1.2` directly.
|
|
12
|
+
- Removed host-local copies of buffer/async/blocking/resource versions, symbols, function pointers, C-layout descriptors, and numeric constants.
|
|
13
|
+
- Kept typed handle/event enums, the event queue, task/resource registries, leases, the dylib cache, and callback lifecycle in the Calcit host.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 发布 0.13.58 / Release 0.13.58
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 发布 WASM 后端显式 comparator 的稳定 list sort。
|
|
6
|
+
- 记录 native FFI 共享 crate 的完整 rollout,并让 runtime 直接消费 `calcit_native_ffi 0.1.2` raw ABI。
|
|
7
|
+
- 保持 C ABI v1 与现有 native 模块兼容,删除 host 内 184 行重复 raw contract 实现。
|
|
8
|
+
|
|
9
|
+
## English
|
|
10
|
+
|
|
11
|
+
- Release stable list sorting with an explicit comparator in the WASM backend.
|
|
12
|
+
- Document the complete shared native-FFI rollout and make the runtime consume the raw ABI from `calcit_native_ffi 0.1.2` directly.
|
|
13
|
+
- Preserve C ABI-v1 compatibility with existing native modules while removing 184 lines of duplicated host raw-contract code.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Async queue byte budget and terminal reserve
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- native async queue 现在可同时限制事件数和累计 payload bytes,避免大量合法但体积较大的事件在 1024 个 event slots 内消耗过多内存。
|
|
6
|
+
- CLI runtime 使用 64 MiB 总字节预算,并为 `Complete`/`Fail` 预留 16 个 event slots 和 64 KiB;普通 Stream/Server emit 不能侵占这些预留资源。
|
|
7
|
+
- event admission 成功后才分配 sequence;event/byte budget 失败都返回稳定的 `QUEUE_FULL`,不会误占 terminal 或 sequence。
|
|
8
|
+
- coalescing 在字节压力下也能替换同一 Stream 的旧 emit,并精确维护 queued-byte accounting;drain/purge 同样回收字节账本。
|
|
9
|
+
- `--trace-ffi` 的 enqueue accepted/rejected 事件现在包含当前 queued events/bytes,便于定位 slow host 或 producer pressure。
|
|
10
|
+
- 修复 async protocol 文档仍描述 legacy Rust callback fallback 的过时内容。
|
|
11
|
+
|
|
12
|
+
## English
|
|
13
|
+
|
|
14
|
+
- The native async queue can now bound both event count and aggregate payload bytes, preventing a queue of individually valid events from consuming excessive memory.
|
|
15
|
+
- The CLI runtime uses a 64 MiB byte budget and reserves 16 event slots plus 64 KiB for `Complete`/`Fail`; ordinary Stream/Server emits cannot consume those reserves.
|
|
16
|
+
- Event sequences are allocated only after admission. Event-count and byte-budget failures both map to stable `QUEUE_FULL` without claiming a sequence or terminal event.
|
|
17
|
+
- Coalescing can replace an older Stream emit under byte pressure while keeping queued-byte accounting exact; drain and purge release the same accounting.
|
|
18
|
+
- Accepted and rejected `--trace-ffi` enqueue events now include current queued event/byte counters for diagnosing slow hosts and producer pressure.
|
|
19
|
+
- Removed stale async protocol documentation that still described the deleted legacy Rust callback fallback.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# 接入异步 runtime 关闭 / Wire async runtime shutdown
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- Calcit CLI 统一安装 Ctrl-C handler,信号线程只设置原子状态,`on-control-c` 回调改由 host thread 串行执行。
|
|
6
|
+
- 调用 async registry `begin_shutdown`,拒绝未完成 response,调用模块 cancel hook,并给 terminal event 保留 2 秒 grace period。
|
|
7
|
+
- grace period 结束后先关闭 host queue,再按 module/method/task/kind/age 输出诊断并强制 purge/release,避免迟到 producer 竞态。
|
|
8
|
+
- Watch loop 与兼容性 `async-sleep` 共享可唤醒的 shutdown signal,避免 Ctrl-C 后长时间挂起。
|
|
9
|
+
- 添加 response rejection、cancel invocation、grace timeout 强制清理测试,并使用真实 fswatch C-safe Stream 验证 cancel→Complete→release,无强制清理。
|
|
10
|
+
|
|
11
|
+
## English
|
|
12
|
+
|
|
13
|
+
- Install one CLI-owned Ctrl-C handler; the signal thread only updates atomic state, while `on-control-c` callbacks run serially on the host thread.
|
|
14
|
+
- Invoke async-registry `begin_shutdown`, reject open responses, call module cancel hooks, and retain a two-second grace period for terminal events.
|
|
15
|
+
- After the deadline, close the host queue first, then diagnose unfinished tasks by module/method/task/kind/age and force purge/release them without a late-producer race.
|
|
16
|
+
- Let watch loops and compatibility `async-sleep` share a wakeable shutdown signal so Ctrl-C cannot leave the process hanging.
|
|
17
|
+
- Cover response rejection, cancel invocation, and forced cleanup after grace, plus a real fswatch C-safe Stream cancel→Complete→release smoke with no forced cleanup.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 避免 shutdown 重复取消 / Avoid duplicate shutdown cancellation
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 在 `begin_shutdown` 之前保留 lifecycle snapshot,只向原先处于 `Active` 的 task 调用 cancel hook。
|
|
6
|
+
- 如果 `on-control-c` 或业务逻辑已经把 task 转为 `Closing`,全局 shutdown 只等待 terminal,不会重复调用模块取消。
|
|
7
|
+
- 测试断言已在 Closing 的 task 取消次数保持为零,同时继续受 grace timeout 和强制清理保护。
|
|
8
|
+
|
|
9
|
+
## English
|
|
10
|
+
|
|
11
|
+
- Preserve the lifecycle snapshot before `begin_shutdown` and invoke cancel hooks only for tasks that were originally `Active`.
|
|
12
|
+
- If `on-control-c` or application logic already moved a task to `Closing`, global shutdown waits for its terminal acknowledgement without calling module cancellation twice.
|
|
13
|
+
- Assert that an already-closing task receives zero additional cancel calls while remaining protected by the grace timeout and forced cleanup.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 完善关闭中断路径 / Complete shutdown interruption paths
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 按 condvar 谓词协议在持有 wake mutex 时记录 shutdown 并通知,消除检查状态与进入等待之间的丢失唤醒窗口。
|
|
6
|
+
- Native evaluator 低频检查 shutdown 请求,覆盖普通求值与尾递归执行;`on-control-c` 回调在 host thread 运行时临时暂停该检查。
|
|
7
|
+
- Watch 在收到文件事件后重新检查关闭状态;reload 与 codegen 在阶段之间检查,且无 timeout 的 codegen 也由可中断的 worker 执行。
|
|
8
|
+
- Once-mode 运行出错或被中断后不再提前跳过 async runtime 清理,而是先完成有界取消与回收,再返回原始错误。
|
|
9
|
+
|
|
10
|
+
## English
|
|
11
|
+
|
|
12
|
+
- Record shutdown and notify while holding the condition-variable predicate mutex, closing the lost-wakeup window between checking state and waiting.
|
|
13
|
+
- Poll shutdown cheaply during native evaluation, including tail recursion, while temporarily suppressing interruption for the host-thread `on-control-c` callback.
|
|
14
|
+
- Recheck shutdown after watch events and between reload/codegen phases; timeout-free codegen now also runs behind an interruptible worker boundary.
|
|
15
|
+
- Once-mode failures and interruptions no longer bypass async-runtime cleanup: bounded cancellation and reclamation finish before the original error returns.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# 异步 task 队列指标 / Async task queue metrics
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 在 async queue 同一把 mutex 下维护有界的 per-task 固定元数据索引,覆盖 queued events、queued bytes、oldest age、accepted、coalesced、queue-full、dequeued 与 purged。
|
|
6
|
+
- Enqueue、coalescing、drain 与 purge 的新增指标工作只更新目标 task,不扫描全 registry,也不复制业务 payload;coalescing 延续队列原有的有界定位逻辑。
|
|
7
|
+
- `--trace-ffi` 在 enqueue/reject/cancel/release 展示 task-local 指标;shutdown 额外按 module/method 汇总 active/closing tasks 与 backlog。
|
|
8
|
+
- Task release 时删除指标状态;forced cleanup 诊断保留最终 backlog 与累计值。
|
|
9
|
+
- 单元测试覆盖 coalescing、queue-full、drain、purge、并发 producer 与 shutdown 后指标归零。
|
|
10
|
+
- Fibo release 五次中位数由 251.208ms 变为 250.554ms(-0.26%,无可见回退);真实 fswatch 0.0.9 trace 验证 `Emit → cancel → Complete → release` 且 `forced=0`。
|
|
11
|
+
|
|
12
|
+
## English
|
|
13
|
+
|
|
14
|
+
- Maintain a bounded fixed-metadata per-task index under the async queue mutex for queued events, queued bytes, oldest age, accepted, coalesced, queue-full, dequeued, and purged counts.
|
|
15
|
+
- The added metric work for enqueue, coalescing, drain, and purge updates only the affected task without scanning the full registry or copying business payloads; coalescing retains the queue's existing bounded lookup.
|
|
16
|
+
- Extend `--trace-ffi` enqueue/reject/cancel/release records with task-local metrics and aggregate active/closing tasks plus backlog by module/method during shutdown.
|
|
17
|
+
- Remove metric state on task release while retaining the final backlog and cumulative counters in forced-cleanup diagnostics.
|
|
18
|
+
- Cover coalescing, queue-full, drain, purge, concurrent producers, and post-shutdown metric removal in tests.
|
|
19
|
+
- The five-run release fibo median changes from 251.208ms to 250.554ms (-0.26%, no visible regression); a real fswatch 0.0.9 trace verifies `Emit → cancel → Complete → release` with `forced=0`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Native async FFI 指标报告 / Native async FFI metrics report
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 新增 `--ffi-metrics`,在进程退出时向 stderr 输出唯一一条带 `schemaVersion` 的 JSON,不污染业务 stdout。
|
|
6
|
+
- 已完成 task 的 queue 与 lifecycle 计数折叠进有界的 module/method 聚合;当前 task 则与 live queue snapshot 合并,避免释放后丢失累计证据或长期保留 capability。
|
|
7
|
+
- Host 统一记录 response deadline timeout,以及 cancel 请求、成功与失败;模块内部 retry 与远端耗时明确由模块自身上报。
|
|
8
|
+
- JSON 提供 totals 和稳定排序的 module/method rows,覆盖 active/closing/completed task、backlog、oldest age 与所有 queue outcome。
|
|
9
|
+
- 单元测试覆盖 deadline timeout 与 cooperative/forced shutdown 后聚合;真实 fswatch 0.0.9 Ctrl-C 验证 `completedTasks=1`、cancel request/success 与 Complete dequeue 均为 1、`forced=0`,指标只出现在 stderr。
|
|
10
|
+
- 默认关闭报告时不执行 completed archive 或 outcome 锁更新,且复用已有 task control mutex、不增加每 task 分配;release fibo 五次中位数为 246.086ms,对比上一阶段 250.554ms 无可见回退。
|
|
11
|
+
|
|
12
|
+
## English
|
|
13
|
+
|
|
14
|
+
- Add `--ffi-metrics`, which emits exactly one schema-versioned JSON record to stderr at process exit without contaminating business stdout.
|
|
15
|
+
- Fold completed-task queue and lifecycle counters into bounded module/method aggregates; merge current tasks with a live queue snapshot so release neither erases cumulative evidence nor retains capabilities indefinitely.
|
|
16
|
+
- Count response deadline timeouts and cancellation requests, successes, and failures in the host, while keeping module-internal retries and remote timings module-owned.
|
|
17
|
+
- Provide totals and deterministically ordered module/method rows for active/closing/completed tasks, backlog, oldest age, and every queue outcome.
|
|
18
|
+
- Cover deadline timeout plus cooperative/forced shutdown aggregation in unit tests; a real fswatch 0.0.9 Ctrl-C run reports `completedTasks=1`, one cancel request/success, one completed dequeue, and `forced=0`, only on stderr.
|
|
19
|
+
- When reporting is disabled, skip completed archives and outcome-lock updates, and reuse the existing task-control mutex without adding a per-task allocation. The five-run release fibo median is 246.086ms versus 250.554ms in the previous stage, with no visible regression.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# 类型化 FFI capability / Typed FFI capabilities
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 在 core 中增加 nominal `FfiTask` 与 `FfiResponse`,把 native async AnyRef 限制在各自 wrapper 的 `Dynamic` raw 字段中。
|
|
6
|
+
- 公开生命周期操作采用方法形式:task 使用 `.cancel` / `.cancel-with`,response 使用 `.resolve` / `.reject`;底层 `&ffi-*` procedure 仅由内部适配函数调用。
|
|
7
|
+
- reason 与 payload 使用方法级泛型 `T`。Calcit trait 禁止方法签名包含 `Dynamic`,因此用户值不会在进入 FFI 编码前丢失静态类型。
|
|
8
|
+
- 两种 capability 使用不同 nominal receiver;错误 receiver 会被 method dispatch 确定性拒绝,错误 raw capability 仍由 native 宿主校验 kind、owner、generation 与 lifecycle。
|
|
9
|
+
- 增加可重放的 architecture scaffold、core 构造测试,以及中英双语协议和使用文档。
|
|
10
|
+
|
|
11
|
+
## English
|
|
12
|
+
|
|
13
|
+
- Added nominal core `FfiTask` and `FfiResponse` wrappers, confining native async AnyRef values to each wrapper's `Dynamic` raw field.
|
|
14
|
+
- Exposed lifecycle operations as methods: `.cancel` / `.cancel-with` for tasks and `.resolve` / `.reject` for responses. Internal adapters are the only callers of the raw `&ffi-*` procedures.
|
|
15
|
+
- Kept reason and payload values typed with method-level generic `T`. Calcit traits reject `Dynamic` method signatures, so caller-side types survive until FFI encoding.
|
|
16
|
+
- Kept task and response capabilities as distinct nominal receivers. Method dispatch rejects a wrong receiver deterministically, while the native host still validates raw capability kind, owner, generation, and lifecycle.
|
|
17
|
+
- Added a replayable architecture scaffold, core constructor tests, and bilingual protocol and usage documentation.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 发布 0.13.59 / Release 0.13.59
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 发布 core 类型化 native async FFI capability API。
|
|
6
|
+
- `FfiTask` 提供 `.cancel` / `.cancel-with`,`FfiResponse` 提供 `.resolve` / `.reject`。
|
|
7
|
+
- 下游 native 模块可以从稳定版本开始迁移,不需要引用未发布提交。
|
|
8
|
+
|
|
9
|
+
## English
|
|
10
|
+
|
|
11
|
+
- Release the typed native async FFI capability API in core.
|
|
12
|
+
- `FfiTask` exposes `.cancel` / `.cancel-with`, while `FfiResponse` exposes `.resolve` / `.reject`.
|
|
13
|
+
- Downstream native modules can migrate from a stable version instead of referencing an unpublished commit.
|
package/lib/package.json
CHANGED