@calcit/procs 0.11.7 → 0.12.0

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.
Files changed (35) hide show
  1. package/.gitattributes +1 -1
  2. package/.yarn/install-state.gz +0 -0
  3. package/build.rs +229 -11
  4. package/editing-history/2026-0303-1934-check-types-and-core-annotations.md +17 -0
  5. package/editing-history/2026-0304-1331-tag-call-warning-and-dot-access-migration.md +28 -0
  6. package/editing-history/2026-0304-1548-impl-new-dot-method-input-and-doc-hints.md +33 -0
  7. package/editing-history/2026-0304-1645-calcit-eq-contract-refactor-and-macro-tests.md +28 -0
  8. package/editing-history/2026-0304-2200-assert-type-assert-traits-composable-runtime-checks.md +18 -0
  9. package/editing-history/2026-0304-generics-fn-typevar-identity.md +30 -0
  10. package/editing-history/2026-0305-0042-type-inference-argtypes-and-core-hints.md +54 -0
  11. package/editing-history/2026-0305-0115-calcit-core-generic-refinements.md +57 -0
  12. package/editing-history/2026-0305-1930-schema-migration-cr-edit.md +30 -0
  13. package/editing-history/2026-0305-1939-query-schema-adaptation.md +42 -0
  14. package/editing-history/2026-0306-0120-schema-hint-migration-batch.md +38 -0
  15. package/editing-history/2026-0306-1416-core-macro-schema-migration.md +20 -0
  16. package/editing-history/2026-0306-1552-core-schema-and-hintfn-migration.md +63 -0
  17. package/editing-history/2026-0306-1936-schema-normalization-and-preprocess-preload.md +12 -0
  18. package/editing-history/2026-0307-0142-unit-type-and-builtin-schemas.md +82 -0
  19. package/editing-history/2026-0307-1302-calcit-agent-docs-update.md +32 -0
  20. package/editing-history/2026-0307-1652-decouple-snapshot-schema-to-calcit-type.md +112 -0
  21. package/editing-history/2026-0307-1821-snapshot-schema-validation.md +6 -0
  22. package/editing-history/2026-0307-1959-schema-def-kind-arity-validation.md +96 -0
  23. package/editing-history/2026-0307-migrate-hint-fn-to-schema.md +29 -0
  24. package/editing-history/2026-0307-remove-enum-prototype-field.md +43 -0
  25. package/editing-history/2026-0307-schema-args-type-enforcement.md +66 -0
  26. package/editing-history/2026-0308-0031-schema-generics-quote-normalization.md +35 -0
  27. package/editing-history/2026-0308-1905-schema-typeref-and-assert-migration.md +34 -0
  28. package/editing-history/2026-0308-2033-schema-wrapper-migration.md +45 -0
  29. package/editing-history/2026-0308-2315-late-schema-cleanup-and-warning-compat.md +27 -0
  30. package/lib/calcit-data.mjs +6 -0
  31. package/lib/calcit.procs.mjs +3 -1
  32. package/lib/package.json +2 -2
  33. package/package.json +2 -2
  34. package/ts-src/calcit-data.mts +6 -0
  35. package/ts-src/calcit.procs.mts +3 -1
