An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: fix encrypted-notebook delete_id queue not box-scoped #18034
Daniel73371cea865b
diff --git a/kernel/model/history.go b/kernel/model/history.goindex d138ff8c64..6617f0ee17 100644--- a/kernel/model/history.go+++ b/kernel/model/history.go@@ -342,7 +342,7 @@ func RollbackDocHistory(historyPath string) (err error) {// 仅重新索引该文档,不进行全量索引// Reindex only the current document after rolling back the document https://github.com/siyuan-note/siyuan/issues/12320- sql.RemoveTreeQueue(rootID)+ sql.RemoveTreeQueue(boxID, rootID)if writeErr := indexWriteTreeIndexQueue(tree); nil != writeErr {return}diff --git a/kernel/model/repository.go b/kernel/model/repository.goindex d4822fe962..a0b03f7240 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -313,7 +313,7 @@ func RollbackRepoSnapshotFile(fileID string) (err error) {treenode.RemoveBlockTreesByRootID(boxID, rootID)}- sql.RemoveTreeQueue(rootID)+ sql.RemoveTreeQueue(boxID, rootID)if writeErr := indexWriteTreeIndexQueue(tree); nil != writeErr {return}diff --git a/kernel/model/sync.go b/kernel/model/sync.goindex aaccf09606..2ee97438f6 100644--- a/kernel/model/sync.go+++ b/kernel/model/sync.go@@ -315,18 +315,16 @@ func removeIndexes(removeFilePaths []string) (removeRootIDs []string) {util.PushStatusBar(msg)cache.RemoveTreeData(rootID)- sql.RemoveTreeQueue(rootID)- bts := treenode.GetBlockTreesByRootID(rootID)- for _, b := range bts {- cache.RemoveBlockIAL(b.ID)- }block := treenode.GetBlockTree(rootID)- if nil != block {- cache.RemoveDocIAL(block.Path)- }boxID := ""if nil != block {boxID = block.BoxID+ cache.RemoveDocIAL(block.Path)+ }+ sql.RemoveTreeQueue(boxID, rootID)+ bts := treenode.GetBlockTreesByRootID(rootID)+ for _, b := range bts {+ cache.RemoveBlockIAL(b.ID)}treenode.RemoveBlockTreesByRootID(boxID, rootID)}diff --git a/kernel/sql/queue.go b/kernel/sql/queue.goindex 79b12cf38c..bb8d2db0ad 100644--- a/kernel/sql/queue.go+++ b/kernel/sql/queue.go@@ -57,7 +57,7 @@ type dbQueueOperation struct {}// boxID 从 op 提取目标 boxID,供 beginTxForBox 路由到加密 db 或全局 db。-// delete_id/delete_ids/delete_assets/index_node 无 box 上下文,返回空串 → 走全局 db。+// delete_ids/delete_assets/index_node 无 box 上下文,返回空串 → 走全局 db。func (op *dbQueueOperation) boxID() string {switch op.action {case "index", "rename", "move":@@ -68,7 +68,7 @@ func (op *dbQueueOperation) boxID() string {if op.upsertTree != nil {return op.upsertTree.Box}- case "delete":+ case "delete", "delete_id":return op.removeTreeBoxcase "delete_box", "delete_box_refs":return op.box@@ -471,11 +471,11 @@ func MoveTreeQueue(tree *parse.Tree) {appendOperation(newOp)}-func RemoveTreeQueue(rootID string) {+func RemoveTreeQueue(boxID, rootID string) {dbQueueLock.Lock()defer dbQueueLock.Unlock()- newOp := &dbQueueOperation{removeTreeID: rootID, inQueueTime: time.Now(), action: "delete_id"}+ newOp := &dbQueueOperation{removeTreeBox: boxID, removeTreeID: rootID, inQueueTime: time.Now(), action: "delete_id"}for i, op := range operationQueue {if "delete_id" == op.action && op.removeTreeID == rootID {operationQueue[i] = newOp