fix: restrict inbox to captured artifacts

This commit is contained in:
2026-06-05 01:35:27 +08:00
parent 58a74acbf6
commit 2e86229350
9 changed files with 34 additions and 30 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -16,7 +16,7 @@
background: #13131f;
}
</style>
<script type="module" crossorigin src="/assets/main-4y6wyoK9.js"></script>
<script type="module" crossorigin src="/assets/main-O6a-DCWF.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-es_E5H-H.css">
</head>
<body>
+18 -18
View File
@@ -2,30 +2,30 @@ package main
import "testing"
func TestListInboxNodesReturnsOnlyUnassignedRoots(t *testing.T) {
func TestListInboxNodesReturnsOnlyCapturedArtifacts(t *testing.T) {
app, _ := setupTestApp(t)
unassigned, err := app.CreateNodeFromTemplate("", "Unassigned Root", "folder.default")
manual, err := app.CreateNodeFromTemplate("", "Manual Root", "folder.default")
if err != nil {
t.Fatalf("create unassigned root: %v", err)
t.Fatalf("create manual root: %v", err)
}
inbox, err := app.CreateNodeFromTemplate("", "Inbox Root", "folder.default")
legacyInbox, err := app.CreateNodeFromTemplate("", "Legacy Inbox Root", "folder.default")
if err != nil {
t.Fatalf("create inbox root: %v", err)
t.Fatalf("create legacy inbox root: %v", err)
}
assigned, err := app.CreateNodeFromTemplate("", "Assigned Root", "folder.default")
captured, err := app.CreateNodeFromTemplate("", "Captured Artifact", "folder.default")
if err != nil {
t.Fatalf("create assigned root: %v", err)
t.Fatalf("create captured artifact: %v", err)
}
child, err := app.CreateNodeFromTemplate(unassigned.ID, "Nested Child", "folder.default")
child, err := app.CreateNodeFromTemplate(captured.ID, "Nested Child", "folder.default")
if err != nil {
t.Fatalf("create child: %v", err)
}
if _, err := app.db.Exec(`UPDATE nodes SET section = 'inbox' WHERE id = ?`, inbox.ID); err != nil {
t.Fatalf("mark inbox: %v", err)
if _, err := app.db.Exec(`UPDATE nodes SET section = 'inbox' WHERE id = ?`, legacyInbox.ID); err != nil {
t.Fatalf("mark legacy inbox: %v", err)
}
if _, err := app.db.Exec(`UPDATE nodes SET section = 'projects' WHERE id = ?`, assigned.ID); err != nil {
t.Fatalf("mark assigned: %v", err)
if err := app.nodes.MetaSet(captured.ID, "capture.inbox", "true"); err != nil {
t.Fatalf("mark captured: %v", err)
}
list, err := app.ListInboxNodes()
@@ -37,14 +37,14 @@ func TestListInboxNodesReturnsOnlyUnassignedRoots(t *testing.T) {
for _, item := range list {
got[item.ID] = true
}
if !got[unassigned.ID] {
t.Fatal("unassigned root missing from inbox")
if !got[captured.ID] {
t.Fatal("captured artifact missing from inbox")
}
if !got[inbox.ID] {
t.Fatal("section=inbox root missing from inbox")
if got[manual.ID] {
t.Fatal("manual root should not be in inbox")
}
if got[assigned.ID] {
t.Fatal("assigned root should not be in inbox")
if got[legacyInbox.ID] {
t.Fatal("section=inbox root without capture metadata should not be in inbox")
}
if got[child.ID] {
t.Fatal("nested child should not be in inbox")