@@ -0,0 +1,45 @@
1
+ # 2026-03-08 schema wrapper migration
2
+
3
+ ## Summary
4
+
5
+ - 统一函数 schema 的 snapshot 输出格式,顶层改为 wrapped `:: :fn` / `:: :macro` 形式。
6
+ - 修复 schema round-trip 中的类型信息丢失,确保嵌套函数类型与 `:rest` 在格式化后保持稳定。
7
+ - 将 macro schema 的顶层格式统一迁移到 `:: :macro`,并让 formatter 在处理 `defmacro` 条目时自动纠正旧的 `fn` 标记。
8
+ - 移除 legacy quote-wrapped schema normalization 与 legacy positional `fn` type annotation fallback,收紧到当前 schema-map 形式。
9
+ - 更新 `deftrait` 文档与相关说明,避免继续传播旧写法。
10
+
11
+ ## Main changes
12
+
13
+ ### 1) 顶层 schema 输出统一
14
+
15
+ - 在 `src/calcit/type_annotation.rs` 中补充顶层 wrapped schema 的解析与序列化逻辑。
16
+ - 在 `src/snapshot.rs` 中让 `CodeEntry.schema` 写回 snapshot 时统一输出为 `:schema $ :: :fn ...` 或 `:schema $ :: :macro ...`。
17
+ - 对 plain fn schema 去掉 wrapped payload 内冗余的 `:kind :fn`,但保留宏函数所需的 `:kind :macro`。
18
+
19
+ ### 2) macro schema 迁移与规范化
20
+
21
+ - 扩展 parser / normalize 逻辑,使其同时接受 wrapped `fn` 与 wrapped `macro`。
22
+ - 对 macro schema,序列化时省略冗余的 `:kind :macro` 与 `:return`,仅保留 `:args` 与可选 `:rest`。
23
+ - 在 snapshot 读写路径中,根据代码头是否为 `defmacro` 自动纠正 schema kind。
24
+
25
+ ### 3) legacy fn syntax 收紧
26
+
27
+ - 移除 legacy quote-wrapped schema normalization。
28
+ - 拒绝 legacy quoted generic symbols。
29
+ - 移除 legacy positional `fn` type annotation parsing fallback。
30
+ - 迁移剩余 core trait 与测试注解到 schema-map `:: :fn {}` 形式。
31
+
32
+ ### 4) round-trip 与批量格式化
33
+
34
+ - 修复 EDN 到 Calcit 的转换路径,补上 `Edn::Map` 的处理,避免嵌套 `fn` schema 的 hashmap payload 被吞掉后退化成 `:dynamic`。
35
+ - 调整 schema 校验与 normalize 逻辑,使 wrapped 顶层 fn schema 与旧格式都能稳定读写。
36
+ - 重新格式化了 `src/cirru/calcit-core.cirru`、`calcit/util.cirru`、`calcit/test-hygienic.cirru` 等兼容 snapshot 文件。
37
+
38
+ ## Validation
39
+
40
+ - `cargo fmt`
41
+ - `cargo clippy -- -D warnings`
42
+ - `yarn compile`
43
+ - `cargo test -q`
44
+ - `cargo build -q`
45
+ - `yarn check-all`
@@ -0,0 +1,27 @@
1
+ # 2026-03-08 late schema cleanup and warning compatibility
2
+
3
+ ## Summary
4
+
5
+ - made snapshot schema loading strict for non-nil schemas, so malformed schema data no longer silently degrades to dynamic
6
+ - normalized loaded schema maps so legacy string keys and string `:kind` values are converted into canonical tag-based schema maps
7
+ - restored generic type variables in `src/cirru/calcit-core.cirru` where a previous migration had incorrectly replaced them with `:symbol`
8
+ - cleaned the remaining mistaken `:symbol` placeholders in core collection schemas, keeping only the intentional `symbol?` runtime type check
9
+ - fixed `calcit/test-generics.cirru` after a schema-formatting edit moved `assert-type id ...` into the `let` binding section
10
+ - kept `ns/def` warning location reporting for embedded core snapshot loading
11
+ - stopped legacy fn-schema warnings from firing on malformed nested `:: :fn` schema payloads parsed from `calcit-core.cirru`
12
+ - used a conservative fallback to `DynFn` for malformed nested payloads, avoiding false-positive callback type warnings without re-editing Cirru syntax
13
+
14
+ ## Notes
15
+
16
+ - `yarn check-all` passed after the generic-schema restoration and remaining `:symbol` cleanup passes
17
+ - the `test-generics` fix resolves the runtime error `expected binding of a pair`
18
+ - nested function schema payloads coming from Cirru snapshot EDN may currently collapse into malformed map payloads like `(:: :fn ({} (nil ...)))` or `(:: :fn ({}))`
19
+ - those malformed payloads are lossy, so partially reconstructing arg/return types can introduce new static-analysis warnings
20
+ - decoding the embedded binary core snapshot with per-entry owners is necessary to preserve precise warning locations such as `calcit.core/foo`
21
+
22
+ ## Validation
23
+
24
+ - `cargo test -q malformed_nested_fn_schema`
25
+ - `cargo build -q`
26
+ - `target/debug/cr calcit/test.cirru -1`
27
+ - `yarn check-all`
@@ -146,6 +146,12 @@ export let castTag = (x) => {
146
146
  if (x instanceof CalcitSymbol) {
147
147
  return newTag(x.value);
148
148
  }
149
+ if (typeof x === "function") {
150
+ const methodName = x.__calcitMethodName;
151
+ if (typeof methodName === "string") {
152
+ return newTag(methodName);
153
+ }
154
+ }
149
155
  throw new Error(`Cannot cast this to tag: ${x}`);
150
156
  };
