@@ -23,16 +23,16 @@ interface DeletePromptState {
2323 fileNames : Set < string >
2424}
2525
26- interface DeferredSyncComplete {
26+ export interface PendingSyncCompletionEvent {
2727 totalCount : number
2828 updatedCount : number
2929 unchangedCount : number
3030}
3131
32- export type PendingSyncCompleteResult =
33- | { is : "ready" ; payload : DeferredSyncComplete }
34- | { is : "blocked" }
35- | { is : "empty" }
32+ type ClaimPendingSyncCompleteResult =
33+ | { status : "ready" ; payload : PendingSyncCompletionEvent }
34+ | { status : "blocked" }
35+ | { status : "empty" }
3636
3737interface ConflictPromptState {
3838 session : PromptSession
@@ -99,7 +99,7 @@ export class SyncRuntime {
9999
100100 private activeDeletePrompt : DeletePromptState | null = null
101101 private activeConflictPrompt : ConflictPromptState | null = null
102- private pendingSyncComplete : DeferredSyncComplete | null = null
102+ private pendingSyncCompletionEvent : PendingSyncCompletionEvent | null = null
103103
104104 installer : Installer | null = null
105105
@@ -248,29 +248,29 @@ export class SyncRuntime {
248248 return this . activeDeletePrompt !== null || this . activeConflictPrompt !== null
249249 }
250250
251- addPendingSyncComplete ( syncComplete : DeferredSyncComplete ) : void {
252- this . pendingSyncComplete =
253- this . pendingSyncComplete === null
251+ deferSyncComplete ( syncComplete : PendingSyncCompletionEvent ) : void {
252+ this . pendingSyncCompletionEvent =
253+ this . pendingSyncCompletionEvent === null
254254 ? syncComplete
255255 : {
256- totalCount : this . pendingSyncComplete . totalCount + syncComplete . totalCount ,
257- updatedCount : this . pendingSyncComplete . updatedCount + syncComplete . updatedCount ,
258- unchangedCount : this . pendingSyncComplete . unchangedCount + syncComplete . unchangedCount ,
256+ totalCount : this . pendingSyncCompletionEvent . totalCount + syncComplete . totalCount ,
257+ updatedCount : this . pendingSyncCompletionEvent . updatedCount + syncComplete . updatedCount ,
258+ unchangedCount : this . pendingSyncCompletionEvent . unchangedCount + syncComplete . unchangedCount ,
259259 }
260260 }
261261
262262 /**
263- * Reads the pending sync-complete and clears it when ready to fire.
263+ * Claims the pending sync-complete event and clears it when ready to fire.
264264 * - `ready`: payload is returned and the slot is cleared.
265265 * - `blocked`: payload remains pending until prompts clear.
266266 * - `empty`: nothing was pending.
267267 */
268- checkPendingSyncComplete ( ) : PendingSyncCompleteResult {
269- if ( this . pendingSyncComplete === null ) return { is : "empty" }
270- if ( this . hasAnyActivePrompt ( ) ) return { is : "blocked" }
271- const syncComplete = this . pendingSyncComplete
272- this . pendingSyncComplete = null
273- return { is : "ready" , payload : syncComplete }
268+ claimPendingSyncComplete ( ) : ClaimPendingSyncCompleteResult {
269+ if ( this . pendingSyncCompletionEvent === null ) return { status : "empty" }
270+ if ( this . hasAnyActivePrompt ( ) ) return { status : "blocked" }
271+ const syncComplete = this . pendingSyncCompletionEvent
272+ this . pendingSyncCompletionEvent = null
273+ return { status : "ready" , payload : syncComplete }
274274 }
275275
276276 invalidateDeletePromptPath ( filePath : string ) : DeletePromptChange {
@@ -391,7 +391,7 @@ export class SyncRuntime {
391391 resetPrompts ( ) : void {
392392 this . activeDeletePrompt = null
393393 this . activeConflictPrompt = null
394- this . pendingSyncComplete = null
394+ this . pendingSyncCompletionEvent = null
395395 }
396396
397397 cleanupUserActions ( ) : void {
0 commit comments