Repository navigation
refactor: typed Option consumption / Option 在类型化消费边界内处理 - #117
Conversation
|
@coderabbitai full review Please review the latest HEAD. This preserves generic member lookup values and the existing guest/String-decoder behavior, with the same attached native/JS tests passing before and after. No production or dependency changes. |
|
@coderabbitai full review Latest HEAD 86ec724 adds branch-local consumption for31 existing decoder calls across10 definitions. All original tests/schemas are retained. Four additional actual-consumer groups and the same20-group/84-test JS replay pass before/after; full strict,145 native,45 client and existing application checks pass. Please review this latest HEAD rather than the earlier member-only commit. |
|
中文:补充合并后验收:精确 main 9e9cac3 的 Upload 38941640793 completed/success。b31ec64 快照使用已发布 0.30.1-alpha.4 CLI/procs、WSS 0.2.36 的隔离浏览器/native 服务,验证注册、任务创建/编辑/Done/Put back、Clear 只关闭菜单、笔记创建/编辑与初值、刷新自动登录、独立访客显示;持久化后停止并重启本地服务,任务/笔记恢复,完整 DB 导出 deepEqual。刻意停服窗口有预期 WS 断连,恢复后无新增 error。本地测试端口/标签已关闭。未执行生产切换或重启,也不把本次 alpha.4 验收冒称最终维护版配对。 English: Post-merge acceptance: exact main 9e9cac3 Upload 38941640793 completed/success. The b31ec64 snapshot passed isolated browser/native acceptance with published 0.30.1-alpha.4 CLI/procs and WSS 0.2.36: registration, task editing/Done/Put back, Clear only dismissing menus, note editing/prefill, refresh login and a separate guest. After persistence and local service restart, tasks/notes recovered and complete exported DBs were deepEqual. Expected WS errors occurred only during deliberate downtime; none were added after recovery. Local test ports/tabs are closed. No production switch/restart was performed; this is not final maintenance-pair acceptance. |
中文:获授权的独立完整补审维护者现已明确授权独立 agent 补审此前保留待审的最终提交。本次实际审查精确 审查者通过 CLI 比较全部22个namespace AST:无定义增删、无schema改动,原194个附带测试的代码/名称/tag逐项不变,新增12个;逐项核对15个业务定义的 Option/Some nil/false/0/空String、访客及泛型key、解码与异常位置、路由/时间惰性、事件延迟读取、存储和备份顺序。新测试实际使用断言,原JS运行器重放同一AST,没有日期stub冒充支持。 本次独立实跑的是 git archive 提取的精确b31ec64,使用原正式alpha.4 CLI/procs及Node24:完整strict --verify passed、diagnostics/suggestions空;client/server检查通过;client48、server149测试均零失败;原Dayjs与title运行器通过。精确HEAD原CI38940271973 success,构建/生成JS步骤成功。本次不冒称alpha.5、当前main或生产复跑。 限制:未重新安装依赖、重跑构建/其余两个JS脚本、浏览器、原生重启或生产;既有记录与本次复跑明确分开。原checkout仍0b278791且clean;精确head副本Snapshot blob2464e3d48ef2d8081ea0f777ff17abd6b302b9f9未变。没有提交、推送、部署、重启或服务监听。管理员生产配对门槛按维护者最新决定保留。 English: authorized independent full supplementary reviewThe maintainer now explicitly authorized an independent agent to review the previously held final commit. Actual review covers the exact base/head above and all four complete files, with no regressions requiring fixes. This does not reuse #115/#118 approval. CLI AST comparison covers all22namespaces: no definition additions/removals or schema changes; all194original attached tests retain code/names/tags, with12new groups. Review checks all15business-definition refinements for Option/present nil/false/zero/empty Strings, guests/generic keys, decoding/failure position, lazy route/time selection, delayed event reads and storage/backup order. New tests assert outcomes and existing JS runners replay the same AST without date stubs. Actual independent reruns use an archived exactb31ec64 with its original published alpha.4 CLI/procs and Node24: full strict --verify passes with empty diagnostics/suggestions; both entry checks pass; client48/server149tests have zero failures; original Dayjs/title runners pass. Original exact-head CI38940271973 succeeds, including build/generated-JS steps. This is not claimed as alpha.5/current-main/production rerun. No dependency reinstall, new build/remaining two JS scripts, browser/native restart or production run was performed in this supplementary review. Original checkout stays0b278791/clean and the exact-head Snapshot blob above is unchanged. No commit/push/deployment/restart/listener. The administrator production-pair gate remains explicitly required. |
从使用 Timegrass 的角度看,成员列表继续保留访客、空用户名和真实 session key;升级后非法姓名仍以原错误拒绝。本次改进让 Calcit 沿 Map 方法保留泛型值类型,并在字段、路由、日期和 cursor 的消费边界内直接处理 Option,避免先擦回 nil 再继续传递。应用数据、通信格式、检查顺序和服务配置不变。
中文
Refs calcit-lang/calcit#2080,后续于 #115(已由外部合并)。
修改
twig-members保留原Map<K,Map<Tag,S>>/Map<String,Map<Tag,U>>输入和Map<K,String>输出合同。先将用户标识收窄为 String,然后使用现有.get方法读取用户和姓名;不增加生产 Dynamic、unsafe、公共 API 或业务默认值。:tests,覆盖 Number/String session key、缺失/nil/false/0/true/Tag 用户标识、空标识/姓名与非法姓名的完整错误文本。:tests,验证 history/notes 路由的缺失及非法载荷、overview cursor 和 note 时间的完整原错误;同一组在修改前后回放。原测试完全保留。新增验收用例开发中补齐 HistoryRoute 原有 start/end 必需字段,并按原 Respo>>早期错误修正新 cursor 用例;不修改运行时或旧预期。验证
@calcit/procs0.30.1-alpha.4,依赖与版本不变。type-at:用户名表达式为 String(exact,无 expected-type);用户读取为Option<Map<Tag,U>>,.get静态方法 lowering 成功,保留 U 而非退回 Dynamic。本 PR 不操作生产环境,不使用 #115 的旧人工 review 代替新 HEAD review。远端 CI/审查、最终维护版本配对与其余消费者迁移仍须完成;不宣称 0.30.1 已可稳定发版。
English
Refs calcit-lang/calcit#2080; follow-up to the externally merged #115.
Change
Keep
twig-members' existing generic input/output contracts. Narrow user identifiers to String before the existing typed Map.getcalls. Preserve generic user/name values until the original String decoder consumes a name. No wider production Dynamic, unsafe, new public API or chosen business default.Preserve the approved guest behavior for missing/non-String identifiers, unknown users and missing/nil names. Empty identifiers remain valid lookup keys; empty names remain empty. Other invalid names still produce the same full String decoder error. Keep original tests unchanged, add two definition-attached groups, and replay the same four groups through the existing JS runner. User documentation is Chinese.
Also move 31 existing decoder calls across10 definitions into the selected Option branch, preserving the original lookup, pure/non-capturing type arguments, decoder and evaluation point. None still passes nil to the same decoder, not a chosen default, unwrap or hand-written error. Preserve unselected-route laziness, callback timing and earlier Respo errors. Add four attached regression groups for missing/invalid route payloads, overview cursors and note timestamps. During development, correct only new fixtures to include HistoryRoute's existing start/end fields and respect the earlier Respo cursor failure; no original test expectation/runtime changes.
Consume UI/keyboard decisions as Bool without claiming the original open state fields are validated Bool. Preserve truthiness and short-circuiting; a missing key cannot equal the fixed String literal and yields false, while Some retains the original comparison. Dispatch route-name Options through the original literal Tag/default branches. Decode the selected sort timestamp as Number, retaining nil/false fallback and unselected-created-time laziness. Add three attached groups for complete time errors, literal route selection,13 actual keyboard inputs and dispatch-error propagation. Keep the original three sort groups and extend the existing runner to select all four.
Consume three profile/backup String leaves directly; other str arguments are verified pure literals and clock/field evaluation order is unchanged. Bind checked Result<String,String> directly for legacy message-ID Maps. Keep the notes Map through its existing empty-Map fallback and decoder; combine only identical effect-free reads of the same immutable Map. Add three attached groups for six real greeting displays, complete legacy message-ID errors/empty Strings, and native notes boundary values. Clarify the open wire Map only in a new test fixture, not production types. Full twig projection depends on native std dates/dylib: an attempted new JS replay failed at its Date0 dependency; retain every native test and do not introduce a stub or claim JS acceptance. Replay supported UI/protocol groups through the existing JS runner.
Verification
Use the published matching CLI/procs
0.30.1-alpha.4; no dependency/version changes. The unchanged and revised implementations both pass the same 4/4 native tests and JS replay. Independent CLI type-at infers String with exact evidence and no expected type, andOption<Map<Tag,U>>with specialized.getlowering; generic U is retained.Before/after replay passes for both stages: Dayjs20 groups/84 tests for decoder changes and20 groups/86 for selection changes, plus original host checks and the title/sort runner. Afterward, full strict passes with empty diagnostics; native147/147, client47/47; title/login/container, session/wire and typed-database/privacy/persistence checks pass. Independent type-at gives exact Bool and Result<HistoryRoute,String> without an expected-type assertion; cursor remains coarse List/partial, not a claim about precise elements. Later selection expressions independently infer exact Bool, Number and Result<Route,String>, with no expected type. Strict rejected an initial explicit String/nil comparison; replace only its proven-false absence branch, without weaker checking, wider types or changed tests. Client/server codegen, production build, canonical format and whole-Snapshot delta audit pass. The audit verifies every original consumer and precise replacements, freshness, effect-free type arguments and preserved control context. Original schemas/tests/examples/imports/config remain intact except the stated additions/body refinements. Existing require-marker/chunk warnings remain disclosed.
No production operation. #115's earlier human review does not approve this new HEAD. Remote CI/review, the final maintenance pair and remaining consumer migration gates still apply; this does not claim stable0.30.1 readiness.
Latest leaf-stage before/after JS replay passes22 groups/109 tests; unchanged native twig9/9 and message decoder22/22 pass before modification. Afterward full strict passes with empty diagnostics, native149/149 and client48/48, plus original business checks/codegen/build/format/audit. Independent inference is exact String and Result<String,String>; notes remains partial Map<String,Map<Tag,Dynamic>>, not a claim of fully typed contents. Backup-path evidence is the original-position pure-literal transformation and existing build checks, not a new flaky clock/midnight integration test.