feat(tree): complete rust family runtime checklist

- add tree shell runtime artifact contracts and page/filetree/picker runtime reducers
- sink tree.subtree.move write operation through Rust and formalize command event plans
- harden file tree search projection contract and route thin-proxy boundaries
- record completed harness tasks and move design docs into process/done
This commit is contained in:
lix-2026
2026-04-27 10:27:15 +08:00
parent e564dfde02
commit 4ab36a9386
30 changed files with 2502 additions and 432 deletions
@@ -470,6 +470,14 @@ describe("tree-stream/tree-delta", () => {
expect(next).toEqual(baseSidebarData);
});
it("支持 resync_required delta 仅推进 cursor,等待后续 snapshot/resync", () => {
const next = applyTreeStreamDelta(baseSidebarData, {
op: "resync_required",
});
expect(next).toEqual(baseSidebarData);
});
it("为 page_tree 定义统一 delta 应用边界,并可稳定派生页面行", () => {
const next = applyTreeStreamDeltaToProjectionState({
projection: "page_tree",
@@ -557,6 +565,59 @@ describe("tree-stream/tree-delta", () => {
});
});
it("file_tree fixture 覆盖搜索 hardening 需要的 index、asset-folder、mindmap child、book 与 pdf 资源类型", () => {
const next = applyTreeStreamDeltaToProjectionState({
projection: "file_tree",
base: fileTreeProjectionBase,
event: {
op: "replace_documents",
documents: [...fileTreeProjectionBase.documents],
},
});
const rowById = new Map(next.fileTreeItems.map((item) => [item.rowId, item]));
expect(rowById.get("index:root")).toMatchObject({
rowKind: "index",
title: "index.md",
resourceMeta: expect.objectContaining({
resourceKind: "index",
documentId: "root",
}),
});
expect(rowById.get("asset-folder:asset_mindmap")).toMatchObject({
rowKind: "asset_folder",
title: "mindmap",
resourceMeta: expect.objectContaining({
resourceKind: "mindmap",
assetKind: "mindmap",
}),
});
expect(rowById.get("asset:asset_mindmap_child")).toMatchObject({
rowKind: "asset",
parentNodeId: "asset-folder:asset_mindmap",
resourceMeta: expect.objectContaining({
resourceKind: "asset",
assetKind: "image",
}),
});
expect(rowById.get("asset:asset_book")).toMatchObject({
rowKind: "asset",
iconHint: "book",
resourceMeta: expect.objectContaining({
resourceKind: "book",
assetKind: "book",
}),
});
expect(rowById.get("asset:asset_pdf")).toMatchObject({
rowKind: "asset",
iconHint: "pdf",
resourceMeta: expect.objectContaining({
resourceKind: "pdf",
assetKind: "pdf",
}),
});
});
it("支持 upsert_assets 更新资源归属并重建 file_tree projection", () => {
const next = applyTreeStreamDeltaToProjectionState({
projection: "file_tree",
@@ -23,6 +23,7 @@ export type TreeStreamDocumentPatch =
export type TreeStreamDeltaOp =
| "noop"
| "resync_required"
| "upsert_document"
| "upsert_documents"
| "upsert_assets"
@@ -236,6 +237,10 @@ export function applyTreeStreamDelta(
return base;
}
if (event.op === "resync_required") {
return base;
}
if (event.op === "replace_sidebar" && event.sidebar) {
if ("activeWorkspaceId" in event.sidebar) {
return cloneSidebarData(event.sidebar as SidebarInitialData);