Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(sync): handle deleted notebook references

tianma-ifa423c92c9c52
diff --git a/apps/api/src/sync-routes.test.mjs b/apps/api/src/sync-routes.test.mjs
index 926841b3..b3c893a8 100644
--- a/apps/api/src/sync-routes.test.mjs
+++ b/apps/api/src/sync-routes.test.mjs
@@ -1,5 +1,7 @@
import { describe, expect, test } from "bun:test";
+import { Database } from "bun:sqlite";
import { Hono } from "hono";
+import { createSelfHostedStorageAdapter } from "./self-hosted-storage-adapter.ts";
import { registerSyncRoutes } from "./sync-routes.ts";
const agentAuth = {
@@ -26,7 +28,107 @@ const createApp = (auth = agentAuth) => {
return app;
};
+const createSyncIntegrationFixture = () => {
+ const sqlite = new Database(":memory:");
+ sqlite.exec(`
+ CREATE TABLE workspaces (id TEXT PRIMARY KEY, created_at TEXT NOT NULL);
+ CREATE TABLE notebooks (
+ id TEXT PRIMARY KEY, workspace_id TEXT NOT NULL, parent_id TEXT, name TEXT NOT NULL,
+ slug TEXT, icon TEXT, color TEXT, sort_order INTEGER NOT NULL DEFAULT 0,
+ is_deleted INTEGER NOT NULL DEFAULT 0, created_at TEXT NOT NULL, updated_at TEXT NOT NULL
+ );
+ CREATE TABLE memos (
+ id TEXT PRIMARY KEY, workspace_id TEXT NOT NULL, notebook_id TEXT NOT NULL, title TEXT,
+ excerpt TEXT NOT NULL DEFAULT '', tags_json TEXT NOT NULL DEFAULT '[]',
+ is_pinned INTEGER NOT NULL DEFAULT 0, is_archived INTEGER NOT NULL DEFAULT 0,
+ is_deleted INTEGER NOT NULL DEFAULT 0, source_memo_ids TEXT NOT NULL DEFAULT '[]',
+ merge_source_count INTEGER NOT NULL DEFAULT 0, merged_into_memo_id TEXT,
+ created_at TEXT NOT NULL, updated_at TEXT NOT NULL, deleted_at TEXT
+ );
+ CREATE TABLE memo_contents (
+ memo_id TEXT PRIMARY KEY, revision INTEGER NOT NULL DEFAULT 0, content_json TEXT NOT NULL,
+ content_markdown TEXT NOT NULL DEFAULT '', content_text TEXT NOT NULL DEFAULT '', content_hash TEXT NOT NULL
+ );
+ CREATE TABLE mobile_sync_changes (
+ id INTEGER PRIMARY KEY AUTOINCREMENT, workspace_id TEXT NOT NULL, entity_type TEXT NOT NULL,
+ entity_id TEXT NOT NULL, operation TEXT NOT NULL
+ );
+ INSERT INTO workspaces VALUES ('ws_1', '2026-09-09T00:00:00.000Z');
+ INSERT INTO notebooks (id, workspace_id, name, slug, is_deleted, created_at, updated_at) VALUES
+ ('nb_inbox', 'ws_1', 'Inbox', 'inbox', 0, '2026-09-09T00:00:00.000Z', '2026-09-09T00:00:00.000Z'),
+ ('nb_deleted', 'ws_1', 'Deleted', 'deleted', 1, '2026-09-09T00:00:00.000Z', '2026-09-09T00:00:00.000Z'),
+ ('nb_child', 'ws_1', 'Recovered child', 'child', 0, '2026-09-09T00:00:00.000Z', '2026-09-09T00:00:00.000Z');
+ UPDATE notebooks SET parent_id = 'nb_deleted' WHERE id = 'nb_child';
+ INSERT INTO memos (
+ id, workspace_id, notebook_id, title, is_deleted, created_at, updated_at, deleted_at
+ ) VALUES (
+ 'memo_trashed', 'ws_1', 'nb_deleted', 'Trashed', 1,
+ '2026-09-09T00:00:00.000Z', '2026-09-09T00:00:00.000Z', '2026-09-09T00:00:00.000Z'
+ );
+ INSERT INTO memo_contents VALUES ('memo_trashed', 1, '{"type":"doc"}', '', '', 'hash');
+ INSERT INTO mobile_sync_changes (workspace_id, entity_type, entity_id, operation) VALUES
+ ('ws_1', 'memo', 'memo_trashed', 'upsert'),
+ ('ws_1', 'notebook', 'nb_child', 'upsert');
+ `);
+ const storage = createSelfHostedStorageAdapter(sqlite, "/tmp/edgeever-sync-route-test-unused");
+ const app = new Hono();
+ app.use("/api/v1/*", async (context, next) => {
+ context.set("auth", agentAuth);
+ await next();
+ });
+ registerSyncRoutes(app, {
+ clampNumber: (value, min, max) => Math.min(Math.max(value, min), max),
+ mapMemoDetail: (row) => ({
+ id: row.id,
+ notebookId: row.notebook_id,
+ title: row.title,
+ isDeleted: row.is_deleted === 1,
+ }),
+ });
+ return { app, sqlite, storage };
+};
+
describe("sync route contracts", () => {
+ test("keeps bootstrap references inside the active notebook snapshot", async () => {
+ const fixture = createSyncIntegrationFixture();
+ try {
+ const response = await fixture.app.request(
+ "/api/v1/sync/bootstrap?limit=200",
+ {},
+ { storage: fixture.storage },
+ );
+ expect(response.status).toBe(200);
+ const payload = await response.json();
+ expect(payload.notebooks.map((notebook) => notebook.id)).toEqual(["nb_inbox", "nb_child"]);
+ expect(payload.notebooks.find((notebook) => notebook.id === "nb_child")?.parentId).toBeNull();
+ expect(payload.memos).toEqual([{
+ id: "memo_trashed",
+ notebookId: "nb_inbox",
+ title: "Trashed",
+ isDeleted: true,
+ }]);
+ } finally {
+ fixture.sqlite.close();
+ }
+ });
+
+ test("normalizes dangling references in incremental changes", async () => {
+ const fixture = createSyncIntegrationFixture();
+ try {
+ const response = await fixture.app.request(
+ "/api/v1/sync/changes?cursor=0&limit=200",
+ {},
+ { storage: fixture.storage },
+ );
+ expect(response.status).toBe(200);
+ const payload = await response.json();
+ expect(payload.changes[0].memo.notebookId).toBe("nb_inbox");
+ expect(payload.changes[1].notebook.parentId).toBeNull();
+ } finally {
+ fixture.sqlite.close();
+ }
+ });
+
test("requires both notebook and memo read scopes", async () => {
const app = createApp({ ...agentAuth, scopes: ["read:memos"] });
const response = await app.request("/api/v1/sync/bootstrap", {}, {
@@ -49,8 +151,8 @@ describe("sync route contracts", () => {
prepare: (sql) => ({
bind: () => ({
all: async () => {
- if (sql.includes("FROM notebooks")) return { results: [] };
if (sql.includes("FROM memos m")) return { results: memoRows };
+ if (sql.includes("FROM notebooks n")) return { results: [] };
return { results: [] };
},
first: async () => {
diff --git a/apps/api/src/sync-routes.ts b/apps/api/src/sync-routes.ts
index 6633f8f5..c6a550a5 100644
--- a/apps/api/src/sync-routes.ts
+++ b/apps/api/src/sync-routes.ts
@@ -46,6 +46,39 @@ type SyncRouteDependencies = {
// page; querying all of them in one IN clause would make sync return HTTP 500.
const SYNC_DETAIL_ID_BATCH_SIZE = 90;
+// A deleted memo can outlive its original notebook: users may move every active
+// memo to trash and then delete the now-empty notebook. Local mirrors only cache
+// active notebooks, so expose the same destination used by restoreMemosRecord
+// instead of returning a dangling notebook id.
+const syncMemoNotebookIdSql = `CASE
+ WHEN EXISTS (
+ SELECT 1 FROM notebooks source_notebook
+ WHERE source_notebook.id = m.notebook_id
+ AND source_notebook.workspace_id = m.workspace_id
+ AND source_notebook.is_deleted = 0
+ ) THEN m.notebook_id
+ ELSE COALESCE((
+ SELECT inbox.id FROM notebooks inbox
+ WHERE inbox.workspace_id = m.workspace_id
+ AND inbox.slug = 'inbox'
+ AND inbox.is_deleted = 0
+ LIMIT 1
+ ), m.notebook_id)
+END`;
+
+// Keep active notebook snapshots self-contained even if historical data has an
+// active child whose parent was deleted. The server remains authoritative; the
+// mirror simply presents that orphan as a root notebook.
+const syncNotebookParentIdSql = `CASE
+ WHEN n.parent_id IS NULL OR EXISTS (
+ SELECT 1 FROM notebooks parent_notebook
+ WHERE parent_notebook.id = n.parent_id
+ AND parent_notebook.workspace_id = n.workspace_id
+ AND parent_notebook.is_deleted = 0
+ ) THEN n.parent_id
+ ELSE NULL
+END`;
+
const splitSyncDetailIds = (ids: string[]) => {
const batches: string[][] = [];
for (let index = 0; index < ids.length; index += SYNC_DETAIL_ID_BATCH_SIZE) {
@@ -67,7 +100,7 @@ export const registerSyncRoutes = (
const afterId = context.req.query("afterId")?.trim() ?? "";
const [notebookRows, memoRows, totalRow, cursorRow] = await Promise.all([
context.env.storage.db.prepare(
- `SELECT n.id, n.parent_id, n.name, n.slug, n.icon, n.color, n.sort_order,
+ `SELECT n.id, ${syncNotebookParentIdSql} AS parent_id, n.name, n.slug, n.icon, n.color, n.sort_order,
n.created_at, n.updated_at, COUNT(m.id) AS memo_count, MAX(m.updated_at) AS last_memo_updated_at
FROM notebooks n
LEFT JOIN memos m ON m.notebook_id = n.id AND m.workspace_id = n.workspace_id AND m.is_deleted = 0
@@ -76,7 +109,7 @@ export const registerSyncRoutes = (
ORDER BY n.sort_order ASC, n.name ASC`,
).bind(workspaceId).all<NotebookRow>(),
context.env.storage.db.prepare(
- `SELECT m.id, m.notebook_id, m.title, m.excerpt, m.tags_json, m.is_pinned,
+ `SELECT m.id, ${syncMemoNotebookIdSql} AS notebook_id, m.title, m.excerpt, m.tags_json, m.is_pinned,
m.is_archived, m.is_deleted, m.created_at, m.updated_at, m.deleted_at, mc.revision,
mc.content_json, mc.content_markdown, mc.content_text, mc.content_hash,
m.source_memo_ids, m.merge_source_count, m.merged_into_memo_id
@@ -168,7 +201,7 @@ export const registerSyncRoutes = (
Promise.all(splitSyncDetailIds(memoIds).map((batch) => {
const placeholders = batch.map(() => "?").join(", ");
return context.env.storage.db.prepare(
- `SELECT m.id, m.notebook_id, m.title, m.excerpt, m.tags_json, m.is_pinned,
+ `SELECT m.id, ${syncMemoNotebookIdSql} AS notebook_id, m.title, m.excerpt, m.tags_json, m.is_pinned,
m.is_archived, m.is_deleted, m.created_at, m.updated_at, m.deleted_at, mc.revision,
mc.content_json, mc.content_markdown, mc.content_text, mc.content_hash,
m.source_memo_ids, m.merge_source_count, m.merged_into_memo_id
@@ -180,7 +213,7 @@ export const registerSyncRoutes = (
Promise.all(splitSyncDetailIds(notebookIds).map((batch) => {
const placeholders = batch.map(() => "?").join(", ");
return context.env.storage.db.prepare(
- `SELECT n.id, n.parent_id, n.name, n.slug, n.icon, n.color, n.sort_order,
+ `SELECT n.id, ${syncNotebookParentIdSql} AS parent_id, n.name, n.slug, n.icon, n.color, n.sort_order,
n.created_at, n.updated_at, COUNT(m.id) AS memo_count, MAX(m.updated_at) AS last_memo_updated_at
FROM notebooks n
LEFT JOIN memos m ON m.notebook_id = n.id AND m.workspace_id = n.workspace_id AND m.is_deleted = 0
diff --git a/crates/desktop-sidecar/src/main.rs b/crates/desktop-sidecar/src/main.rs
index b78be099..2687f33c 100644
--- a/crates/desktop-sidecar/src/main.rs
+++ b/crates/desktop-sidecar/src/main.rs
@@ -347,13 +347,17 @@ mod tests {
}
#[test]
- fn remote_merge_links_tolerate_bootstrap_page_order() {
+ fn remote_memo_references_tolerate_bootstrap_order_and_deleted_notebooks() {
let database = Connection::open_in_memory().unwrap();
database
.execute_batch(
"PRAGMA foreign_keys = ON;
CREATE TABLE _edgeever_sidecar_meta (key TEXT PRIMARY KEY, value TEXT NOT NULL, updated_at TEXT NOT NULL);
- CREATE TABLE notebooks (id TEXT PRIMARY KEY);
+ CREATE TABLE notebooks (
+ id TEXT PRIMARY KEY,
+ slug TEXT,
+ is_deleted INTEGER NOT NULL DEFAULT 0
+ );
CREATE TABLE memos (
id TEXT PRIMARY KEY,
notebook_id TEXT NOT NULL REFERENCES notebooks(id),
@@ -379,33 +383,34 @@ mod tests {
revision INTEGER NOT NULL,
updated_at TEXT NOT NULL DEFAULT 'now'
);
- INSERT INTO notebooks VALUES ('notebook-1');",
+ INSERT INTO notebooks (id, slug) VALUES ('notebook-1', 'notes'), ('nb_inbox', 'inbox');",
)
.unwrap();
- let memo = |id: &str, merged_into: Option<&str>, source_ids: Vec<&str>| {
- json!({
- "id": id,
- "notebookId": "notebook-1",
- "title": id,
- "excerpt": "",
- "tags": [],
- "isPinned": false,
- "isArchived": false,
- "isDeleted": merged_into.is_some(),
- "sourceMemoIds": source_ids,
- "mergeSourceCount": 0,
- "mergedIntoMemoId": merged_into,
- "createdAt": "2026-09-06T00:00:00.000Z",
- "updatedAt": "2026-09-06T00:00:00.000Z",
- "deletedAt": merged_into.map(|_| "2026-09-06T00:00:00.000Z"),
- "contentJson": { "type": "doc", "content": [] },
- "contentMarkdown": "",
- "contentText": "",
- "contentHash": id,
- "revision": 0
- })
- };
+ let memo =
+ |id: &str, merged_into: Option<&str>, source_ids: Vec<&str>, notebook_id: &str| {
+ json!({
+ "id": id,
+ "notebookId": notebook_id,
+ "title": id,
+ "excerpt": "",
+ "tags": [],
+ "isPinned": false,
+ "isArchived": false,
+ "isDeleted": merged_into.is_some(),
+ "sourceMemoIds": source_ids,
+ "mergeSourceCount": 0,
+ "mergedIntoMemoId": merged_into,
+ "createdAt": "2026-09-06T00:00:00.000Z",
+ "updatedAt": "2026-09-06T00:00:00.000Z",
+ "deletedAt": merged_into.map(|_| "2026-09-06T00:00:00.000Z"),
+ "contentJson": { "type": "doc", "content": [] },
+ "contentMarkdown": "",
+ "contentText": "",
+ "contentHash": id,
+ "revision": 0
+ })
+ };
let apply_memo = |value: Value| {
let id = value.get("id").and_then(Value::as_str).unwrap().to_owned();
apply_sync_changes(
@@ -420,7 +425,7 @@ mod tests {
.unwrap();
};
- apply_memo(memo("source-before", Some("merged"), vec![]));
+ apply_memo(memo("source-before", Some("merged"), vec![], "notebook-1"));
assert_eq!(
database
.query_row(
@@ -432,8 +437,13 @@ mod tests {
None
);
- apply_memo(memo("merged", None, vec!["source-before", "source-after"]));
- apply_memo(memo("source-after", Some("merged"), vec![]));
+ apply_memo(memo(
+ "merged",
+ None,
+ vec!["source-before", "source-after"],
+ "notebook-1",
+ ));
+ apply_memo(memo("source-after", Some("merged"), vec![], "notebook-1"));
for source_id in ["source-before", "source-after"] {
assert_eq!(
@@ -448,5 +458,17 @@ mod tests {
Some("merged")
);
}
+
+ apply_memo(memo("trashed", None, vec![], "deleted-notebook"));
+ assert_eq!(
+ database
+ .query_row(
+ "SELECT notebook_id FROM memos WHERE id = 'trashed'",
+ [],
+ |row| row.get::<_, String>(0),
+ )
+ .unwrap(),
+ "nb_inbox"
+ );
}
}
diff --git a/crates/desktop-sidecar/src/sync.rs b/crates/desktop-sidecar/src/sync.rs
index 1f4037d0..a77e8401 100644
--- a/crates/desktop-sidecar/src/sync.rs
+++ b/crates/desktop-sidecar/src/sync.rs
@@ -683,7 +683,22 @@ pub(crate) fn apply_sync_changes(database: &Connection, params: &Value) -> Resul
.get("contentJson")
.cloned()
.unwrap_or_else(|| json!({"type":"doc","content":[]}));
- tx.execute("INSERT INTO memos (id, notebook_id, title, excerpt, tags_json, is_pinned, is_archived, is_deleted, source_memo_ids, merge_source_count, merged_into_memo_id, created_at, updated_at, deleted_at) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14) ON CONFLICT(id) DO UPDATE SET notebook_id=excluded.notebook_id, title=excluded.title, excerpt=excluded.excerpt, tags_json=excluded.tags_json, is_pinned=excluded.is_pinned, is_archived=excluded.is_archived, is_deleted=excluded.is_deleted, source_memo_ids=excluded.source_memo_ids, merge_source_count=excluded.merge_source_count, merged_into_memo_id=excluded.merged_into_memo_id, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at", rusqlite::params![entity_id, string_param(memo, "notebookId")?, memo.get("title").and_then(Value::as_str), string_param(memo, "excerpt")?, tags, memo.get("isPinned").and_then(Value::as_bool).unwrap_or(false) as i64, memo.get("isArchived").and_then(Value::as_bool).unwrap_or(false) as i64, memo.get("isDeleted").and_then(Value::as_bool).unwrap_or(false) as i64, source_ids, memo.get("mergeSourceCount").and_then(Value::as_i64).unwrap_or(0), merge_target, string_param(memo, "createdAt")?, string_param(memo, "updatedAt")?, memo.get("deletedAt").and_then(Value::as_str)]).map_err(|e| e.to_string())?;
+ let requested_notebook_id = string_param(memo, "notebookId")?;
+ let notebook_id = tx
+ .query_row(
+ "SELECT CASE
+ WHEN EXISTS(SELECT 1 FROM notebooks WHERE id = ?1 AND is_deleted = 0) THEN ?1
+ ELSE (SELECT id FROM notebooks WHERE slug = 'inbox' AND is_deleted = 0 ORDER BY id LIMIT 1)
+ END",
+ [&requested_notebook_id],
+ |row| row.get::<_, Option<String>>(0),
+ )
+ .map_err(|e| e.to_string())?
+ .ok_or_else(|| {
+ "Sync memo references an unavailable notebook, and the local inbox is unavailable"
+ .to_owned()
+ })?;
+ tx.execute("INSERT INTO memos (id, notebook_id, title, excerpt, tags_json, is_pinned, is_archived, is_deleted, source_memo_ids, merge_source_count, merged_into_memo_id, created_at, updated_at, deleted_at) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14) ON CONFLICT(id) DO UPDATE SET notebook_id=excluded.notebook_id, title=excluded.title, excerpt=excluded.excerpt, tags_json=excluded.tags_json, is_pinned=excluded.is_pinned, is_archived=excluded.is_archived, is_deleted=excluded.is_deleted, source_memo_ids=excluded.source_memo_ids, merge_source_count=excluded.merge_source_count, merged_into_memo_id=excluded.merged_into_memo_id, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at", rusqlite::params![entity_id, notebook_id, memo.get("title").and_then(Value::as_str), string_param(memo, "excerpt")?, tags, memo.get("isPinned").and_then(Value::as_bool).unwrap_or(false) as i64, memo.get("isArchived").and_then(Value::as_bool).unwrap_or(false) as i64, memo.get("isDeleted").and_then(Value::as_bool).unwrap_or(false) as i64, source_ids, memo.get("mergeSourceCount").and_then(Value::as_i64).unwrap_or(0), merge_target, string_param(memo, "createdAt")?, string_param(memo, "updatedAt")?, memo.get("deletedAt").and_then(Value::as_str)]).map_err(|e| e.to_string())?;
tx.execute("INSERT INTO memo_contents (memo_id, content_json, content_markdown, content_text, content_hash, revision) VALUES (?1, ?2, ?3, ?4, ?5, ?6) ON CONFLICT(memo_id) DO UPDATE SET content_json=excluded.content_json, content_markdown=excluded.content_markdown, content_text=excluded.content_text, content_hash=excluded.content_hash, revision=excluded.revision, updated_at=strftime('%Y-%m-%dT%H:%M:%fZ','now')", rusqlite::params![entity_id, content_json.to_string(), string_param(memo, "contentMarkdown")?, string_param(memo, "contentText")?, string_param(memo, "contentHash")?, memo.get("revision").and_then(Value::as_i64).unwrap_or(0)]).map_err(|e| e.to_string())?;
for source_id in source_memo_ids.iter().filter_map(Value::as_str) {
tx.execute(
diff --git a/scripts/test-desktop-sidecar.mjs b/scripts/test-desktop-sidecar.mjs
index 76aa03b7..034bdff8 100644
--- a/scripts/test-desktop-sidecar.mjs
+++ b/scripts/test-desktop-sidecar.mjs
@@ -47,19 +47,24 @@ if (process.platform !== "win32") {
assert.equal(statSync(join(dataDir, "edgeever.sqlite")).mode & 0o777, 0o600, "sidecar database should be private");
}
-const remoteMemo = (id, { mergedIntoMemoId = null, sourceMemoIds = [] } = {}) => ({
+const remoteMemo = (id, {
+ mergedIntoMemoId = null,
+ sourceMemoIds = [],
+ notebookId = inbox.id,
+ isDeleted = Boolean(mergedIntoMemoId),
+} = {}) => ({
id,
- notebookId: inbox.id,
+ notebookId,
title: id,
excerpt: "",
tags: [],
isPinned: false,
isArchived: false,
- isDeleted: Boolean(mergedIntoMemoId),
+ isDeleted,
revision: 0,
createdAt: "2026-09-06T00:00:00.000Z",
updatedAt: "2026-09-06T00:00:00.000Z",
- deletedAt: mergedIntoMemoId ? "2026-09-06T00:00:00.000Z" : null,
+ deletedAt: isDeleted ? "2026-09-06T00:00:00.000Z" : null,
contentJson: { type: "doc", content: [] },
contentMarkdown: "",
contentText: "",
@@ -93,6 +98,19 @@ for (const sourceId of ["memo_e2e_merge_source_before", "memo_e2e_merge_source_a
}
assert.equal((await request("memo.emptyTrash")).deleted, 2, "merge-order fixtures should not leak into later scenarios");
+// Regression for #371: older servers can return a trashed memo whose original
+// notebook is no longer part of the active notebook snapshot.
+await applyRemoteMemo(remoteMemo("memo_e2e_deleted_notebook", {
+ notebookId: "notebook_deleted_on_server",
+ isDeleted: true,
+}));
+assert.equal(
+ (await request("memo.get", { memoId: "memo_e2e_deleted_notebook", includeDeleted: true })).memo.notebookId,
+ inbox.id,
+ "a missing remote notebook should fall back to the local inbox",
+);
+assert.equal((await request("memo.emptyTrash")).deleted, 1, "deleted-notebook fixture should not leak into later scenarios");
+
const first = await request("memo.create", { notebookId: inbox.id, title: "Local first", contentMarkdown: "searchable body", tags: ["local"] });
assert.deepEqual(await request("sync.bootstrap.prepare"), { clearedSeedData: false, rebuiltMirror: false });
assert.equal((await request("memo.get", { memoId: first.memo.id })).memo.id, first.memo.id, "bootstrap preparation must preserve local user data");
@@ -386,4 +404,4 @@ assert.equal((await request("sync.status")).conflict, 0);
child.stdin.end();
await new Promise((resolve) => child.once("close", resolve));
-console.log(JSON.stringify({ ok: true, checked: ["memo.create", "memo.list.search", "memo.list.subtree", "memo.update", "memo.update.coalesce", "memo.revisions", "memo.restoreRevision", "memo.revision.cache", "tag.rename", "memo.moveBatch", "memo.pinBatch", "memo.deleteBatch", "memo.restore", "memo.emptyTrash", "memo.merge", "template.cache", "template.create.payload", "template.delete", "storage.backup", "storage.backups", "storage.restore", "sync.apply.merge-page-order", "sync.outbox", "sync.outbox.retry", "sync.outbox.recoverMemoUpdate", "sync.outbox.discard"] }));
+console.log(JSON.stringify({ ok: true, checked: ["memo.create", "memo.list.search", "memo.list.subtree", "memo.update", "memo.update.coalesce", "memo.revisions", "memo.restoreRevision", "memo.revision.cache", "tag.rename", "memo.moveBatch", "memo.pinBatch", "memo.deleteBatch", "memo.restore", "memo.emptyTrash", "memo.merge", "template.cache", "template.create.payload", "template.delete", "storage.backup", "storage.backups", "storage.restore", "sync.apply.merge-page-order", "sync.apply.deleted-notebook", "sync.outbox", "sync.outbox.retry", "sync.outbox.recoverMemoUpdate", "sync.outbox.discard"] }));