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: Scope filesystem probe exclusions to their reserved paths https://github.com/siyuan-note/siyuan/issues/20353
Danielca79c4ce6b17
diff --git a/kernel/model/sync_ignore.go b/kernel/model/sync_ignore.goindex e471978824..86c912e308 100644--- a/kernel/model/sync_ignore.go+++ b/kernel/model/sync_ignore.go@@ -128,7 +128,7 @@ func syncPathFilter(dataDir string, info os.FileInfo, absPath string) (bool, errreturn true, nil}if info != nil && info.IsDir() {- if info.Name() == "filesys_status_check" {+ if rel == "/.siyuan/filesys_status_check" || rel == "/filesys_status_check" {return true, filepath.SkipDir}return true, nildiff --git a/kernel/model/sync_ignore_test.go b/kernel/model/sync_ignore_test.goindex e11f84cec4..117ffdfea3 100644--- a/kernel/model/sync_ignore_test.go+++ b/kernel/model/sync_ignore_test.go@@ -278,7 +278,7 @@ func TestSyncIgnoreRepoCompatibility(t *testing.T) {".hidden/file", "box/.hidden/file", "assets/file.tmp", "assets/tracked.txt","storage/local.json", "storage/recent-doc.json", "storage/ref-used.json", "storage/view-state.json","storage/view-state-corrupted-20260913000000.json", "nested/data/storage/local.json",- "filesys_status_check/file", "nested/filesys_status_check/file", "20210808180117-6v0mkxr/file.sy",+ "filesys_status_check/file", ".siyuan/filesys_status_check/file", "20210808180117-6v0mkxr/file.sy",}for _, path := range paths {writeSyncPathTestFile(t, filepath.Join(util.DataDir, path))diff --git a/kernel/model/sync_probe_path_test.go b/kernel/model/sync_probe_path_test.gonew file mode 100644index 0000000000..4a35623388--- /dev/null+++ b/kernel/model/sync_probe_path_test.go@@ -0,0 +1,56 @@+package model++import (+ "os"+ "path/filepath"+ "testing"++ "github.com/siyuan-note/siyuan/kernel/util"+)++func TestSyncProbeDirectoryIsPathScoped(t *testing.T) {+ prepareAssetDownloadRepoTest(t)+ paths := map[string]bool{+ "filesys_status_check/status": false,+ ".siyuan/filesys_status_check/status": false,+ "nested/filesys_status_check/file": true,+ "plugins/filesys_status_check/plugin.json": true,+ "widgets/filesys_status_check/widget.json": true,+ "themes/filesys_status_check/theme.css": true,+ "icons/filesys_status_check/icon.js": true,+ "templates/filesys_status_check/template.md": true,+ "storage/ai/agent/skills/filesys_status_check/SKILL.md": true,+ }+ for p := range paths {+ writeSyncPathTestFile(t, filepath.Join(util.DataDir, p))+ }+ repo, err := newRepository()+ if err != nil {+ t.Fatal(err)+ }+ index, err := repo.Index("probe paths", false, nil)+ if err != nil {+ t.Fatal(err)+ }+ files, err := repo.GetFiles(index)+ if err != nil {+ t.Fatal(err)+ }+ tracked := map[string]bool{}+ for _, file := range files {+ tracked[file.Path] = true+ }+ for p, want := range paths {+ if tracked["/"+p] != want || PathsAffectSync(filepath.Join(util.DataDir, p)) != want {+ t.Errorf("index and scheduling must include %s: %v", p, want)+ }+ }+ if _, _, err := repo.Checkout(index.ID, nil); err != nil {+ t.Fatal(err)+ }+ for p := range paths {+ if _, err := os.Stat(filepath.Join(util.DataDir, p)); err != nil {+ t.Errorf("checkout lost %s: %v", p, err)+ }+ }+}