151
157
  export var refsRegistry = new Map();
@@ -1584,9 +1584,11 @@ export let register_calcit_builtin_impls = (options) => {
1584
1584
  };
1585
1585
  /** method used as closure */
1586
1586
  export function invoke_method_closure(p) {
1587
- return (obj, ...args) => {
1587
+ const f = (obj, ...args) => {
1588
1588
  return invoke_method(p, obj, ...args);
1589
1589
  };
1590
+ f.__calcitMethodName = p;
1591
+ return f;
1590
1592
  }
1591
1593
  function normalize_builtin_impls(entry) {
1592
1594
  if (entry == null)
package/lib/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.11.7",
3
+ "version": "0.12.0",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.0.9",
7
7
  "typescript": "^5.9.3"
8
8
  },
9
9
  "scripts": {
10
- "compile": "rm -rfv lib/* && tsc",
10
+ "compile": "rm -rf lib && tsc",
11
11
  "procs-link": "ln -sfn ../../ node_modules/@calcit/procs",
12
12
  "cp-mac": "cargo build --release && rm -rfv builds/* && node scripts/cp-version.js && scp builds/* rsync-user@calcit-lang.org:/web-assets/repo/calcit-lang/binaries/macos/",
13
13
  "eval": "cargo run --bin cr -- eval",
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.11.7",
3
+ "version": "0.12.0",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.0.9",
7
7
  "typescript": "^5.9.3"
8
8
  },
9
9
  "scripts": {
10
- "compile": "rm -rfv lib/* && tsc",
10
+ "compile": "rm -rf lib && tsc",
11
11
  "procs-link": "ln -sfn ../../ node_modules/@calcit/procs",
12
12
  "cp-mac": "cargo build --release && rm -rfv builds/* && node scripts/cp-version.js && scp builds/* rsync-user@calcit-lang.org:/web-assets/repo/calcit-lang/binaries/macos/",
13
13
  "eval": "cargo run --bin cr -- eval",
@@ -168,6 +168,12 @@ export let castTag = (x: CalcitValue): CalcitTag => {
168
168
  if (x instanceof CalcitSymbol) {
169
169
  return newTag(x.value);
170
170
  }
171
+ if (typeof x === "function") {
172
+ const methodName = (x as { __calcitMethodName?: unknown }).__calcitMethodName;
173
+ if (typeof methodName === "string") {
174
+ return newTag(methodName);
175
+ }
176
+ }
171
177
  throw new Error(`Cannot cast this to tag: ${x}`);
172
178
  };
173
179
 
@@ -1714,9 +1714,11 @@ export let register_calcit_builtin_impls = (options: typeof calcit_builtin_impls
1714
1714
 
1715
1715
  /** method used as closure */
1716
1716
  export function invoke_method_closure(p: string) {
1717
- return (obj: CalcitValue, ...args: CalcitValue[]) => {
1717
+ const f = (obj: CalcitValue, ...args: CalcitValue[]) => {
1718
1718
  return invoke_method(p, obj, ...args);
1719
1719
  };
1720
+ (f as { __calcitMethodName?: string }).__calcitMethodName = p;
1721
+ return f;
1720
1722
  }
1721
1723
 
1722
1724
  function normalize_builtin_impls(entry: CalcitImplEntry): CalcitImpl[] | null {