English
Problem
After #36 removes the false Store decoder boundary and local alerts uses precise nominal hook schemas, seven msg-buffer-owned current-compiler findings remain:
- Two event handlers dereference
.-target from JsNullish values without narrowing.
main! compares raw document.visibilityState with a String.
listen-extension! compares four raw message.action values with Strings (menu-summary, fill-text, menu-translate, menu-custom).
These are all shallow host-boundary values and should not stay Dynamic inside application control flow.
Proposed migration
- Define typed browser-event/message adapters that validate target/action/visibility fields at ingress.
- Return
Option<String> or a finite nominal action enum; pattern-match before dispatch.
- Keep arbitrary deep extension payload data Dynamic only behind the decoded action-specific boundary.
Acceptance
- No direct dereference of
JsNullish event targets.
- Visibility and extension action comparisons are statically homogeneous or nominal matches.
- Existing send/reply/fill/translate behavior and startup output remain unchanged.
- Do not solve the migration with broad
unsafe-coerce or raw equality primitives.
中文
问题
#36 删除错误的 Store decoder 边界,并让本地 alerts 使用精确 nominal hook schema 后,当前编译器仍报告 7 条由 msg-buffer 自身负责的问题:
- 两个事件 handler 未 narrow 就从
JsNullish 值读取 .-target。
main! 把原始 document.visibilityState 与 String 比较。
listen-extension! 把四个原始 message.action 与 String 比较(menu-summary、fill-text、menu-translate、menu-custom)。
这些都是浅层 host-boundary 值,不应以 Dynamic 继续进入应用控制流。
建议迁移
- 定义 typed browser-event/message adapter,在入口验证 target/action/visibility 字段。
- 返回
Option<String> 或有限 nominal action enum,并在 dispatch 前 pattern match。
- 只有 action-specific 边界之后的任意深层 extension payload 才保留 Dynamic。
验收
- 不再直接解引用
JsNullish event target。
- visibility 与 extension action 使用静态同类型比较或 nominal match。
- 现有发送、reply、fill、translate 行为与启动输出保持不变。
- 不用宽泛
unsafe-coerce 或底层 raw equality primitive 规避迁移。
English
Problem
After #36 removes the false Store decoder boundary and local alerts uses precise nominal hook schemas, seven msg-buffer-owned current-compiler findings remain:
.-targetfromJsNullishvalues without narrowing.main!compares rawdocument.visibilityStatewith a String.listen-extension!compares four rawmessage.actionvalues with Strings (menu-summary,fill-text,menu-translate,menu-custom).These are all shallow host-boundary values and should not stay Dynamic inside application control flow.
Proposed migration
Option<String>or a finite nominal action enum; pattern-match before dispatch.Acceptance
JsNullishevent targets.unsafe-coerceor raw equality primitives.中文
问题
#36 删除错误的 Store decoder 边界,并让本地 alerts 使用精确 nominal hook schema 后,当前编译器仍报告 7 条由 msg-buffer 自身负责的问题:
JsNullish值读取.-target。main!把原始document.visibilityState与 String 比较。listen-extension!把四个原始message.action与 String 比较(menu-summary、fill-text、menu-translate、menu-custom)。这些都是浅层 host-boundary 值,不应以 Dynamic 继续进入应用控制流。
建议迁移
Option<String>或有限 nominal action enum,并在 dispatch 前 pattern match。验收
JsNullishevent target。unsafe-coerce或底层 raw equality primitive 规避迁移。