Remove isNewFile

This commit is contained in:
Andras Schmelczer 2026-05-10 18:36:57 +01:00
parent d8b6ec5b77
commit ce995cdc33
8 changed files with 18 additions and 61 deletions

View file

@ -9,8 +9,4 @@ export interface DocumentVersionWithoutContent {
userId: string;
deviceId: string;
contentSize: number;
/**
* True iff this is the first version of the document
*/
isNewFile: boolean;
}

View file

@ -66,7 +66,6 @@ function fakeRemoteVersion(
userId: "user",
deviceId: "device",
contentSize: 100,
isNewFile: true,
...overrides
};
}

View file

@ -618,9 +618,8 @@ export class SyncEventQueue {
// in the queue ahead of it. Once those drain and the doc is
// removed, a still-pending RemoteChange for an earlier version
// would be processed by `processRemoteCreateForNewDocument` (the
// doc is now untracked, and catch-up's `isNewFile=true` semantics
// qualify it as a fresh create), resurrecting the doc on disk
// with stale bytes that disagree with every other agent.
// doc is now untracked), resurrecting the doc on disk with stale
// bytes that disagree with every other agent.
this.purgeRemoteChangesForDocumentId(documentId);
return this.save();
}

View file

@ -703,8 +703,7 @@ export class Syncer {
if (response.isDeleted) {
await this.processRemoteDelete(record.localPath, {
...response,
contentSize: 0,
isNewFile: false
contentSize: 0
});
return;
}
@ -859,14 +858,6 @@ export class Syncer {
return this.processRemoteUpdate(trackedRecord, remoteVersion);
}
if (!remoteVersion.isNewFile) {
this.queue.lastSeenUpdateId = remoteVersion.vaultUpdateId;
this.logger.debug(
`Ignoring stale RemoteChange for untracked, non-new document ${remoteVersion.documentId}`
);
return;
}
return this.processRemoteCreateForNewDocument(remoteVersion);
}