{ "schema_version": 1, "diagram_type": "workflow", "meta": { "title": "TallyNote 平滑更新与应用内直连下载流程", "subtitle": "告别外部守护等待 · 应用进程直连流式下载 · 原子热切换", "output": "artifacts/tallynote-update-workflow.html", "animation": "trace", "quality_profile": "showcase", "views": [ { "id": "stream-download", "label": "应用内流式下载", "focus": [ "ui_render", "stream_worker", "verify_sha" ], "note": "Web 进程 0 延时直连 Gitea 流式拉取并比对哈希,彻底废除外部 systemd.path 调度等待。" }, { "id": "atomic-switch", "label": "原子切换与秒级恢复", "focus": [ "ui_ready", "atomic_switch", "health_probe", "ui_refreshed" ], "note": "包就绪后秒级原子切换 current 软链接,30s 倒计时探活自动无缝恢复。" } ] }, "lanes": [ { "id": "ui", "label": "管理控制台 (前端 UI)" }, { "id": "app", "label": "Web 应用后端 (Node.js)" }, { "id": "system", "label": "系统底层与运行时 (Linux / systemd)" }, { "id": "git", "label": "Gitea 官方源 (HTTPS)" } ], "phases": [ { "id": "phase_check", "label": "版本发现", "fromCol": 0, "toCol": 1 }, { "id": "phase_download", "label": "直连下载与校验", "fromCol": 2, "toCol": 3, "variant": "emphasis" }, { "id": "phase_apply", "label": "原子切换与自愈", "fromCol": 4, "toCol": 5, "variant": "dashed" } ], "groups": [ { "id": "grp_stream", "label": "应用内直接流式拉取 (无外部阻塞)", "lane": "app", "fromCol": 2, "toCol": 3, "variant": "emphasis" } ], "mainPath": [ "ui_check", "api_check", "git_source", "ui_render", "stream_worker", "verify_sha", "ui_ready", "atomic_switch", "health_probe", "ui_refreshed" ], "nodes": [ { "id": "ui_check", "lane": "ui", "col": 0, "type": "frontend", "label": "检查更新", "sublabel": "点击查询新版" }, { "id": "api_check", "lane": "app", "col": 0, "type": "backend", "label": "查询 Release", "sublabel": "只读接口校验", "tag": "只读" }, { "id": "git_source", "lane": "git", "col": 1, "type": "external", "label": "Gitea 官方源", "sublabel": "返回最新元数据", "tag": "HTTPS" }, { "id": "ui_render", "lane": "ui", "col": 1, "type": "frontend", "label": "版本看板呈现", "sublabel": "日志与升级入口" }, { "id": "stream_worker", "lane": "app", "col": 2, "type": "backend", "label": "流式拉取", "sublabel": "应用直连下载", "tag": "实时进度" }, { "id": "verify_sha", "lane": "app", "col": 3, "type": "security", "label": "SHA-256 校验", "sublabel": "比对并解压", "tag": "完整性" }, { "id": "ui_ready", "lane": "ui", "col": 3, "type": "frontend", "label": "确认重启", "sublabel": "更新包已就绪" }, { "id": "atomic_switch", "lane": "system", "col": 4, "type": "cloud", "label": "原子切换", "sublabel": "切换软链接重载" }, { "id": "health_probe", "lane": "app", "col": 5, "type": "backend", "label": "健康探测探针", "sublabel": "轮询探活至 200" }, { "id": "ui_refreshed", "lane": "ui", "col": 5, "type": "frontend", "label": "平滑上线刷新", "sublabel": "自动进入新版本" } ], "edges": [ { "id": "e1", "from": "ui_check", "to": "api_check" }, { "id": "e2", "from": "api_check", "to": "git_source" }, { "id": "e3", "from": "git_source", "to": "ui_render", "channelX": 250 }, { "id": "e4", "from": "ui_render", "to": "stream_worker" }, { "id": "e5", "from": "stream_worker", "to": "verify_sha" }, { "id": "e6", "from": "verify_sha", "to": "ui_ready" }, { "id": "e7", "from": "ui_ready", "to": "atomic_switch" }, { "id": "e8", "from": "atomic_switch", "to": "health_probe" }, { "id": "e9", "from": "health_probe", "to": "ui_refreshed" } ], "cards": [ { "dot": "emerald", "title": "核心升级点:消除外部调度依赖", "items": [ "传统模式:Web 写入 JSON 队列,傻等外部 root 守护进程监听唤醒,导致常态化卡死在等待系统调度", "新模式:Web 后端进程直接建立 HTTPS 流式管道下载,0 秒立即响应,进度条真实可见" ] }, { "dot": "cyan", "title": "透明化监控与错误拦截", "items": [ "网络层直抓:DNS 失败、超时或 404 当场捕获,前端弹窗直接展示错误详情与重试按钮", "进度实时计算:每 500ms 计算下载字节与传输速率(MB/s),无感后台拉取" ] }, { "dot": "violet", "title": "平滑原子切换与自愈", "items": [ "文件完整校验后再切换软链接,绝不损坏现有运行中的实例", "前端 30 秒倒计时探针自动检测服务就绪,服务重启完毕自动恢复会话" ] } ] }