Skip to content

[devex] 前端 mock 数据与后端 schema 无强制对齐 — 浏览器 dev 模式静默 drift #302

@appergb

Description

@appergb

背景

ipc.tsinvokeOrMock 返回手工维护的 mock 数据。

风险

  • 与 Rust #[derive(Serialize)] struct 之间没有编译期类型校验
  • 新增字段时 mock 数据可能漏更
  • 浏览器 dev 模式(isTauri=false)UI 看起来正常,但实际跑 Tauri 时后端行为不同

建议

  • schemars 在 Rust 端为 IPC 类型生成 JSON Schema
  • json-schema-to-typescript 在 build 时从 schema 生成 TS 类型 + mock template
  • 或用 typeshare 自动生成 TS 类型

来源

docs/audit-2026-05-06.md §1.4 低风险 #8

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions