From c902da43b71f35355fffb664a70313bb724291c9 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 30 Jun 2026 07:36:29 +0000 Subject: [PATCH] Delete unused ReplaceComplexFormTypeChange ReplaceComplexFormTypeChange was never registered in LcmCrdtKernel and is never constructed by any code path. Replacing a complex form type already works via Remove+Add: the EntrySync diff API's Replace is a no-op, so a swap (old id -> new id) flows through RemoveComplexFormType + AddComplexFormType. Because the change was never registered, no client could have serialized or applied one, so removing it is safe. Also drop the now-obsolete test exclusion that referenced it. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01YX1riHKjttP2Eemy2ji6uS --- .../LcmCrdt.Tests/ConfigRegistrationTests.cs | 2 -- .../Entries/ReplaceComplexFormTypeChange.cs | 19 ------------------- 2 files changed, 21 deletions(-) delete mode 100644 backend/FwLite/LcmCrdt/Changes/Entries/ReplaceComplexFormTypeChange.cs diff --git a/backend/FwLite/LcmCrdt.Tests/ConfigRegistrationTests.cs b/backend/FwLite/LcmCrdt.Tests/ConfigRegistrationTests.cs index bd3f0a41e8..de8092deca 100644 --- a/backend/FwLite/LcmCrdt.Tests/ConfigRegistrationTests.cs +++ b/backend/FwLite/LcmCrdt.Tests/ConfigRegistrationTests.cs @@ -1,6 +1,5 @@ using FluentAssertions.Execution; using LcmCrdt.Changes; -using LcmCrdt.Changes.Entries; using SIL.Harmony.Changes; using SIL.Harmony.Resource; @@ -12,7 +11,6 @@ public class ConfigRegistrationTests private readonly HashSet _excludedChangeTypes = [ - typeof(ReplaceComplexFormTypeChange), //not currently in use typeof(JsonPatchChange), //not supported typeof(JsonPatchChange), //not supported typeof(JsonPatchChange), //replaced by JsonPatchExampleSentenceChange diff --git a/backend/FwLite/LcmCrdt/Changes/Entries/ReplaceComplexFormTypeChange.cs b/backend/FwLite/LcmCrdt/Changes/Entries/ReplaceComplexFormTypeChange.cs deleted file mode 100644 index 2c7b6686fa..0000000000 --- a/backend/FwLite/LcmCrdt/Changes/Entries/ReplaceComplexFormTypeChange.cs +++ /dev/null @@ -1,19 +0,0 @@ -using SIL.Harmony.Changes; -using SIL.Harmony.Core; -using SIL.Harmony.Entities; - -namespace LcmCrdt.Changes.Entries; - -public class ReplaceComplexFormTypeChange(Guid entityId, ComplexFormType newComplexFormType, Guid oldComplexFormTypeId) : EditChange(entityId), ISelfNamedType -{ - public ComplexFormType NewComplexFormType { get; } = newComplexFormType; - public Guid OldComplexFormTypeId { get; } = oldComplexFormTypeId; - - public override async ValueTask ApplyChange(Entry entity, IChangeContext context) - { - entity.ComplexFormTypes.RemoveAll(t => t.Id == OldComplexFormTypeId); - if (entity.ComplexFormTypes.Any(t => t.Id == NewComplexFormType.Id)) return; - if (await context.IsObjectDeleted(NewComplexFormType.Id)) return; - entity.ComplexFormTypes.Add(NewComplexFormType); - } -}