Skip to content

Commit 9f2f576

Browse files
authored
Merge pull request #2887 from GCWing/gcwing/dev
feat: add standalone data migrator and workspace resources panel
2 parents 73afe4e + 7f805ae commit 9f2f576

203 files changed

Lines changed: 9925 additions & 10242 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cli-package.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ concurrency:
2626
jobs:
2727
# ── Resolve version info (mirrors desktop-package.yml) ─────────────
2828
prepare:
29+
if: github.event_name != 'release' || !startsWith(github.event.release.tag_name, 'data-migrator-v')
2930
name: Prepare
3031
runs-on: ubuntu-latest
3132
outputs:
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Data Migrator Package
2+
3+
on:
4+
push:
5+
tags: ['data-migrator-v*']
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: data-migrator-package-${{ github.ref }}
13+
cancel-in-progress: false
14+
15+
jobs:
16+
build:
17+
name: Migrator (${{ matrix.platform }})
18+
runs-on: ${{ matrix.os }}
19+
timeout-minutes: 60
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- platform: windows-x64
25+
os: windows-latest
26+
target: x86_64-pc-windows-msvc
27+
bundles: --no-bundle
28+
- platform: macos-arm64
29+
os: macos-15
30+
target: aarch64-apple-darwin
31+
bundles: --bundles dmg
32+
- platform: macos-x64
33+
os: macos-15-intel
34+
target: x86_64-apple-darwin
35+
bundles: --bundles dmg
36+
- platform: linux-x64
37+
os: ubuntu-22.04
38+
target: x86_64-unknown-linux-gnu
39+
bundles: --bundles appimage
40+
steps:
41+
- uses: actions/checkout@v5
42+
- uses: pnpm/action-setup@v5
43+
- uses: actions/setup-node@v5
44+
with:
45+
node-version: '22.18.0'
46+
cache: pnpm
47+
- uses: dtolnay/rust-toolchain@stable
48+
with:
49+
targets: ${{ matrix.target }}
50+
- uses: swatinem/rust-cache@v2
51+
with:
52+
shared-key: data-migrator-${{ matrix.platform }}
53+
cache-bin: false
54+
- name: Install Linux WebView build dependencies
55+
if: runner.os == 'Linux'
56+
run: sudo apt-get update && sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
57+
- run: pnpm install --frozen-lockfile --ignore-scripts
58+
- name: Verify independent version and packaging contract
59+
run: |
60+
node scripts/data-migrator-release.mjs --check-version
61+
node --test scripts/data-migrator-tauri-build.test.mjs
62+
- name: Check offline data compatibility
63+
run: cargo test --locked -p openbitfun-data-migrator -p openbitfun-legacy-migration-adapters -p openbitfun-legacy-migration -p openbitfun-config-contracts --lib --test migration_engine_contracts
64+
- name: Build independent package
65+
run: pnpm run data-migrator:build -- --target ${{ matrix.target }} ${{ matrix.bundles }}
66+
- name: Stage package and checksum
67+
run: node scripts/data-migrator-release.mjs ${{ matrix.platform }}
68+
- uses: actions/upload-artifact@v6
69+
with:
70+
name: data-migrator-${{ matrix.platform }}
71+
path: target/data-migrator-release/${{ matrix.platform }}/*
72+
if-no-files-found: error
73+
74+
draft-release:
75+
if: startsWith(github.ref, 'refs/tags/data-migrator-v')
76+
needs: build
77+
runs-on: ubuntu-latest
78+
permissions:
79+
contents: write
80+
steps:
81+
- uses: actions/checkout@v5
82+
- uses: actions/setup-node@v5
83+
with:
84+
node-version: '22.18.0'
85+
- uses: actions/download-artifact@v7
86+
with:
87+
pattern: data-migrator-*
88+
path: migrator-release-assets
89+
merge-multiple: true
90+
- name: Sign and verify with the independent migrator release key
91+
shell: bash
92+
env:
93+
OPENBITFUN_SIGNING_KEY: ${{ secrets.DATA_MIGRATOR_SIGNING_PRIVATE_KEY }}
94+
OPENBITFUN_SIGNING_PASSWORD: ${{ secrets.DATA_MIGRATOR_SIGNING_PRIVATE_KEY_PASSWORD }}
95+
OPENBITFUN_SIGNING_PUBKEY: ${{ secrets.DATA_MIGRATOR_SIGNING_PUBKEY }}
96+
run: |
97+
set -euo pipefail
98+
test -n "$OPENBITFUN_SIGNING_KEY"
99+
test -n "$OPENBITFUN_SIGNING_PUBKEY"
100+
cat migrator-release-assets/*.sha256 | sort -k2 > migrator-release-assets/SHA256SUMS
101+
(cd migrator-release-assets && sha256sum --check SHA256SUMS)
102+
bash scripts/sign-release-assets.sh migrator-release-assets/*
103+
node scripts/write-minisign-public-key.mjs --out migrator-release-assets/data-migrator.minisign.pub
104+
- name: Create a separately reviewed release
105+
uses: softprops/action-gh-release@v3
106+
with:
107+
tag_name: ${{ github.ref_name }}
108+
name: OpenBitFun Data Migrator ${{ github.ref_name }}
109+
draft: true
110+
make_latest: false
111+
files: migrator-release-assets/*
112+
body_path: src/apps/data-migrator/RELEASE.md

.github/workflows/desktop-package.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ concurrency:
4444
jobs:
4545
# ── Resolve version info ───────────────────────────────────────────
4646
prepare:
47+
if: github.event_name != 'release' || !startsWith(github.event.release.tag_name, 'data-migrator-v')
4748
name: Prepare
4849
runs-on: ubuntu-latest
4950
outputs:

Cargo.lock

Lines changed: 43 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ members = [
2929
"src/crates/services/services-core",
3030
"src/crates/services/services-integrations",
3131
"src/crates/services/legacy-migration",
32+
"src/crates/services/legacy-migration-adapters",
3233
"src/crates/services/miniapp-market-service",
3334
"src/crates/services/skin-market-service",
3435
"src/crates/services/relay-service",
@@ -46,6 +47,7 @@ members = [
4647
"src/crates/execution/tool-provider-groups",
4748
"src/crates/execution/tool-execution",
4849
"src/crates/contracts/core-types",
50+
"src/crates/contracts/config-contracts",
4951
"src/crates/contracts/events",
5052
"src/crates/contracts/runtime-ports",
5153
]

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ OpenBitFun is still evolving. Here are three directions we want to explore:
103103

104104
Getting there means making long-running tasks more reliable, the runtime more efficient, and the desktop experience smoother.
105105

106+
## Optional legacy data migration
107+
108+
Data migration is optional and uses a **separately downloaded OpenBitFun Data
109+
Migrator**. It runs independently and is not bundled with or launched by the main
110+
application. See the [download, compatibility and recovery guide](src/apps/data-migrator/README.md).
111+
106112
## Build with it. Help shape it.
107113

108114
**Star OpenBitFun to follow along. Share what you build, offer feedback, or contribute code to help shape what comes next.**

README.zh-CN.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ OpenBitFun 仍在演进,我们希望继续探索三个方向:
105105

106106
更可靠的长任务、更高效的 Runtime、更从容的桌面体验,是这些探索共同的基础。
107107

108+
## 按需迁移旧版数据
109+
110+
数据迁移是可选操作,请按需**单独下载 OpenBitFun 数据迁移器**。工具独立运行,
111+
不随主应用打包,也不会由主应用自动启动。下载、兼容范围、操作步骤与中断恢复见
112+
[迁移器使用说明](src/apps/data-migrator/README.zh-CN.md)
113+
108114
## 用它创造,也一起创造它
109115

110116
**欢迎用 Star 关注 OpenBitFun,用作品、反馈和代码参与它的未来。**

docs/architecture/product-architecture.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,3 +895,19 @@ Shared Agent Runtime 是第一方多实例的目标部署,不是上表新增
895895
启停顺序和失败回滚。这项宿主接入不构成 CLI、Server、ACP 或 HarmonyOS 本地产品支持。
896896
- HarmonyOS PC 的完整目标同时包含本地 CLI/TUI 与 GUI,当前均不能标记可用;两种宿主分别验收,具体支持证据和禁止替代项以平台规约及各自专题为准。
897897
- 文档、边界脚本和 focused 测试能说明本次变更保护了哪个稳定接口边界,或删除/降级了哪个过宽接口。
898+
899+
## 独立数据迁移工具的依赖边界
900+
901+
Data Migrator 是独立发布的本地离线工具,不依赖 Core、Product Assembly、Desktop 或 Web UI。
902+
主应用不检测、启动或捆绑迁移器。两者在同一源码工作区复用稳定的数据格式与存储实现:
903+
904+
- contracts/config-contracts:配置 DTO、默认值、版本校验及到共享模型 DTO 的纯转换;Core 原路径保留转发,ConfigProvider 仍在 Core。
905+
- services-core 的 workspace-persistence、coordination-store、session-event-format:工作区记录、注册表校验、SQLite 物理 schema 和会话日志格式。
906+
- services/legacy-migration-adapters:旧版读取、转换、引用修复;只调用共享存储 owner。
907+
- services/legacy-migration:快照、锁、暂存、备份、原子写入、日志恢复和无时效交接依赖的任务存储。
908+
909+
本次只移动数据/存储 owner,不移动 WorkspaceManager、会话生命周期、权限、事件或远程执行。
910+
WorkspaceInfo/WorkspaceIdentity 的运行操作由 Core 的 runtime extension traits 保留,稳定记录无需导入这些能力。
911+
原 Core 存储入口保留错误映射;可选 legacy-migration facade 保留旧导入路径,但不再由 product-full 启用。
912+
远程四种场景不提供迁移工具的执行入口;仅转换本机保存的连接记录,不连接远端。
913+
使用与发行契约以 [独立迁移器说明](../../src/apps/data-migrator/README.zh-CN.md) 为准。

docs/architecture/product-customization-blueprint.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ C0a 实现一个构建期 JSONC 产品定义、严格解析器和确定性解析
1717
当前真实消费者只有:
1818

1919
- Desktop build adapter:从解析结果覆盖 Tauri `productName``mainBinaryName` 与 bundle identifier;
20-
- Data Migrator build adapter:从解析结果覆盖独立 Tauri 身份,并把 Desktop 与 Migrator 的 sibling binary name
21-
编译进交接边界;
2220
- CLI dev/build wrapper:从同一解析结果设置命令名、隔离定制构建缓存,并按成员 `binaryName` 暂存构建产物;
23-
- First-party Rust artifacts:Desktop/Data Migrator/CLI build adapter 通过编译期环境注入 `productId`
21+
- First-party Rust artifacts:Desktop/CLI build adapter 通过编译期环境注入 `productId`
2422
`dataNamespace` 与由其派生的隐藏目录名,`openbitfun-core-types::product_identity` 作为最小事实 owner,供数据路径、Runtime
2523
ownership、Remote Connect 与 Detached Dispatch 复用;
2624

2725
`product:check` / `product:explain` 只是构建作者的校验与解释工具,不计作产品字段的生产消费者。C0a 不生成无人读取的
28-
通用产品 manifest 或 locale projection;三个 build adapter 直接消费同一次内存解析结果,Rust consumer
26+
通用产品 manifest 或 locale projection;两个 build adapter 直接消费同一次内存解析结果,Rust consumer
2927
只读取随对应产品 artifact 编译进去的不可变事实,不在运行时重新选产品。
3028

3129
产品定义 v1 仅包含已被这些消费者读取的字段,未知字段一律拒绝。localized 名称独立于技术 ID,并按共享 locale contract
@@ -37,7 +35,7 @@ GUI/TUI 布局、插件/内置扩展选择、Installer/Store target、更新与
3735

3836
### 0.1 当前定义与解析契约
3937

40-
产品定义描述一个 family,其中 Desktop、Data Migrator 与 CLI 是分别命名、分别消费的成员;Installer 与 Store 是可能的 Desktop
38+
产品定义描述一个 family,其中 Desktop 与 CLI 是分别命名、分别消费的成员;Installer 与 Store 是可能的 Desktop
4139
交付目标,不是独立成员,当前也没有对应实现。schema v1 只接受以下已消费字段:
4240

4341
```jsonc
@@ -51,11 +49,6 @@ GUI/TUI 布局、插件/内置扩展选择、Installer/Store target、更新与
5149
"binaryName": "acme-desktop",
5250
"bundleId": "com.acme.desktop"
5351
},
54-
"dataMigrator": {
55-
"displayNameKey": "product.dataMigrator.name",
56-
"binaryName": "acme-data-migrator",
57-
"bundleId": "com.acme.data-migrator"
58-
},
5952
"cli": {
6053
"displayNameKey": "product.cli.name",
6154
"binaryName": "acme"
@@ -65,7 +58,7 @@ GUI/TUI 布局、插件/内置扩展选择、Installer/Store target、更新与
6558
```
6659

6760
解析器先校验完整 family、双方 locale key、owned path 与技术 ID,再选择命令对应成员;digest-bearing `assembly`
68-
只携带 schema/source digest、成员、display-name key、binary/bundle identity、交接所需 sibling binary names、
61+
只携带 schema/source digest、成员、display-name key、binary/bundle identity、
6962
locale contract facts 与 assembly digest。
7063
构建 adapter 所需的源路径、localized 名称、输出目录和 default-product 标记保留在外围 build context,不扩展成通用
7164
manifest。相同输入必须产生相同摘要;非默认产品使用 digest-scoped Cargo target 目录,避免复用其他产品的编译期身份。
@@ -79,9 +72,13 @@ i18n locale 集合和 key parity。
7972

8073
- 只修改默认产品定义或资源引用时运行 `pnpm run product:check`;非默认定义运行
8174
`pnpm run product:check -- --product-config <path>`,确保校验实际改动的产品;
82-
- 修改 schema、resolver 或 Desktop/Data Migrator/CLI build adapter 行为时,再运行 `pnpm run product:test`
75+
- 修改 schema、resolver 或 Desktop/CLI build adapter 行为时,再运行 `pnpm run product:test`
8376
- 打包和平台矩阵只在变更触及对应交付路径时运行,不作为产品定义的默认本地预检。
8477

78+
Data Migrator 已从产品 family 与 sibling binary 投影中移除,使用自己的版本、Tauri 身份、构建与发布工作流。
79+
它固定面向 OpenBitFun 数据格式;工具身份与目标数据身份分开。旧定制产品定义应移除 `members.dataMigrator`
80+
详见 [迁移器 README](../../src/apps/data-migrator/README.zh-CN.md)
81+
8582
## 1. 设计结论
8683

8784
产品定制只需要四类对象:

docs/architecture/rust-build-dependency-boundaries.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,19 @@ cargo check -p <product> --timings
246246

247247
当前硬边界由 `scripts/check-core-boundaries.mjs` 统一执行。不要为同一 Cargo 架构事实增加第二个 checker;新增规则先证明当前树满足、fixture 能捕获回归,并保持错误消息可直接定位到 owner manifest。
248248
检查器必须保持工作树只读;读取独立 manifest 的声明事实时不得生成新的 lockfile、target artifact 或格式化改动。
249+
250+
## 独立数据迁移工具的依赖边界
251+
252+
Data Migrator 是独立发布的本地离线工具,不依赖 Core、Product Assembly、Desktop 或 Web UI。
253+
主应用不检测、启动或捆绑迁移器。两者在同一源码工作区复用稳定的数据格式与存储实现:
254+
255+
- contracts/config-contracts:配置 DTO、默认值、版本校验及到共享模型 DTO 的纯转换;Core 原路径保留转发,ConfigProvider 仍在 Core。
256+
- services-core 的 workspace-persistence、coordination-store、session-event-format:工作区记录、注册表校验、SQLite 物理 schema 和会话日志格式。
257+
- services/legacy-migration-adapters:旧版读取、转换、引用修复;只调用共享存储 owner。
258+
- services/legacy-migration:快照、锁、暂存、备份、原子写入、日志恢复和无时效交接依赖的任务存储。
259+
260+
本次只移动数据/存储 owner,不移动 WorkspaceManager、会话生命周期、权限、事件或远程执行。
261+
WorkspaceInfo/WorkspaceIdentity 的运行操作由 Core 的 runtime extension traits 保留,稳定记录无需导入这些能力。
262+
原 Core 存储入口保留错误映射;可选 legacy-migration facade 保留旧导入路径,但不再由 product-full 启用。
263+
远程四种场景不提供迁移工具的执行入口;仅转换本机保存的连接记录,不连接远端。
264+
使用与发行契约以 [独立迁移器说明](../../src/apps/data-migrator/README.zh-CN.md) 为准。

0 commit comments

Comments
 (0)