fix(git-sync): don't trash a page on cross-space move (move-to-space data loss)

A page moved to another space with git-sync enabled was sent to Trash and
vanished from BOTH vaults. The source space's push phase sees the moved-away
page's file gone from its vault and calls deletePage -> soft-delete, even though
the page still lives in the destination space.

Thread the reconciling spaceId into the bind context and, in deletePage, skip the
soft-delete when the page's CURRENT space differs from the space being reconciled
(a move-out): only the vault file is dropped, the page is preserved. Genuine
in-space deletions are unaffected (space matches).

Found by autonomous QA (web-test-orchestrator). Control: with git-sync OFF the
move keeps deleted_at NULL; with it ON the page was trashed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
claude-stand
2026-07-02 13:47:48 +03:00
parent 123e981808
commit c7e034cab9
2 changed files with 31 additions and 1 deletions
@@ -368,7 +368,11 @@ export class GitSyncOrchestrator implements OnModuleInit, OnModuleDestroy {
const { runCycle } = await loadGitSync();
const settings = await this.buildSettings(spaceId);
const vault = await this.vaultRegistry.getVault(spaceId);
const client = this.dataSource.bind({ workspaceId, userId: serviceUserId });
const client = this.dataSource.bind({
workspaceId,
userId: serviceUserId,
spaceId,
});
const result = await runCycle({
// Cooperative-abort signal from the per-space lock: if a heartbeat refresh