Persist partial-load edits and hold synchronization until a durable full base
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import {validateLoadingCompletion} from './loading.ts';
|
||||
import { withLocalLifecycles } from './elision.ts';
|
||||
import type { Change, Document, FieldChange, HistoryState, Id, Json, OperationIntent, Registry } from '../canvas-core/types.ts';
|
||||
import { describeHistoryTransition, historyTransitionChanges, type HistoryTransition } from '../canvas-core/history-transition.ts';
|
||||
@@ -28,7 +29,7 @@ const documentValue = (document: Document) => ({projectId:document.projectId,can
|
||||
|
||||
/** Pure proposal. Explicit choices cover the complete pending dependency closure; no key/body is reused. */
|
||||
export function planConflictRecovery(snapshot: EngineSnapshot, canonical: CanonicalProposal, choices: ReadonlyMap<Id,RecoveryChoice>, registry: Registry, createId:()=>Id,historyLimit=100): ConflictPlan {
|
||||
validateCanonicalRead(snapshot.runtime.acknowledged,snapshot.runtime.versions,canonical.document,canonical.versions,registry);
|
||||
if(snapshot.runtime.loading)validateLoadingCompletion(snapshot.runtime.acknowledged,snapshot.runtime.versions,snapshot.runtime.loading,canonical.document,canonical.versions,registry,true);else validateCanonicalRead(snapshot.runtime.acknowledged,snapshot.runtime.versions,canonical.document,canonical.versions,registry);
|
||||
if([...snapshot.runtime.ledger.requests.values()].some(request=>request.phase!=='resolved'))throw fault('recovery_waiting_for_receipts');
|
||||
const records=[...snapshot.runtime.ledger.operations.values()].filter(record=>record.phase!=='resolved'&&record.intent.operationType!=='asset.upload').sort((a,b)=>a.intent.sequence-b.intent.sequence);
|
||||
if(!records.length)throw fault('recovery_nothing_to_resolve');
|
||||
|
||||
Reference in New Issue
Block a user