@calcit/procs 0.13.2 → 0.13.4
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/08-08-cross-backend-host-ffi-contracts-rfc.md +584 -0
- package/RFCs/README.md +2 -1
- package/build.rs +24 -23
- package/editing-history/20260807-1030-doc-struct-enum-rename-followup.md +9 -0
- package/editing-history/20260807-1130-rename-record-tuple-doc-files.md +6 -0
- package/editing-history/20260807-1200-rename-record-tuple-test-and-rust.md +41 -0
- package/editing-history/202608071809-preserve-targeted-schema-edits.md +11 -0
- package/editing-history/202608071848-static-method-generic-validation.md +5 -0
- package/editing-history/20260808-0913-continue-struct-naming-cleanup.md +21 -0
- package/editing-history/20260808-0917-struct-enum-terminology-cleanup.md +17 -0
- package/editing-history/20260808-0926-deprecated-record-api-analysis.md +16 -0
- package/editing-history/20260808-0939-pr-review-ci-remediation.md +10 -0
- package/editing-history/20260808-0959-canonical-edn-fixture-expectations.md +10 -0
- package/editing-history/20260808-1004-align-js-canonical-edn-format.md +10 -0
- package/editing-history/20260808-1008-deprecated-analysis-review-fixes.md +10 -0
- package/editing-history/20260808-1012-document-deprecated-api-cleanup.md +7 -0
- package/editing-history/20260808-1020-release-0.13.3.md +7 -0
- package/editing-history/20260808-1117-option-result-method-api.md +7 -0
- package/editing-history/20260808-1126-format-cirru-snapshots.md +6 -0
- package/editing-history/20260808-1300-record-tuple-naming-cleanup.md +62 -0
- package/editing-history/20260808-1418-cross-backend-host-ffi-contract-rfc.md +7 -0
- package/editing-history/20260808-1439-host-ffi-type-foundation.md +7 -0
- package/editing-history/20260808-1523-ffi-schema-redesign-and-cirru-edn-check.md +7 -0
- package/editing-history/20260808-1532-external-object-trait-refinement.md +6 -0
- package/editing-history/20260808-1632-host-ffi.md +6 -0
- package/editing-history/20260808-1734-pr-review-ffi-followups.md +7 -0
- package/editing-history/20260808-1745-es-module-typed-adapters.md +6 -0
- package/editing-history/20260808-1817-release-0.13.4.md +4 -0
- package/editing-history/202608080132-pr-309-review-fixes.md +5 -0
- package/editing-history/202608080202-js-example-checks.md +5 -0
- package/editing-history/202608080206-quote-shell-special-example.md +4 -0
- package/editing-history/202608080854-edn-0.8-integration.md +6 -0
- package/history/202608062004-wasm-ffi-declarations.md +7 -0
- package/history/202608071500-wasm-ffi-review-fixes.md +6 -0
- package/lib/js-cirru.mjs +8 -8
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/ts-src/js-cirru.mts +8 -8
package/build.rs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
use cirru_edn::{Edn, EdnMapView,
|
|
1
|
+
use cirru_edn::{Edn, EdnMapView, EdnStructView, from_edn};
|
|
2
2
|
use cirru_parser::Cirru;
|
|
3
3
|
use serde::{Deserialize, Serialize};
|
|
4
4
|
use std::collections::HashMap;
|
|
@@ -258,10 +258,7 @@ fn parse_schema_from_edn(value: &Edn, owner: &str) -> Result<Edn, String> {
|
|
|
258
258
|
validate_schema_edn_no_legacy_quotes(&normalized, owner)?;
|
|
259
259
|
return Ok(normalized);
|
|
260
260
|
}
|
|
261
|
-
Edn::
|
|
262
|
-
if matches!(view.tag.as_ref(), Edn::Tag(tag) if matches!(tag.ref_str(), "fn" | "macro"))
|
|
263
|
-
&& matches!(view.extra.first(), Some(Edn::Map(_))) =>
|
|
264
|
-
{
|
|
261
|
+
Edn::Enum(view) if matches!(view.variant.as_ref(), "fn" | "macro") && matches!(view.extra.first(), Some(Edn::Map(_))) => {
|
|
265
262
|
let Some(Edn::Map(map)) = view.extra.first() else {
|
|
266
263
|
unreachable!();
|
|
267
264
|
};
|
|
@@ -269,7 +266,7 @@ fn parse_schema_from_edn(value: &Edn, owner: &str) -> Result<Edn, String> {
|
|
|
269
266
|
Edn::Map(map) => map,
|
|
270
267
|
_ => unreachable!(),
|
|
271
268
|
};
|
|
272
|
-
if normalized.tag_get("kind").is_none() &&
|
|
269
|
+
if normalized.tag_get("kind").is_none() && view.variant.as_ref() == "macro" {
|
|
273
270
|
normalized.insert_key("kind", Edn::tag("macro"));
|
|
274
271
|
}
|
|
275
272
|
let normalized = Edn::Map(normalized);
|
|
@@ -326,10 +323,14 @@ fn validate_schema_edn_no_legacy_quotes(value: &Edn, owner: &str) -> Result<(),
|
|
|
326
323
|
}
|
|
327
324
|
Ok(())
|
|
328
325
|
}
|
|
329
|
-
Edn::
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
326
|
+
Edn::Enum(view) => {
|
|
327
|
+
if view.variant.starts_with('\'') {
|
|
328
|
+
return Err(format!(
|
|
329
|
+
"{owner}: invalid schema enum symbol `{}` at {}",
|
|
330
|
+
view.variant,
|
|
331
|
+
schema_path_label(path)
|
|
332
|
+
));
|
|
333
|
+
}
|
|
333
334
|
for (idx, item) in view.extra.iter().enumerate() {
|
|
334
335
|
path.push(format!("[{idx}]"));
|
|
335
336
|
walk(item, owner, path)?;
|
|
@@ -345,7 +346,7 @@ fn validate_schema_edn_no_legacy_quotes(value: &Edn, owner: &str) -> Result<(),
|
|
|
345
346
|
}
|
|
346
347
|
Ok(())
|
|
347
348
|
}
|
|
348
|
-
Edn::
|
|
349
|
+
Edn::Struct(_) => Ok(()),
|
|
349
350
|
_ => Ok(()),
|
|
350
351
|
}
|
|
351
352
|
}
|
|
@@ -381,16 +382,16 @@ fn parse_tags_from_edn(value: &Edn, owner: &str) -> Result<Vec<String>, String>
|
|
|
381
382
|
}
|
|
382
383
|
|
|
383
384
|
fn parse_code_entry(edn: Edn, owner: &str) -> Result<CodeEntry, String> {
|
|
384
|
-
let
|
|
385
|
-
Edn::
|
|
386
|
-
other => return Err(format!("{owner}: expected CodeEntry
|
|
385
|
+
let struct_value: EdnStructView = match edn {
|
|
386
|
+
Edn::Struct(r) => r,
|
|
387
|
+
other => return Err(format!("{owner}: expected CodeEntry struct, got {}", format_edn_preview(&other))),
|
|
387
388
|
};
|
|
388
389
|
let mut doc = String::new();
|
|
389
390
|
let mut examples: Vec<Cirru> = vec![];
|
|
390
391
|
let mut tags: Vec<String> = Vec::new();
|
|
391
392
|
let mut code: Option<Cirru> = None;
|
|
392
393
|
let mut schema: Option<Edn> = None;
|
|
393
|
-
for (key, value) in &
|
|
394
|
+
for (key, value) in &struct_value.pairs {
|
|
394
395
|
match key.arc_str().as_ref() {
|
|
395
396
|
"doc" => doc = from_edn(value.clone()).map_err(|e| format!("{owner}: invalid `:doc`: {e}"))?,
|
|
396
397
|
"examples" => examples = from_edn(value.clone()).map_err(|e| format!("{owner}: invalid `:examples`: {e}"))?,
|
|
@@ -412,18 +413,18 @@ fn parse_code_entry(edn: Edn, owner: &str) -> Result<CodeEntry, String> {
|
|
|
412
413
|
}
|
|
413
414
|
|
|
414
415
|
fn parse_ns_entry(edn: Edn, owner: &str) -> Result<NsEntry, String> {
|
|
415
|
-
let
|
|
416
|
-
Edn::
|
|
416
|
+
let struct_value: EdnStructView = match edn {
|
|
417
|
+
Edn::Struct(r) => r,
|
|
417
418
|
other => {
|
|
418
419
|
return Err(format!(
|
|
419
|
-
"{owner}: expected NsEntry/CodeEntry
|
|
420
|
+
"{owner}: expected NsEntry/CodeEntry struct, got {}",
|
|
420
421
|
format_edn_preview(&other)
|
|
421
422
|
));
|
|
422
423
|
}
|
|
423
424
|
};
|
|
424
425
|
let mut doc = String::new();
|
|
425
426
|
let mut code: Option<Cirru> = None;
|
|
426
|
-
for (key, value) in &
|
|
427
|
+
for (key, value) in &struct_value.pairs {
|
|
427
428
|
match key.arc_str().as_ref() {
|
|
428
429
|
"doc" => doc = from_edn(value.clone()).map_err(|e| format!("{owner}: invalid `:doc`: {e}"))?,
|
|
429
430
|
"code" => code = Some(from_edn(value.clone()).map_err(|e| format!("{owner}: invalid `:code`: {e}"))?),
|
|
@@ -437,18 +438,18 @@ fn parse_ns_entry(edn: Edn, owner: &str) -> Result<NsEntry, String> {
|
|
|
437
438
|
}
|
|
438
439
|
|
|
439
440
|
fn parse_file_in_snapshot(edn: Edn, file_name: &str) -> Result<FileInSnapShot, String> {
|
|
440
|
-
let
|
|
441
|
-
Edn::
|
|
441
|
+
let struct_value: EdnStructView = match edn {
|
|
442
|
+
Edn::Struct(r) => r,
|
|
442
443
|
other => {
|
|
443
444
|
return Err(format!(
|
|
444
|
-
"{file_name}: expected FileEntry
|
|
445
|
+
"{file_name}: expected FileEntry struct, got {}",
|
|
445
446
|
format_edn_preview(&other)
|
|
446
447
|
));
|
|
447
448
|
}
|
|
448
449
|
};
|
|
449
450
|
let mut ns: Option<NsEntry> = None;
|
|
450
451
|
let mut defs: HashMap<String, CodeEntry> = HashMap::new();
|
|
451
|
-
for (key, value) in &
|
|
452
|
+
for (key, value) in &struct_value.pairs {
|
|
452
453
|
match key.arc_str().as_ref() {
|
|
453
454
|
"ns" => ns = Some(parse_ns_entry(value.clone(), &format!("{file_name}/:ns"))?),
|
|
454
455
|
"defs" => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Struct / Enum 数据模型文档跟进清理
|
|
2
|
+
|
|
3
|
+
- 同步文档措辞:`tuple` / `record` 术语已迁移为 `enum` / `struct`,将仍然把当前数据模型描述为旧名的 4 处表述更新为 struct/enum 语义。
|
|
4
|
+
- `docs/features/polymorphism.md`:`records/tuples created from them` → `struct/enum values created from them`。
|
|
5
|
+
- `docs/docs-indexing.md`:category registry 中 `records, tuples, enums` → `structs, enums`。
|
|
6
|
+
- `docs/data/edn.md`:严格 EDN 解码不把 `ordinary tuples` 强转成 enum → `ordinary lists`,避免与已移除的 tuple 类型混淆。
|
|
7
|
+
- `docs/features/structs.md`(原 `records.md`):匿名 struct 字段排序说明 `struct-backed records` → `named structs` 的字段顺序。
|
|
8
|
+
- 保留的合法旧名引用:迁移表(`anonymous-enums.md`、`upgrade.md`)、frontmatter alias / 旧文件名链接(`structs.md`、`anonymous-enums.md`)、`impl records`(trait 概念)、`namespace records`(快照条目)等不属于数据模型旧名。
|
|
9
|
+
- 验证:`cr docs check-md <file> --entry calcit/test.cirru` 结果与改动前一致(structs.md 的 11 个失败均为匿名 `%{} _` 示例在 eval 上下文无法运行的既有问题,与本次改动无关)。
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Struct / Enum 数据模型文档文件重命名
|
|
2
|
+
|
|
3
|
+
- 将文档文件名与新的 struct/enum 模型对齐:`docs/features/records.md` → `docs/features/structs.md`,`docs/features/tuples.md` → `docs/features/anonymous-enums.md`。
|
|
4
|
+
- 同步 frontmatter id:`core/features/records` → `core/features/structs`,`core/features/tuples` → `core/features/anonymous-enums`;保留旧 alias("record type"、"legacy tuple migration")以维持文档检索兼容。
|
|
5
|
+
- 更新所有交叉链接:`docs/features.md`(`leads_to` 与 Domain modeling 链接)、`docs/features/enums.md`(See Also)、`docs/features/anonymous-enums.md`(See Also)、`docs/run/agent-advanced.md`(Anonymous Enum vs List 链接)。
|
|
6
|
+
- 验证:终端 grep 确认 `docs/` 下无残留 `records.md` / `tuples.md` / 旧 id;`git status` 显示 `RM` 重命名记录。RFC 为历史提案,保持原样。
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Struct / Enum 命名全量对齐(测试夹具 + Rust 模块)
|
|
2
|
+
|
|
3
|
+
延续 data model v2,把代码库中遗留的 `record`/`tuple` 命名统一迁移到 `struct`/`enum`,分两层完成:
|
|
4
|
+
|
|
5
|
+
## A 级:测试夹具文件与引用
|
|
6
|
+
|
|
7
|
+
- `calcit/test-record.cirru` → `calcit/test-struct.cirru`(namespace `test-record.main` → `test-struct.main`,package/FileEntry/init-fn/reload-fn/schema args/ns 声明全部同步;内部 def 同步改名:`test-record-with`→`test-struct-with`、`test-partial-record`→`test-partial-struct`、`test-loose-record-rewrite`→`test-loose-struct-rewrite`、`test-map-to-record`→`test-map-to-struct`)。
|
|
8
|
+
- `calcit/test-tuple.cirru` → `calcit/test-anonymous-enum.cirru`(namespace `test-tuple.main` → `test-anonymous-enum.main`;因已有 `test-enum.cirru`,采用与文档 `anonymous-enums.md` 平行的命名;该文件测试 anonymous enum + destruct 操作)。
|
|
9
|
+
- 更新全部引用:`calcit/test.cirru`(模块列表/requires/入口/CodeEntry key)、`calcit/test-wasm-suite.cirru`、`src/bin/cli_handlers/query.rs`(`test-record.main`→`test-struct.main`)、`scripts/check-agent-interface.mjs`、`scripts/test-wasm-suite.sh`、`scripts/test-wasm-suite-extended.sh`、`docs/run/query.md`。
|
|
10
|
+
- 其他测试文件中的内部 def 名同步:`test-record-methods`→`test-struct-methods`(test-types.cirru + `.calcit/cursor.cirru`)、`test-tuple-impl-precedence-order`→`test-enum-impl-precedence-order`(test-traits.cirru)、`test-tuple-to-enum`→`test-anonymous-enum-to-named`(test-enum.cirru)、`test-record-inference`→`test-struct-inference`(test-types-inference.cirru)。
|
|
11
|
+
- **保留**:`test-wasm.cirru` / `scripts/test-wasm.mjs` 未动——该文件是 legacy 兼容测试(仍用 `defrecord`、`tuple-enum`、`:tuple` tag),内部 `test-record-*`/`test-tuple-*` 名称与其 legacy 语义一致。
|
|
12
|
+
|
|
13
|
+
## B 级:Rust 内部模块与函数命名
|
|
14
|
+
|
|
15
|
+
- 模块文件重命名 + mod 声明 + 路径引用:
|
|
16
|
+
- `src/calcit/record.rs` → `src/calcit/struct_value.rs`(`mod record`→`mod struct_value`;`record::` → `struct_value::`)
|
|
17
|
+
- `src/calcit/tuple.rs` → `src/calcit/enum_value.rs`(`mod tuple`→`mod enum_value`)
|
|
18
|
+
- `src/builtins/records.rs` → `src/builtins/structs.rs`(`mod records`→`mod structs`;`records::` → `structs::`,含 builtins.rs 分发与 type_inference.rs)
|
|
19
|
+
- `src/codegen/emit_wasm/records.rs` → `src/codegen/emit_wasm/structs.rs`(含 `#[path = "emit_wasm/structs.rs"]` 修正)
|
|
20
|
+
- `src/calcit/sum_type.rs` 保留("sum type" 是 enum 的合法名称,无 legacy 措辞)。
|
|
21
|
+
- 模块内 legacy 函数名迁移(含 call sites):`call_record*`→`call_struct*`、`record_with`→`struct_with`、`record_nth`→`struct_nth`、`record_field_tag`→`struct_field_tag`、`record_assoc_at`→`struct_assoc_at`、`record_with_at`→`struct_with_at`、`record_from_map`→`struct_from_map`、`get_record_name`→`get_struct_name`、`get_record_struct`→`get_struct_def`;WASM emitter:`emit_record*`→`emit_struct*`、`emit_tuple*`→`emit_enum*`、`emit_enum_tuple_new`→`emit_named_enum_new`、`emit_tuple_*_from_local`→`emit_enum_*_from_local`。
|
|
22
|
+
|
|
23
|
+
## 有意保留(B 级深层内部,附理由)
|
|
24
|
+
|
|
25
|
+
- `NativeRecord*` / `NativeTuple*` 内部分发枚举变体:存在命名冲突(`NativeRecordImplTraits` 与已存在的 `NativeStructImplTraits` 并存且分发不同函数),且部分新名已存在,盲改不安全;为兼容性代码库有意保留新旧两套。
|
|
26
|
+
- 局部变量 `record`/`tuple`(约 700+):大量出现在外部 `Edn::Record`/`Edn::Tuple`(cirru_edn crate)上下文——那是 EDN 自己的 Record/Tuple 语义,改名为 struct/enum 反而错误;其余为内部局部绑定,纯外观、零用户价值、改动面大。
|
|
27
|
+
- 注释与诊断字符串中的措辞、RFC/editing-history 历史记录。
|
|
28
|
+
|
|
29
|
+
## 验证
|
|
30
|
+
|
|
31
|
+
- `cargo test` 全绿(360 + 2 + 180,0 失败);`cargo clippy --lib -- -D warnings` 通过。
|
|
32
|
+
- `cargo clippy --all-targets -- -D warnings` 在 `src/bin/calcit_deps.rs` 报 `items after a test module`——该文件未改动,属分支既有问题。
|
|
33
|
+
- `check-agent-interface` 12 项场景全过(`test-struct.main` 解析正常);WASM codegen 与 `test-wasm-suite` 通过。
|
|
34
|
+
- 已知既有问题(与本次无关):`try-rs`(`cr calcit/test.cirru`)在 `test-generics` 栈溢出,clean worktree 亦复现。
|
|
35
|
+
|
|
36
|
+
## 后续安全术语迁移
|
|
37
|
+
|
|
38
|
+
- `src/calcit/data_patch.rs`、`src/calcit/data_shape.rs`:将 `Calcit::Struct(record)` / `Calcit::Enum(tuple)` 的内部绑定改为 `struct_value` / `enum_value`,并将仅面向当前数据模型的诊断与测试断言改为 struct/enum。
|
|
39
|
+
- `src/call_tree.rs`:枚举 payload 递归遍历绑定改为 `enum_value`。
|
|
40
|
+
- `src/data/edn_decode.rs`:EDN 解码测试中的 Calcit struct/enum 解构绑定和断言改为新术语;`CalcitEnumDef::from_record` 保持不动,因为它明确承载旧 enum-definition schema 的兼容转换。
|
|
41
|
+
- 以上四个切片分别通过 `data_patch::tests`(4/4)、`data_shape::tests`(6/6)、`call_tree`(1/1)和 `edn_decode::tests`(7/7)。文档检索后仅余迁移表与兼容说明,未发现需改写的当前模型表述。
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Preserve targeted schema edits
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
- `cr edit schema` now updates the selected `CodeEntry` schema through the original EDN snapshot tree instead of re-rendering the entire typed `Snapshot`.
|
|
6
|
+
- Unrelated schema fields, including legacy `:optional` and `:any` forms, remain unchanged by targeted schema updates and clears.
|
|
7
|
+
|
|
8
|
+
## Validation
|
|
9
|
+
|
|
10
|
+
- Added a regression fixture covering both schema update and clear operations, preserving an unrelated legacy function schema and the snapshot shebang.
|
|
11
|
+
- Verified with the full Rust test suite, strict Clippy, `yarn compile`, and `yarn check-agent-interface`.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Static Method Generic Validation
|
|
2
|
+
|
|
3
|
+
- Postfix method rewrites now preprocess their receiver and arguments before static method validation and code generation.
|
|
4
|
+
- Static implementation methods use their declared schemas, binding generic variables from the receiver before validating other arguments.
|
|
5
|
+
- Added regressions for `Option<String>.unwrap-or Number` and an inline anonymous callback passed to `Option.map`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 继续清理 Struct 命名
|
|
2
|
+
|
|
3
|
+
延续 data model v2 的术语迁移,继续移除当前 Calcit 代码路径中把 `Struct` 称作 `record` 的内部绑定、诊断和测试表述。
|
|
4
|
+
|
|
5
|
+
## 本次改动
|
|
6
|
+
|
|
7
|
+
- EDN 解码、详细快照、构建脚本和运行时快照读取中的 `Edn::Struct` 局部绑定统一为 `struct_value`。
|
|
8
|
+
- 当前 Struct/Enum 诊断、WASM/JS codegen 文案和 CLI 查询提示统一使用 `struct` / `enum`。
|
|
9
|
+
- `CalcitEnumDef` 从 Struct 原型收集 variant 的内部参数、Struct map 转换和编辑器 EDN 修改辅助函数同步改名。
|
|
10
|
+
- Struct 文档别名和类型注释同步更新。
|
|
11
|
+
- 保留旧 API 名称、旧 schema 关键字、`Record(...)` 调试输入以及 `test-wasm.cirru` 等明确的兼容测试内容。
|
|
12
|
+
|
|
13
|
+
## 验证
|
|
14
|
+
|
|
15
|
+
- `cargo fmt --check`
|
|
16
|
+
- `cargo check --all-targets`
|
|
17
|
+
- `cargo clippy --lib -- -D warnings`
|
|
18
|
+
- `cargo test data::edn::tests`(5 项)
|
|
19
|
+
- `cargo test data::edn_decode::tests`(7 项)
|
|
20
|
+
|
|
21
|
+
`cargo test snapshot::tests` 中已有的 `test_save_snapshot_round_trip_keeps_real_world_schema_markers` 仍失败于保存内容断言;本次仅修改绑定名和诊断文本,未改变快照格式逻辑。
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Struct and Enum terminology cleanup
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
- Renamed current Struct and Enum locals in trait fixtures to `struct_value` and `enum_value`.
|
|
6
|
+
- Updated active test comments, method inspection tags, type-failure documentation, and WASM validation labels to use Struct/Enum terminology.
|
|
7
|
+
- Renamed the `struct-with` macro parameter and Struct implementation validation locals in the current preprocessing path.
|
|
8
|
+
- Updated the agent interface diagnostic to describe source-backed struct methods.
|
|
9
|
+
|
|
10
|
+
## Compatibility retained
|
|
11
|
+
|
|
12
|
+
- Legacy `record` and `tuple` API spellings, migration diagnostics, historical test namespaces, and explicit WASM/type-failure fixture names remain unchanged.
|
|
13
|
+
|
|
14
|
+
## Validation
|
|
15
|
+
|
|
16
|
+
- `cargo check --all-targets`
|
|
17
|
+
- `cargo test runner::preprocess::tests --lib` (72 passed)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Deprecated record API analysis
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
- Marked the retained `record-match`, `record-struct`, `record-with`, and `record?` compatibility APIs in `calcit.core` with `:deprecated` tags.
|
|
6
|
+
- Updated each API document to name its Struct-model replacement.
|
|
7
|
+
- Added `cr analyze deprecated`, a tag-driven static report that finds calls to any `:deprecated` definition and reports the calling definition, `code@...` path, target documentation, and JSON `W_DEPRECATED_API` diagnostic.
|
|
8
|
+
- Added a focused regression test for implicit `calcit.core/record?` call detection.
|
|
9
|
+
|
|
10
|
+
## Validation
|
|
11
|
+
|
|
12
|
+
- `cargo test --bin cr deprecated_api::tests::finds_implicit_core_deprecated_call_at_body_path`
|
|
13
|
+
- `cargo check --all-targets`
|
|
14
|
+
- `cargo fmt --check`
|
|
15
|
+
- `git diff --check`
|
|
16
|
+
- Manual temporary Snapshot validation: `record?` produced one `calcit.core/record?` report at `code@3` and `W_DEPRECATED_API`.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# PR Review 与 CI 修复
|
|
2
|
+
|
|
3
|
+
针对 record/tuple 到 struct/enum 迁移 PR 的 review 与 CI 失败做最小修复:
|
|
4
|
+
|
|
5
|
+
- Snapshot round-trip 测试改为断言 canonical 的 `'CodeEntry` 输出,保留 Fn/Macro schema 验证。
|
|
6
|
+
- `dump_code` 的运行时 enum/struct 值 metadata `:kind` 恢复为兼容的 `:tuple`/`:record`;定义 metadata 继续使用 `:enum`/`:struct`。
|
|
7
|
+
- 修正 enum、struct 与 WASM 布局的遗留文案和注释偏移量。
|
|
8
|
+
- 修复此前迁移记录中分裂的 Markdown code span。
|
|
9
|
+
|
|
10
|
+
验证:snapshot 精确测试、`cargo test --lib`、`cargo fmt --check`、`cargo clippy -- -D warnings`。
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Canonical EDN Fixture Expectations
|
|
2
|
+
|
|
3
|
+
修复 PR CI 的 Cirru integration suite:Snapshot canonicalization 后,部分旧 golden
|
|
4
|
+
expectation 仍把 enum/struct discriminator 或 nominal name 写为 tags。
|
|
5
|
+
|
|
6
|
+
- `format-cirru-edn` 对 enum discriminator、typed enum name/variant 和 struct nominal name
|
|
7
|
+
输出 symbol quote;相应 fixture 改为 canonical 格式。
|
|
8
|
+
- `&get-def-schema` 返回 `:Fn` tag discriminator;definition metadata fixture 同步断言该值。
|
|
9
|
+
|
|
10
|
+
验证:`cargo test --bin cr cr_cirru_suite_tests::cirru_test_suite`。
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Align JS Canonical EDN Format
|
|
2
|
+
|
|
3
|
+
`cirru_edn 0.8` 在 Rust 端将 enum discriminator、typed enum name/variant 和
|
|
4
|
+
nominal struct name 规范化输出为 symbol quote。JS runtime 原先保留 `:` tag 写法,
|
|
5
|
+
导致同一套 Cirru EDN fixture 在 native 与 JS 后端产生不同结果。
|
|
6
|
+
|
|
7
|
+
调整 `ts-src/js-cirru.mts`:仅在 struct/enum EDN shape header 中通过
|
|
8
|
+
`CalcitSymbol` 输出这些结构标识符;普通 payload tags 仍保持原有 tag 格式。
|
|
9
|
+
|
|
10
|
+
验证:`yarn tsc`、`yarn try-js`、`cargo test`。
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Deprecated Analysis Review Fixes
|
|
2
|
+
|
|
3
|
+
处理 record/tuple 迁移 PR 的未 resolve review:
|
|
4
|
+
|
|
5
|
+
- `analyze deprecated` 解析未限定 symbol 时先检查本地 namespace definition,避免 local `record?` shadowing 被误报为 `calcit.core/record?`。
|
|
6
|
+
- 遍历 list-valued callee,避免 IIFE 中的 deprecated call 漏报。
|
|
7
|
+
- JSON envelope 复用 static-analysis 的稳定 revision 算法,满足文档化 contract。
|
|
8
|
+
- WASM enum literal 与 enum operation 错误文案统一使用 Enum 术语。
|
|
9
|
+
|
|
10
|
+
验证:`cargo test deprecated_api`、`cr analyze deprecated --format json --summary-only`、`cargo fmt --check`。
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Document Deprecated API Cleanup
|
|
2
|
+
|
|
3
|
+
在 `docs/CalcitAgent.md` 增加简短的 deprecated API 清理流程:用
|
|
4
|
+
`cr analyze deprecated` 定位调用,以 summary-only JSON 作为 migration gate,并在
|
|
5
|
+
目标范围 calls 清零前保留兼容 API 与 `:deprecated` tag。
|
|
6
|
+
|
|
7
|
+
验证:`cr docs check-md docs/CalcitAgent.md --entry calcit/test.cirru`。
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Option and Result Method API
|
|
2
|
+
|
|
3
|
+
- Classified direct `option:*` and `result:*` helpers as `:internal`; they remain compiler-lowering targets and core implementation details.
|
|
4
|
+
- Added public `Option` method entries for `.unwrap` and `.fold`, alongside the existing predicates, mapping, fallback, and chaining methods.
|
|
5
|
+
- Migrated public Option examples and lens tests to inferred postfix methods when static type evidence exists; dynamic map lookups continue to use explicit `tag-match`.
|
|
6
|
+
- Documented inferred Option/Result methods as the public API, including the JavaScript interop guide.
|
|
7
|
+
- Verified direct helpers still provide Result method dispatch; current WASM codegen cannot consume a surviving nominal Option method call, so backend-only helper coverage remains direct until preprocessing lowering is extended.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Canonical Cirru Snapshot Formatting
|
|
2
|
+
|
|
3
|
+
- Ran `cr edit format` across every repository Snapshot identified by top-level `:files` metadata.
|
|
4
|
+
- Canonicalized 57 Snapshot files, including runnable tests, debug/script fixtures, and type-fail fixtures.
|
|
5
|
+
- The serializer normalized legacy Snapshot record tags to quoted symbols while preserving program semantics.
|
|
6
|
+
- Verified formatting idempotence with a second formatter pass and ran `yarn check-all` successfully.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Record / Tuple 命名收尾清理(data model v2 术语全量对齐)
|
|
2
|
+
|
|
3
|
+
延续 data model v2 与 `20260807-1200-rename-record-tuple-test-and-rust.md` 的「后续安全术语迁移」计划,
|
|
4
|
+
把代码库中剩余的 `record`/`tuple` 措辞在**安全**的前提下统一迁移到 `struct`/`enum`。本次改动仅涉及 Rust 源码(32 个文件),文档无需再改(上次已同步)。
|
|
5
|
+
|
|
6
|
+
## 迁移内容
|
|
7
|
+
|
|
8
|
+
### 内部函数重命名(含调用点)
|
|
9
|
+
|
|
10
|
+
- `compare_record_values` → `compare_struct_values`(`src/calcit/compare.rs` + `calcit.rs`)
|
|
11
|
+
- `CalcitEnumDef::to_record_prototype` → `to_struct_prototype`(`sum_type.rs` + type_inference / type_rewriting 调用点)
|
|
12
|
+
- `infer_record_field_type/get_type/nth_type/literal_type` → `infer_struct_*`;`infer_struct_literal_type` 与新模型 `%{}` 冲突,新值字面量推断改名为 `infer_struct_value_literal_type`
|
|
13
|
+
- `check_record_field_access/update_fields/method_args` → `check_struct_*`;`check_field_in_record` → `check_field_in_struct`
|
|
14
|
+
- `check_tuple_nth_bounds` → `check_enum_nth_bounds`;`check_enum_tuple_construction` → `check_enum_construction`(`mod.rs` + `type_checking.rs` 导入与测试调用点)
|
|
15
|
+
- `resolve_record_value` → `resolve_struct_value`;`resolve_record_def` → `resolve_struct_value`(type_annotation.rs,避免与既有 `resolve_struct_def` 冲突)
|
|
16
|
+
- `collect_record_literal_values` → `collect_struct_literal_values`
|
|
17
|
+
- `is_tuple_constructor` → `is_enum_constructor`(type_inference + type_annotation)
|
|
18
|
+
- `infer_enum_tuple_annotation` → `infer_enum_annotation`;`infer_enum_tuple_applied_args` → `infer_enum_applied_args`
|
|
19
|
+
- type_rewriting.rs:`try_rewrite_map_args_to_records` → `try_rewrite_map_args_to_structs`、`try_rewrite_single_map_to_record` → `try_rewrite_single_map_to_struct`、`try_rewrite_loose_record_args_to_struct_records` → `try_rewrite_loose_struct_args_to_structs`、`try_rewrite_single_loose_record_to_struct_record` → `try_rewrite_single_loose_struct_to_struct`、`try_rewrite_tuple_args_to_enum_tuples` → `try_rewrite_enum_args_to_named_enums`、`try_rewrite_single_tuple_to_enum_tuple` → `try_rewrite_single_enum_to_named_enum`、`try_rewrite_local_fn_tuple_args_to_enum_tuples` → `try_rewrite_local_fn_enum_args_to_named_enums`
|
|
20
|
+
- builtins/meta.rs:`new_tuple` → `new_enum_value`、`new_enum_tuple_no_class` → `new_named_enum_value`、`tuple_enum` → `enum_definition`、`tuple_enum_has_variant` → `enum_def_has_variant`、`tuple_enum_variant_arity` → `enum_def_variant_arity`、`tuple_validate_enum` → `enum_validate`、`tuple_nth` → `enum_nth`、`tuple_count` → `enum_count`、`tuple_impls` → `enum_impls`、`tuple_params` → `enum_params`、`parse_enum_record` → `parse_enum_struct`(builtins.rs 分发同步)
|
|
21
|
+
- builtins/structs.rs:`checked_record_index` → `checked_struct_index`
|
|
22
|
+
- gen_ir.rs:`dump_record_code` → `dump_struct_value_code`、`record_metadata` → `struct_value_metadata`、`dump_tuple_code` → `dump_enum_value_code`、`tuple_metadata_entries` → `enum_value_metadata_entries`(与既有 `dump_struct_code`/`dump_enum_code` 错开)
|
|
23
|
+
- effects_graph.rs:`find_best_record_template` → `find_best_struct_template`、`walk_for_record_templates` → `walk_for_struct_templates`、`format_record_fields` → `format_struct_template_fields`(与既有 `format_struct_fields` 错开)、`parse_record_field_pairs` → `parse_struct_field_pairs`、`parse_flat_record_pairs` → `parse_flat_struct_pairs`、`parse_nested_record_entries` → `parse_nested_struct_entries`、`record_fields_from_calcit` → `struct_fields_from_calcit`、`is_record_literal_head` → `is_struct_literal_head`
|
|
24
|
+
- type_coverage.rs:`read_schema_param_tuple` → `read_schema_param_wrapped`
|
|
25
|
+
- WASM codegen:`emit_option_tuple` → `emit_option_enum`、局部变量 `tuple_tag` → `enum_tag`、`record_tag` → `struct_tag`、`tuple_ptr` → `enum_ptr`、`try_format_tuple_literal` → `try_format_enum_literal`
|
|
26
|
+
- `CalcitImpl::from_record` → `CalcitImpl::from_struct`(calcit_impl.rs + type_annotation.rs 调用点);`as_record` 冗余别名删除(`as_struct` 已存在);`as_tuple` → `as_enum`
|
|
27
|
+
- `resolve_enum_value`/`resolve_enum_from_program`/`resolve_enum_def` 内 `Calcit::Struct(record)` 绑定 → `struct_value`
|
|
28
|
+
|
|
29
|
+
### 局部绑定与测试夹具
|
|
30
|
+
|
|
31
|
+
- 模式绑定 `Calcit::Struct(record)` / `Calcit::Enum(tuple)` → `struct_value` / `enum_value`(全仓库,约 40 处)
|
|
32
|
+
- 测试夹具变量:`enum_record` → `enum_struct`、`test_record` → `test_struct`、`class_record` → `class_struct`、`indexed_record_fixture` → `indexed_struct_fixture`、`sample_enum_record` → `sample_enum_struct`、`enum_left/right_record` → `enum_left/right_struct`
|
|
33
|
+
- 测试名(可见于测试输出):`cmp_records_*` → `cmp_structs_*`、`*record_field*` → `*struct_field*`、`checks_enum_tuple_*` → `checks_enum_*`、`checks_tuple_nth_*` → `checks_enum_nth_*`、`schema_rest_named_tuple_is_treated_as_type_only` → `schema_rest_named_enum_*`、`test_normalize_schema_unwraps_wrapped_*_tuple` → `*_enum` 等
|
|
34
|
+
|
|
35
|
+
### 注释 / 诊断字符串
|
|
36
|
+
|
|
37
|
+
- `mod.rs`、`builtins/*`、`codegen/emit_wasm/*`、`data/cirru.rs`、`calcit/syntax_name.rs` 等 60+ 处注释与 doc 措辞同步
|
|
38
|
+
- 用户可见错误/警告串:`[Warn] record update field` → `struct update field`、`map-to-record` → `map-to-struct`、`loose-record-to-struct` → `loose-struct-to-struct`、`tuple-to-enum` → `enum-to-named-enum`、`record {} does not define field` → `struct`、`&list:foldl-shortcut expected a value in the tuple` → `in the enum`
|
|
39
|
+
|
|
40
|
+
## 有意保留(附理由)
|
|
41
|
+
|
|
42
|
+
- `NativeRecord*` / `NativeTuple*` 内部分发枚举变体:与既有 `NativeStruct*` / `NativeEnum*` 存在真实命名冲突(如 `NativeRecordImplTraits` = `&struct:impl-traits` 与 `NativeStructImplTraits` = `&struct-def:impl-traits` 并存且分发不同),盲改不安全。配套的 `record_impl_traits` / `tuple_impl_traits` 函数名同步保留。
|
|
43
|
+
- `CalcitEnumDef::from_record`:明确承载旧 enum-definition schema 的兼容转换,保留。
|
|
44
|
+
- `Edn::Record` / `Edn::Tuple`、`EdnRecordView` / `EdnTupleView`、`Edn::enum_tuple`、`DefinitionRecord`、`find_edn_record_value_mut`、`find_record_in_options`、`legacy_snapshot_record_summary`、`empty_record`(快照测试):外部 `cirru_edn` crate 的 EDN 语义,改名反而错误。
|
|
45
|
+
- 旧输入拼写兼容:`type_annotation.rs` 中 `"record"/"Record"/"tuple"/"Tuple"` 的解析匹配、`:: :record`/`:: :tuple` 兼容分支、`custom_keyword_matches(..., "record"/"tuple")` 运行时类型校验——保留以兼容旧写法。
|
|
46
|
+
- legacy `defrecord` 语法兼容:`try_parse_defrecord_form` / `is_defrecord`(WASM codegen 解析旧 `defrecord` 表单)。
|
|
47
|
+
- impl records(trait 概念):`collect_*_impl_records*`、`get_impl_records_from_type`、`resolve_core_impl_records`、`method_record`、`imp_record`、`impl_record` 等——与文档中保留的「impl records」术语一致。
|
|
48
|
+
- Hash 鉴别串:`"record:"` / `"tuple:"`(`Calcit::Hash`)、`"record"` / `"dyntuple"`(type annotation Hash)——`&hash` 内建会把结果暴露给用户,改动会改变 hash 输出,属于行为变更,不纳入术语清理。
|
|
49
|
+
- 遗留行为测试名:`nominal_options_warn_on_legacy_nil_and_tuple_operations`(测试的是对旧 tuple 操作的告警)。
|
|
50
|
+
- 文档中的合法旧名引用:upgrade 迁移表、`impl records`、`namespace records`、动词 `records`、旧 `tuple` where 语法告警。
|
|
51
|
+
- `src/cirru/calcit-core.cirru` 中 `record-match` 已标记为 removed legacy macro,保留。
|
|
52
|
+
|
|
53
|
+
## 验证
|
|
54
|
+
|
|
55
|
+
- `cargo fmt` 通过;`cargo clippy --lib -- -D warnings` 通过。
|
|
56
|
+
- `cargo test`:360 + 2 + 184 = 546 用例全绿(修复 1 处 `validates_typed_struct_update_fields_after_generic_substitution` 断言串仍引用旧 `record update field`)。
|
|
57
|
+
- `cargo clippy --all-targets` 仅剩 `src/bin`(caps/calcit_deps)既有 `items after a test module` 警告,未改动文件,与本次无关。
|
|
58
|
+
- `yarn compile`、`yarn check-js-runtime`、`yarn check-agent-interface`(12/12)、`yarn try-rs`、`yarn try-js`、`yarn try-ir`、`yarn try-wasm` 全部通过。
|
|
59
|
+
|
|
60
|
+
## 备注
|
|
61
|
+
|
|
62
|
+
- 修改类编辑统一用 `search-replace`/上下文定位,避免索引漂移;遇到多副本局部变量(如 WASM `tuple_tag`/`tuple_ptr`、测试夹具 `enum_record`)用语言服务器语义重命名(rename symbol)按函数作用域逐一处理。
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Cross-backend Host/FFI Contract RFC
|
|
2
|
+
|
|
3
|
+
- Designed a backend-neutral logical FFI contract shared by JavaScript, native registered procedures, WASM, and WASI.
|
|
4
|
+
- Separated logical host types and callable checks from backend-specific ABI transport, ownership, symbol binding, and memory layout.
|
|
5
|
+
- Proposed nominal stable host shapes, with JavaScript/DOM as the first field and method projection consumer.
|
|
6
|
+
- Kept raw host values opaque and required declarations, checked decoders, registered identity, or auditable trusted assertions for stronger host types.
|
|
7
|
+
- Preserved existing registered-proc and `defwasm-import`/`defwasm-export` syntax as incremental migration inputs.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Host FFI Type Foundation
|
|
2
|
+
|
|
3
|
+
- Expanded the cross-backend host/FFI RFC with concise browser and DOM declaration patterns, plus explicit FFI conversion boundaries.
|
|
4
|
+
- Added `Host<T>` as a nominal FFI type annotation that reuses existing Calcit type references without making host values ordinary Calcit data.
|
|
5
|
+
- Added parsing, schema serialization, generic substitution, strict nominal matching, ordering, hashing, and regression coverage for `Host<T>`.
|
|
6
|
+
- Rejected host values from closed `data-shape` conversion and classified them as intentional FFI boundaries in coverage and mismatch diagnostics.
|
|
7
|
+
- Deferred `defhost-type` declaration storage and JS member inference until their registry and preprocessing model are designed.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# FFI Schema Redesign + `cirru.edn` check-md Mode
|
|
2
|
+
|
|
3
|
+
- Retired the premature `CalcitTypeAnnotation::Host` variant and its temporary `defhost-type` macro. Host/FFI value types should not become a parallel type-annotation system.
|
|
4
|
+
- Rewrote the cross-backend host/FFI RFC around Calcit's existing conventions: function/value types stay on `CodeEntry.schema` using `:: 'Fn`/`:: 'Trait`/etc.; backend lowering metadata (JS host path, native symbol, WASM module/field) lives in a separate `CodeEntry.ffi` raw EDN field that never participates in ordinary type matching.
|
|
5
|
+
- Redesigned host capability declarations to reuse existing `deftrait`/`:where` machinery instead of inventing field/shape/member schema kinds; JS property get/set/call lowering is expressed as a small `:members` map on the trait's `:ffi` metadata.
|
|
6
|
+
- Added a `cirru.edn` fenced-block mode to `cr docs check-md`/`format-md` (`CirruCheckMode::Edn`, `run_edn_parse_only` in `src/bin/cli_handlers/docs.rs`) that validates a block parses as EDN data via `cirru_edn::parse`, for schema/`:ffi`-shaped snippets that are not runnable/parseable Calcit source. Documented it in `docs/run/cli-options.md`.
|
|
7
|
+
- Reclassified the RFC's `CodeEntry`/type-reference example blocks from `cirru.no-check` to `cirru.edn` (kept the one illustrative `deftrait DomInput` Calcit-code block as `cirru.no-check`) and verified all 13 blocks pass `cr docs check-md`.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Refine external object traits in host FFI RFC
|
|
2
|
+
|
|
3
|
+
- Rewrote RFC section 6 around existing `deftrait` member syntax: `:field Type` tag members express field capabilities (read via tag access), `.method FnSchema` members express method capabilities (invoke via receiver-preserving JS method call).
|
|
4
|
+
- Replaced the separate `:ffi :members` field/method map with a minimal optional `:names` override that only maps Calcit member names to host names when they differ; member kind/type stays in the trait schema.
|
|
5
|
+
- Noted that `CalcitTrait` currently flattens tags and methods into `EdnTag`; implementing external objects requires extending the member descriptor to `{name, kind, type}` rather than maintaining a parallel schema.
|
|
6
|
+
- Kept `cirru.edn` fenced blocks for all `CodeEntry`/schema-shaped examples; `cr docs check-md` still passes all 13 blocks.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Host FFI typed access and metadata editing
|
|
2
|
+
|
|
3
|
+
- Added snapshot-preserved `CodeEntry :ffi` metadata and `cr edit ffi` for authoring Cirru EDN host contracts.
|
|
4
|
+
- Added external-object trait member typing: tag access maps to JavaScript properties and method invoke maps to aliased JavaScript calls.
|
|
5
|
+
- Added preprocessing and JS codegen coverage for typed external-object access, including `:names` aliases.
|
|
6
|
+
- Updated the cross-backend host/FFI RFC to use canonical snapshot schema and Cirru EDN forms.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# PR review follow-ups for typed FFI
|
|
2
|
+
|
|
3
|
+
- Fixed JS external-property alias lookup for `JsNullish<TraitSet>` receivers.
|
|
4
|
+
- Preprocess prefix typed tag-access receivers before embedding them in external-access IR.
|
|
5
|
+
- Resolve external-object trait metadata from the declared `deftrait` name when suppressing legacy member-tag warnings.
|
|
6
|
+
- Kept `cirru.edn` fences byte-preserved by markdown formatting and allowed standalone EDN checks without a Calcit entry; failure results now retain the fence mode.
|
|
7
|
+
- Clarified the RFC's persisted `:ffi` representation, normalized WASM direction metadata, settled MVP decisions, and repaired the WASM validation document reference.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# ES module typed adapter conventions
|
|
2
|
+
|
|
3
|
+
- Documented ES module imports as opaque values that acquire `Fn` or external-trait evidence only through an explicit `unsafe-coerce` at a small adapter boundary.
|
|
4
|
+
- Established the JavaScript external-member default conversion: kebab case becomes camel case and trailing `?`/`!` are removed.
|
|
5
|
+
- Kept `:ffi :names` as the single per-member override for nonstandard JavaScript property keys, with bracket access preserving special keys safely.
|
|
6
|
+
- Added codegen coverage for the default member-name conversion and checked the RFC and JS interop examples with `docs check-md`.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
# Release 0.13.4
|
|
2
|
+
|
|
3
|
+
- Bumped the Calcit package versions in `Cargo.toml`, `package.json`, and `Cargo.lock` from 0.13.3 to 0.13.4 after merging the typed host FFI work.
|
|
4
|
+
- Verified the release with formatting, tests, clippy, compilation, full checks, and the agent interface smoke checks.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# PR #309 Review Fixes
|
|
2
|
+
|
|
3
|
+
- Reused the already-preprocessed postfix receiver and run static method argument validation for every statically known receiver.
|
|
4
|
+
- Guard receiver-generic binding when a trait or enum method schema has no declared argument types, preventing an empty-list index panic.
|
|
5
|
+
- Renamed the generic receiver mismatch fixture package, namespace, entry points, and documentation to match its purpose.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# JavaScript Example Checks
|
|
2
|
+
|
|
3
|
+
- Added `cr analyze check-examples --js` to compile the generated examples entry and execute it with Node.js.
|
|
4
|
+
- The generated entry declares the `:js-ffi` feature so legitimate JavaScript-only syntax, including `exists? js/process`, does not produce a preprocessing warning.
|
|
5
|
+
- Documented the JS mode and covered the generated runner and schema metadata with unit tests.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Integrate cirru_edn 0.8
|
|
2
|
+
|
|
3
|
+
- Upgrade Calcit to `cirru_edn 0.8.0` and adapt build-time snapshot parsing.
|
|
4
|
+
- Convert Calcit EDN struct and enum boundaries to symbol-backed names while retaining tags for field keys.
|
|
5
|
+
- Update schema serialization, snapshot compatibility handling, CLI traversal, and tests for the new Struct/Enum API.
|
|
6
|
+
- Validate with all-target compilation, Rust tests, library Clippy, TypeScript compilation, and the agent interface smoke suite.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# WASM FFI declarations
|
|
2
|
+
|
|
3
|
+
- Added `defwasm-export` for stable host-facing WASM functions. A marked function that cannot be compiled now fails code generation instead of exporting a placeholder.
|
|
4
|
+
- Added `defwasm-import name (args) |module |field`. The emitter collects these declarations before function indices are assigned and emits the corresponding WASM imports.
|
|
5
|
+
- The initial ABI uses `f64`: Number is direct, while String is its tagged Calcit heap pointer carried as `f64`. Host code may create returned strings through `__str_new` or the documented layout.
|
|
6
|
+
- Import declarations must remain parseable after schema preprocessing, so module and field are discovered from the first two literal strings following the argument list rather than fixed preprocessed positions.
|
|
7
|
+
- Regression coverage checks module exports/imports and executes Number plus String host round trips. Both pull-request and release workflows run the check.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# WASM FFI review fixes
|
|
2
|
+
|
|
3
|
+
- Hardened the Node WASM-string reader and corrected host-side string allocation to reserve its header, length and aligned payload.
|
|
4
|
+
- Validated `defwasm-import` declarations before preprocessing and rejected optional/rest import parameters, while recording declared arity for direct calls.
|
|
5
|
+
- Preserved outer JavaScript await detection after nested function declarations and aligned macro-schema validation with the new WASM declaration forms.
|
|
6
|
+
- Moved WASM tag-index diagnostics to stderr and corrected the runtime type-section documentation.
|
package/lib/js-cirru.mjs
CHANGED
|
@@ -155,7 +155,7 @@ export let to_cirru_edn = (x) => {
|
|
|
155
155
|
}
|
|
156
156
|
// placed literals first
|
|
157
157
|
buffer.sort(recordFieldOrder);
|
|
158
|
-
buffer.unshift(x.name.toString());
|
|
158
|
+
buffer.unshift(new CalcitSymbol(x.name.value).toString());
|
|
159
159
|
buffer.unshift("%{}");
|
|
160
160
|
return buffer;
|
|
161
161
|
}
|
|
@@ -177,28 +177,28 @@ export let to_cirru_edn = (x) => {
|
|
|
177
177
|
return ["quote", toWriterNode(x.get(1))];
|
|
178
178
|
}
|
|
179
179
|
else if (x.enumPrototype != null) {
|
|
180
|
-
let enumTag = unwrap_enum_prototype_local(x.enumPrototype).name.toString();
|
|
180
|
+
let enumTag = new CalcitSymbol(unwrap_enum_prototype_local(x.enumPrototype).name.value).toString();
|
|
181
181
|
if (x.tag instanceof CalcitTag) {
|
|
182
|
-
return ["%::", enumTag, x.tag.toString(), ...x.extra.map(to_cirru_edn)];
|
|
182
|
+
return ["%::", enumTag, new CalcitSymbol(x.tag.value).toString(), ...x.extra.map(to_cirru_edn)];
|
|
183
183
|
}
|
|
184
184
|
else if (x.tag instanceof CalcitStructValue) {
|
|
185
|
-
return ["%::", enumTag, x.tag.name.toString(), ...x.extra.map(to_cirru_edn)];
|
|
185
|
+
return ["%::", enumTag, new CalcitSymbol(x.tag.name.value).toString(), ...x.extra.map(to_cirru_edn)];
|
|
186
186
|
}
|
|
187
187
|
else if (x.tag instanceof CalcitImpl) {
|
|
188
|
-
return ["%::", enumTag, x.tag.name.toString(), ...x.extra.map(to_cirru_edn)];
|
|
188
|
+
return ["%::", enumTag, new CalcitSymbol(x.tag.name.value).toString(), ...x.extra.map(to_cirru_edn)];
|
|
189
189
|
}
|
|
190
190
|
else {
|
|
191
191
|
throw new Error(`Unsupported tag for EDN: ${x.tag}`);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
else if (x.tag instanceof CalcitTag) {
|
|
195
|
-
return ["::", x.tag.toString(), ...x.extra.map(to_cirru_edn)];
|
|
195
|
+
return ["::", new CalcitSymbol(x.tag.value).toString(), ...x.extra.map(to_cirru_edn)];
|
|
196
196
|
}
|
|
197
197
|
else if (x.tag instanceof CalcitStructValue) {
|
|
198
|
-
return ["::", x.tag.name.toString(), ...x.extra.map(to_cirru_edn)];
|
|
198
|
+
return ["::", new CalcitSymbol(x.tag.name.value).toString(), ...x.extra.map(to_cirru_edn)];
|
|
199
199
|
}
|
|
200
200
|
else if (x.tag instanceof CalcitImpl) {
|
|
201
|
-
return ["::", x.tag.name.toString(), ...x.extra.map(to_cirru_edn)];
|
|
201
|
+
return ["::", new CalcitSymbol(x.tag.name.value).toString(), ...x.extra.map(to_cirru_edn)];
|
|
202
202
|
}
|
|
203
203
|
else {
|
|
204
204
|
throw new Error(`Unsupported tag for EDN: ${x.tag}`);
|
package/lib/package.json
CHANGED