@calcit/procs 0.12.44 → 0.12.46

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.
Binary file
@@ -0,0 +1,9 @@
1
+ # Calcit Type schema primitive tags support expansion
2
+
3
+ ## Timestamp: 202606131200
4
+
5
+ ## Modification Summary:
6
+ - Expanded `PRIMITIVE_SCHEMA_TAGS` inside `/Users/chenyong/repo/calcit-lang/calcit/src/snapshot.rs` to include `"record"`, `"struct"`, `"enum"`, `"trait"`, `"impl"`.
7
+ - This ensures schema annotations utilizing these tags (e.g., `:trait` or `:enum` in code entries) pass verification rather than raising an unrecognized primitive tag validation error.
8
+ - Verified with the Calcit test suite which passed 223+85 integration and unit tests without error.
9
+ - Updated `respo/alerts` annotations using these tags to enforce more precise typing rules in the codebase.
package/build.rs CHANGED
@@ -23,6 +23,8 @@ pub struct CodeEntry {
23
23
  pub doc: String,
24
24
  #[serde(default)]
25
25
  pub examples: Vec<Cirru>,
26
+ #[serde(default)]
27
+ pub tags: Vec<String>,
26
28
  pub code: Cirru,
27
29
  #[serde(default)]
28
30
  pub schema: Option<Edn>,
@@ -261,6 +263,32 @@ fn validate_schema_edn_no_legacy_quotes(value: &Edn, owner: &str) -> Result<(),
261
263
  walk(value, owner, &mut path)
262
264
  }
263
265
 
266
+ fn parse_tags_from_edn(value: &Edn, owner: &str) -> Result<Vec<String>, String> {
267
+ match value {
268
+ Edn::Set(set) => {
269
+ let mut tags = Vec::with_capacity(set.0.len());
270
+ for item in &set.0 {
271
+ match item {
272
+ Edn::Tag(tag) => tags.push(format!(":{}", tag.ref_str())),
273
+ other => {
274
+ return Err(format!(
275
+ "{owner}: CodeEntry.tags expects tag items, got {}",
276
+ format_edn_preview(other)
277
+ ));
278
+ }
279
+ }
280
+ }
281
+ tags.sort();
282
+ tags.dedup();
283
+ Ok(tags)
284
+ }
285
+ other => Err(format!(
286
+ "{owner}: CodeEntry.tags expects a hashset, got {}",
287
+ format_edn_preview(other)
288
+ )),
289
+ }
290
+ }
291
+
264
292
  fn parse_code_entry(edn: Edn, owner: &str) -> Result<CodeEntry, String> {
265
293
  let record: EdnRecordView = match edn {
266
294
  Edn::Record(r) => r,
@@ -268,12 +296,14 @@ fn parse_code_entry(edn: Edn, owner: &str) -> Result<CodeEntry, String> {
268
296
  };
269
297
  let mut doc = String::new();
270
298
  let mut examples: Vec<Cirru> = vec![];
299
+ let mut tags: Vec<String> = Vec::new();
271
300
  let mut code: Option<Cirru> = None;
272
301
  let mut schema: Option<Edn> = None;
273
302
  for (key, value) in &record.pairs {
274
303
  match key.arc_str().as_ref() {
275
304
  "doc" => doc = from_edn(value.clone()).map_err(|e| format!("{owner}: invalid `:doc`: {e}"))?,
276
305
  "examples" => examples = from_edn(value.clone()).map_err(|e| format!("{owner}: invalid `:examples`: {e}"))?,
306
+ "tags" => tags = parse_tags_from_edn(value, owner)?,
277
307
  "code" => code = Some(from_edn(value.clone()).map_err(|e| format!("{owner}: invalid `:code`: {e}"))?),
278
308
  "schema" => {
279
309
  if !matches!(value, Edn::Nil) {
@@ -286,6 +316,7 @@ fn parse_code_entry(edn: Edn, owner: &str) -> Result<CodeEntry, String> {
286
316
  Ok(CodeEntry {
287
317
  doc,
288
318
  examples,
319
+ tags,
289
320
  code: code.ok_or_else(|| format!("{owner}: missing `:code` field in CodeEntry"))?,
290
321
  schema,
291
322
  })
@@ -0,0 +1,7 @@
1
+ # &get-def-doc / &get-def-schema
2
+
3
+ - 新增 `&get-def-doc`、`&get-def-schema` 内置函数,参数为 `ns/def` 字符串或 symbol。
4
+ - Rust/eval 运行时通过 `program::lookup_def_doc` / `lookup_def_schema` 读取已加载定义的 `:doc` 与 `:schema`。
5
+ - `snapshot::schema_annotation_to_edn` 统一 schema 转 EDN。
6
+ - calcit-js 标记为 unavailable,不生成 def-meta 注册表,避免 js-out 膨胀。
7
+ - 测试:`calcit/test-def-meta.cirru`,仅在 `inside-eval:` 下运行。
@@ -0,0 +1,15 @@
1
+ # 修改记录: cr analyze weak-types 路径打印格式优化使用点号 (2026-06-12)
2
+
3
+ ## 知识点与变动树
4
+
5
+ 1. **Weak-type 路径打印格式优化**:
6
+ - 原本 `cr analyze weak-types` 命令输出 AST 节点和声明模式中的位置时会使用大量的方括号 `[` 和 `]`,如 `code[3][1][6]`。
7
+ - 现将其重构并统一为标准点号 (`.`) 路径分隔法(如 `code.3.1.6`),以消除视觉冗余。
8
+
9
+ 2. **具体实现 & 多位置对齐**:
10
+ - `format_cirru_path`: 修改它的实现,将其内部的 `[idx]` 拼接机制替换成了 `.idx`,从而全局对齐了 Cirru 节点遍历的 dot 符号写法。
11
+ - `scan_schema_dynamic_annotation`: 内部处理 Fn 类型的索引时,把 `{path}.args[{idx}]` 和 `{path}.type-arg[{idx}]` 修改为点号连接的 `{path}.args.{idx}`、`{path}.type-arg.{idx}`,并同步修改了 `schema.args.{idx}` 语法签名位置。
12
+
13
+ 3. **测试与质量验证**:
14
+ - 执行 `cargo test --bin cr` 通过了全部 85 项内置和回归测试(无测试报错)。
15
+ - 实地重新构建 `cargo build --bin cr` 并对大规模项目 `termina/msg-buffer` 完美执行 `analyze weak-types` 分析,其输出完美显示为高清晰度的 `code.6.1.3` 及 `schema.args.0.item.item.value` 点号格式。
@@ -2147,5 +2147,7 @@ export let gensym = unavailableProc;
2147
2147
  export let macroexpand = unavailableProc;
2148
2148
  export let macroexpand_all = unavailableProc;
2149
2149
  export let _$n_get_calcit_running_mode = unavailableProc;
2150
+ export let _$n_get_def_doc = unavailableProc;
2151
+ export let _$n_get_def_schema = unavailableProc;
2150
2152
  // already handled in code emitter
2151
2153
  export let raise = unavailableProc;
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.12.44",
3
+ "version": "0.12.46",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.7.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.12.44",
3
+ "version": "0.12.46",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.7.0",
@@ -2278,6 +2278,8 @@ export let gensym = unavailableProc;
2278
2278
  export let macroexpand = unavailableProc;
2279
2279
  export let macroexpand_all = unavailableProc;
2280
2280
  export let _$n_get_calcit_running_mode = unavailableProc;
2281
+ export let _$n_get_def_doc = unavailableProc;
2282
+ export let _$n_get_def_schema = unavailableProc;
2281
2283
 
2282
2284
  // already handled in code emitter
2283
2285
  export let raise = unavailableProc;