refactor: remove resource relation edges - #3956
Draft
sponge225 wants to merge 1 commit into
Draft
Conversation
sponge225
marked this pull request as draft
August 12, 2026 08:30
sponge225
force-pushed
the
cleanup/relation-edge-removal-20260812
branch
from
August 12, 2026 09:35
009c44a to
d4dcda1
Compare
sponge225
force-pushed
the
cleanup/relation-edge-removal-20260812
branch
from
August 12, 2026 09:46
d4dcda1 to
fe50730
Compare
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 移除 OpenViking 中已废弃的 resource relation 边能力。
这套 relation 能力原本提供
/api/v1/relations、VikingFS.link/unlink/relations、CLI/SDK relation 命令,以及 session Phase2 中基于usage_records写入.relations.json的逻辑。但在正常聊天、检索、读取、commit 主链路中,relation 边并不参与检索召回、rerank、上下文组装或业务决策,检索返回中的relations也只是空占位。因此本 PR 的目标不是“兼容旧 relation”,而是让当前系统表现为 resource relation 边从未作为正式能力存在过:
.relations.json.relations.json,通过 OVPack 迁移边界丢弃,而不是在主代码中保留兼容逻辑Human Involvement
Related Issue
无
Type of Change
Changes Made
服务端能力清理
/api/v1/relations路由注册与实现RelationServiceVikingFS relation 实现清理
VikingFS.relations()VikingFS.link()VikingFS.unlink()get_relation_table()、get_relations()、get_relations_with_content()RelationEntry数据结构.relations.json的读写实现viking_fs模块说明,只保留 abstract、overview、find、search 等语义检索能力Session 后台流程清理
usage_records写 relation 的逻辑usage_records对active_count、telemetry、memory 等现有主链路行为的作用检索链路清理
HierarchicalRetriever中的MAX_RELATIONSrelations=[]空占位relations字段的依赖CLI / SDK / Integration 清理
relations子命令、handler、help、错误提示和测试OVPack 迁移边界处理
.relations.json.relations.json作为废弃产物排除export_ovpack/backup_ovpack导出时不写入.relations.jsonimport_ovpack/restore_ovpack读取已有包时,如果包内含.relations.json,校验完整性后跳过写入文档清理
.relations.json是废弃产物,迁移时会被丢弃测试更新
.relations.json的 export/import/restore 清理测试Testing
本地验证如下。
OVPack 迁移边界、restore 分类和 WebDAV 关键路径:
OPENVIKING_CONFIG_FILE=/tmp/openviking-test-stdout.conf \ OPENVIKING_CLI_CONFIG_FILE=/tmp/openviking-test-stdout.conf \ PYTEST_ADDOPTS='' \ uv run pytest tests/misc/test_ovpack_import_policy.py \ tests/agfs/test_viking_fs_git.py::test_classify_restore_path \ tests/server/test_api_webdav.py::test_webdav_propfind_hides_reserved_files_but_keeps_user_dotdirs \ -q --tb=short --disable-warnings --no-header --no-cov结果:
Content write 关键测试:
OPENVIKING_CONFIG_FILE=/tmp/openviking-test-stdout.conf \ OPENVIKING_CLI_CONFIG_FILE=/tmp/openviking-test-stdout.conf \ PYTEST_ADDOPTS='' \ uv run pytest tests/server/test_content_write_service.py \ -q --tb=short --disable-warnings --no-header --no-cov结果:
基础检查:
结果:通过。
结果:通过。
补充扫描:
rg -n "relations\\.json" openviking tests docs/en/api/14-ovpack.md docs/zh/api/14-ovpack.md docs/en/guides/09-ovpack.md docs/zh/guides/09-ovpack.md扫描结果仅剩:
这符合当前设计:主代码不再支持 relation,OVPack 迁移边界负责丢弃旧
.relations.json。Migration Example
如果旧 storage 中曾经产生过
.relations.json,可以通过 OVPack 完成一次“重新打包再导入”的迁移。迁移后,新 storage 中不会包含.relations.json。1. 从旧 storage 导出 OVPack
2. 切到新版本代码,并准备新的空 storage
export OPENVIKING_CONFIG_FILE=/path/to/new-ov.conf3. 导入到新 storage
迁移结果
不迁移向量快照的方式
如果不希望复用旧向量快照,可以导出时不带
--include-vectors:这种方式会只迁移文件树,导入后由新版本重新构建向量索引。
Checklist
Screenshots (if applicable)
Additional Notes
这是一次 intentional breaking cleanup。
删除后不再支持以下能力:
/api/v1/relationsVikingFS.link / unlink / relationsrelations命令relations字段.relations.json普通聊天、检索、读取、session commit 不受影响,因为 relation 边原本不参与正常主链路。
对于历史数据:
.relations.json.relations.json.relations.json,并希望得到完全清理后的数据树,可以使用 OVPack:.relations.jsonuv.lock的本地改动未提交。