Skip to content

Deleting a complex form in CRDT crashes the FwData sync #2373

Description

@myieye

Syncing CRDT → FwData throws and wedges the whole project sync if a complex form entry was deleted in CRDT while one of its components still exists.

SyncObjectException: Failed to sync complex forms and components of entry 7854f5ab-…
 ---> KeyNotFoundException: Key 99fd574d-… not found in identity map
   at FwDataMiniLcmApi.DeleteComplexFormComponent  FwDataMiniLcmApi.cs:1096
   at EntrySync.ComplexFormsDiffApi.Remove          EntrySync.cs:235

Cause: the FwData-write pass deletes the parent complex form in phase 1 (it's gone in CRDT), which cascades away its relationship. Phase 2 then diffs the surviving component against the stale before-snapshot, sees the edge gone, and calls DeleteComplexFormComponent — which resolves the parent via GetObject and throws because phase 1 already deleted it. Not a conflict; the edge is simply already gone.

Fix: make DeleteComplexFormComponent tolerate a missing parent (TryGetObject + return), mirroring the guard RemoveComplexFormComponent already has for the component side. CRDT already no-ops here. #2367 covered the create/update/move paths but not this delete cascade.

Alternatively, we could reread all the entries so the diff reflects cascaded deletes.

Repro: project rmunn-thai-food-test; regression test FwDataEntrySyncTests.SyncFull_RemovingComplexFormWhoseParentWasDeleted_DoesNotThrow (no infra needed). Fix + test on branch debug-thai-sync-error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions