Skip to content

fix: execute typed members callback / 修复类型化成员回调执行 - #67

Merged
tiye merged 1 commit into
mainfrom
fix/typed-members-callback-63
Oct 3, 2026
Merged

tiye merged 1 commit into
mainfrom
fix/typed-members-callback-63

Conversation

@tiye

@tiye tiye commented Oct 3, 2026

Copy link
Copy Markdown
Member

中文

关联 #63、calcit-lang/calcit#1529。修复一个已在正式 Calcit 0.27.0 复现的业务回调错误;不关闭完整路由迁移任务。

修改

twig-members 的 hint-fn 与实际 twig-member-entry 调用改为函数体内的同级表达式。hint-fn 返回 Nil,是类型元数据,不会执行/返回嵌在第二个参数里的回调 body。保留现有 Map<Number,String>、MapEntryDecision 与 keep/drop 合同,不添加 unsafe、扩大 Dynamic、转换业务 key 或改动路由协议。

新增 definition :tests,通过真实 nominal User/Session 构造器检查非空成员映射、数字键、无登录用户、缺失用户和空输入。类型断言只标记这些已构造值与空 Map 的精确集合合同,不替不可信数据补证明。原有 21 项测试不修改。

验证

  • 同一个新测试在原写法下失败:match expected an enum value, got: nil;修复后通过。使用正式 Calcit 0.27.0。
  • 正式 0.27.0:server 全部 22 项附带测试通过,browser/server 严格入口、app.twig.container 公开定义、完整 browser JS 生成与格式检查通过。
  • 查询实际附带测试的未截断 Cirru 表达式,在独立 Snapshot 用 CLI 构建回放入口;生成 JS 使用已发布 @calcit/procs 0.27.0,原断言全部通过。临时入口、脚本和生成产物不提交。
  • unreleased Calcit #1723 候选:该附带测试与完整 server 入口检查通过;原写法会在类型检查时报 Nil 回调不匹配。未升级项目版本或依赖。

本地模块与 npm 依赖通过只读链接使用现有缓存;没有修改原用户项目。Actions 会重新安装 deps.cirru 与 yarn.lock 的版本,作为干净依赖组合验证。未声称实际浏览器/WebSocket、完整路由 payload 迁移或正式 0.28/0.29 升级完成。

English

Refs #63 and calcit-lang/calcit#1529. Fix an application callback bug reproduced with published Calcit 0.27.0; this does not close the broader route migration.

Changes

Make the hint-fn metadata and twig-member-entry call sibling expressions in twig-members. The hint returns Nil rather than executing/returning a body nested as its second argument. Preserve Map<Number,String>, MapEntryDecision and keep/drop contracts; no unsafe additions, wider Dynamic, business-key conversions or protocol changes.

Add a definition-attached test using real nominal User/Session constructors to exercise nonempty mapping, numeric keys, unauthenticated/missing users and empty inputs. Assertions annotate the exact collection contracts of already-constructed values/empty Maps, not untrusted data. The existing 21 tests remain unchanged.

Validation

  • The identical new test fails on the original source with match expected an enum value, got: nil, then passes after the fix, using released Calcit 0.27.0.
  • On 0.27.0: all 22 server attached tests pass; browser/server strict entries, public twig definitions, full browser JS generation and formatting pass.
  • Replay the actual untruncated attached Cirru expressions through a CLI-created entry in an isolated Snapshot. Generated JS with published @calcit/procs 0.27.0 passes the original assertions. Temporary entry/scripts/output are not committed.
  • The unreleased #1723 compiler candidate passes this attached test and the whole server entry; original source fails its type check with the Nil callback mismatch. Project/dependency versions are unchanged.

Local Calcit/npm dependencies are existing caches linked read-only; original user projects are untouched. Actions will reinstall the versions declared in deps.cirru/yarn.lock for clean-combination validation. No actual browser/WebSocket, complete route-payload migration or released 0.28/0.29 upgrade acceptance is claimed.

@tiye

tiye commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@tiye
tiye merged commit e0dacdf into main Oct 3, 2026
1 check passed
@tiye
tiye deleted the fix/typed-members-callback-63 branch October 3, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant