feat(ovpack): add v2 manifest and backup restore#1927
Merged
Conversation
Add a portable OVPack manifest for scalar metadata and make imports validate scope, derived files, and conflicts before writing.
PR Code Suggestions ✨No code suggestions found for the PR. |
Make OVPack imports always rebuild vectors in the target environment, keep legacy packages compatible, and reject unsupported manifest versions before writing.
Use on_conflict as the single OVPack import conflict policy and reject removed force inputs.
Keep type portable but stop exporting or applying created_at, updated_at, and active_count from OVPack manifests.
d3e8afe to
4f40557
Compare
MaojiaSheng
approved these changes
May 11, 2026
19 tasks
ZaynJarvis
pushed a commit
that referenced
this pull request
May 13, 2026
* feat(ovpack): add v2 manifest and conflict policy Add a portable OVPack manifest for scalar metadata and make imports validate scope, derived files, and conflicts before writing. * fix(ovpack): remove import vectorize option Make OVPack imports always rebuild vectors in the target environment, keep legacy packages compatible, and reject unsupported manifest versions before writing. * fix(ovpack): remove force import alias Use on_conflict as the single OVPack import conflict policy and reject removed force inputs. * fix(ovpack): regenerate runtime vector metadata Keep type portable but stop exporting or applying created_at, updated_at, and active_count from OVPack manifests. * fix(ovpack): validate manifest contents * fix(ovpack): require manifests for imports * fix(ovpack): close manifest validation gaps * fix(ovpack): defer parent creation until validation passes * fix(ovpack): remove export size guard * fix(ovpack): support session and scope-root restores * docs(ovpack): document full backup migration * feat(ovpack): add backup restore workflow * fix(ovpack): validate import scope compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
这个 PR 将 OVPack 从“裸 ZIP 导入导出”重构为可校验、可恢复的 OpenViking 内容包格式,并把普通
export/import与全量backup/restore的语义拆开。核心目标:
viking://子树,导入时保留包根。Changes Made
kind=openviking.ovpackformat_version=2rootentriessize/sha256content_sha256size/sha256content_sha256vectorize/--no-vectorizeforce/--forceon_conflict=fail|overwrite|skipviking://session/<session_id>可以导出viking://session/viking://resourcesviking://userviking://agentviking://sessionviking://backup_ovpack/restore_ovpack/api/v1/pack/backup//api/v1/pack/restoreov backup/ov restoretype、context_type、level、name、description、tags、abstractcreated_at、updated_at、active_count在目标环境重新生成context_type.relations.jsonExpected Behavior Examples
1. 普通资源子树导入保留包根
ov export viking://resources/projectA/ ./exports/projectA.ovpack ov import ./exports/projectA.ovpack viking://resources/imported/结果:
viking://resources/imported/是父目录,不是最终 root。2. 同 scope 才允许普通 import
允许:
ov export viking://resources/docs/ ./exports/docs.ovpack ov import ./exports/docs.ovpack viking://resources/imported/拒绝:
原因:
3. session 包只能导回 session scope
ov export viking://session/sess_123/ ./exports/sess_123.ovpack ov import ./exports/sess_123.ovpack viking://session/ --on-conflict overwrite结果:
session 包恢复文件状态,不写向量库。
下面两种会被拒绝:
原因:session 包不能变成 resources。
原因:导入会生成
viking://session/sess_123/sess_123这种嵌套 root。4. 顶级 scope 包只能导入
viking://ov export viking://resources/ ./exports/resources.ovpack ov import ./exports/resources.ovpack viking:// --on-conflict overwrite结果:
下面这种会被拒绝:
原因:顶级 scope 包不能作为普通子树嵌套导入。
5. 全量迁移使用 backup/restore
restore 会恢复公开 scope root:
backup 包不能被普通 import 使用:
会返回错误,提示使用
ov restore或 restore API。6. manifest / checksum 校验
下面情况会在写入前被拒绝:
<root>/_._ovpack_manifest.jsonformat_version不是当前支持版本size不匹配sha256不匹配content_sha256不匹配7. 冲突策略
on_conflict=fail:on_conflict=overwrite:on_conflict=skip:Related Issue
N/A
Type of Change
Testing
验证命令:
最近一次针对 scope compatibility 调整额外验证:
Checklist
Screenshots (if applicable)
N/A
Additional Notes
Breaking change 说明:
.ovpack默认拒绝导入,需要在可信环境重新导出为 v2 包。vectorize/force兼容参数,避免多个控制面表达同一语义。