From 74bc8f8cd12ae1a06daf9ec165e51a0145c6683e Mon Sep 17 00:00:00 2001 From: supportswift Date: Fri, 17 Jul 2026 13:31:49 -0500 Subject: [PATCH] =?UTF-8?q?fix(sync):=20crash-safe=20renames=20loop=20?= =?UTF-8?q?=E2=80=94=20record=20per-file=20failures=20instead=20of=20throw?= =?UTF-8?q?ing=20(#2402)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The renames loop reimports each renamed file via importFile() but, unlike the deletes and adds/mods loops, does not wrap the call. importFile() still throws on content sanity-block, duplicate-slug, and missing-link endpoints, so a single malformed renamed file throws uncaught and crashes the whole sync mid-run — freezing the checkpoint and defeating --skip-failed. A 'skipped' result carrying an error was also silently dropped (never recorded to failedFiles). This wraps the reimport in try/catch and records both the throw and the skipped-with-error case to failedFiles, matching the existing deletes/adds loop pattern. Surfaced in the wild by a tree-wide rename (a shared/ -> system/ vault migration, ~10.8k renames) where one malformed-YAML renamed file crashed the entire incremental sync at rename ~4900/10857. Co-authored-by: jaxlewis-swift --- src/commands/sync.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/commands/sync.ts b/src/commands/sync.ts index ff245ef0a..eb5b98f58 100644 --- a/src/commands/sync.ts +++ b/src/commands/sync.ts @@ -2306,11 +2306,24 @@ async function performSyncInner(engine: BrainEngine, opts: SyncOpts): Promise