From 9c037ebc8fcb05fb9f3a322e7cf76d4f66fce1cf Mon Sep 17 00:00:00 2001 From: Tim Haasdyk Date: Tue, 21 Jul 2026 17:55:01 +0200 Subject: [PATCH] Remove unused SetComplexFormComponentChange change type No production code creates this change since #1816, and a prod query confirmed no CrdtCommits reference it, so retire the type and its registration/serialization test fixtures. Co-Authored-By: Claude Opus 4.8 --- ...lizationRegressionData.latest.verified.txt | 21 --------- .../Changes/ChangeSerializationTests.cs | 10 ---- .../LcmCrdt.Tests/Changes/UseChangesTests.cs | 3 -- ...pshotTests.VerifyChangeModels.verified.txt | 4 -- .../Entries/SetComplexFormComponentChange.cs | 47 ------------------- backend/FwLite/LcmCrdt/LcmCrdtKernel.cs | 1 - 6 files changed, 86 deletions(-) delete mode 100644 backend/FwLite/LcmCrdt/Changes/Entries/SetComplexFormComponentChange.cs diff --git a/backend/FwLite/LcmCrdt.Tests/Changes/ChangeDeserializationRegressionData.latest.verified.txt b/backend/FwLite/LcmCrdt.Tests/Changes/ChangeDeserializationRegressionData.latest.verified.txt index 7f69699419..5a205e5952 100644 --- a/backend/FwLite/LcmCrdt.Tests/Changes/ChangeDeserializationRegressionData.latest.verified.txt +++ b/backend/FwLite/LcmCrdt.Tests/Changes/ChangeDeserializationRegressionData.latest.verified.txt @@ -890,27 +890,6 @@ "Order": 0.1655437666547228, "EntityId": "e92d4673-888c-3204-0767-17adc2a2405e" }, - { - "$type": "SetComplexFormComponentChange", - "ComplexFormEntryId": "bf296463-7b81-4a33-b9e7-6f4f8179715e", - "ComponentEntryId": null, - "ComponentSenseId": null, - "EntityId": "d5c89801-cedc-403e-9ed6-f734ad0ddf23" - }, - { - "$type": "SetComplexFormComponentChange", - "ComplexFormEntryId": null, - "ComponentEntryId": "470eb4a9-50d7-4c28-93b2-019b1e5cf9d6", - "ComponentSenseId": null, - "EntityId": "beaa8382-2b49-45a5-81eb-e5825004fb98" - }, - { - "$type": "SetComplexFormComponentChange", - "ComplexFormEntryId": null, - "ComponentEntryId": "e0d469cd-9d2f-44f5-8147-102f683c18ed", - "ComponentSenseId": "7a1c054f-472a-473f-afed-16f75fe9a90f", - "EntityId": "01b98e0e-c95f-430d-9512-9db44fdf7b2a" - }, { "$type": "jsonPatch:Publication", "PatchDocument": [], diff --git a/backend/FwLite/LcmCrdt.Tests/Changes/ChangeSerializationTests.cs b/backend/FwLite/LcmCrdt.Tests/Changes/ChangeSerializationTests.cs index e228d44272..524c9a8bf7 100644 --- a/backend/FwLite/LcmCrdt.Tests/Changes/ChangeSerializationTests.cs +++ b/backend/FwLite/LcmCrdt.Tests/Changes/ChangeSerializationTests.cs @@ -2,7 +2,6 @@ using System.Text.Json; using System.Text.Json.Nodes; using FluentAssertions.Execution; -using LcmCrdt.Changes.Entries; using LcmCrdt.Tests.Data; using SIL.Harmony.Changes; @@ -12,15 +11,6 @@ public class ChangeSerializationTests : BaseSerializationTest { private static IEnumerable GeneratedChangesForType(Type type) { - //can't generate this type because there's no public constructor - if (type == typeof(SetComplexFormComponentChange)) - { - yield return SetComplexFormComponentChange.NewComplexForm(Guid.NewGuid(), Guid.NewGuid()); - yield return SetComplexFormComponentChange.NewComponent(Guid.NewGuid(), Guid.NewGuid()); - yield return SetComplexFormComponentChange.NewComponentSense(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()); - yield break; - } - object change; try { diff --git a/backend/FwLite/LcmCrdt.Tests/Changes/UseChangesTests.cs b/backend/FwLite/LcmCrdt.Tests/Changes/UseChangesTests.cs index c758631717..6fa879794e 100644 --- a/backend/FwLite/LcmCrdt.Tests/Changes/UseChangesTests.cs +++ b/backend/FwLite/LcmCrdt.Tests/Changes/UseChangesTests.cs @@ -237,9 +237,6 @@ private static IEnumerable GetAllChanges() var createcomponentEntryChange = new CreateEntryChange(componentEntry); yield return new ChangeWithDependencies(createcomponentEntryChange); - var setComplexFormComponentChange = SetComplexFormComponentChange.NewComponent(complexFormComponent.Id, componentEntry.Id); - yield return new ChangeWithDependencies(setComplexFormComponentChange, [createcomponentEntryChange, createComplexFormComponentChange]); - var setSenseOrderChange = new LcmCrdt.Changes.SetOrderChange(sense.Id, 10); yield return new ChangeWithDependencies(setSenseOrderChange, [createSenseChange]); diff --git a/backend/FwLite/LcmCrdt.Tests/DataModelSnapshotTests.VerifyChangeModels.verified.txt b/backend/FwLite/LcmCrdt.Tests/DataModelSnapshotTests.VerifyChangeModels.verified.txt index 5ba58a01e9..941f7d88d2 100644 --- a/backend/FwLite/LcmCrdt.Tests/DataModelSnapshotTests.VerifyChangeModels.verified.txt +++ b/backend/FwLite/LcmCrdt.Tests/DataModelSnapshotTests.VerifyChangeModels.verified.txt @@ -95,10 +95,6 @@ DerivedType: ReplacePublicationChange, TypeDiscriminator: ReplacePublicationChange }, - { - DerivedType: SetComplexFormComponentChange, - TypeDiscriminator: SetComplexFormComponentChange - }, { DerivedType: AddTranslationChange, TypeDiscriminator: AddTranslationChange diff --git a/backend/FwLite/LcmCrdt/Changes/Entries/SetComplexFormComponentChange.cs b/backend/FwLite/LcmCrdt/Changes/Entries/SetComplexFormComponentChange.cs deleted file mode 100644 index e88a5a44d7..0000000000 --- a/backend/FwLite/LcmCrdt/Changes/Entries/SetComplexFormComponentChange.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System.Text.Json.Serialization; -using LcmCrdt.Objects; -using SIL.Harmony.Changes; -using SIL.Harmony.Core; -using SIL.Harmony.Entities; - -namespace LcmCrdt.Changes.Entries; - -public class SetComplexFormComponentChange : EditChange, ISelfNamedType -{ - [JsonConstructor] - protected SetComplexFormComponentChange(Guid entityId, Guid? complexFormEntryId, Guid? componentEntryId, Guid? componentSenseId) : base(entityId) - { - ComplexFormEntryId = complexFormEntryId; - ComponentEntryId = componentEntryId; - ComponentSenseId = componentSenseId; - } - - public static SetComplexFormComponentChange NewComplexForm(Guid id, Guid complexFormEntryId) => new(id, complexFormEntryId, null, null); - public static SetComplexFormComponentChange NewComponent(Guid id, Guid componentEntryId) => new(id, null, componentEntryId, null); - public static SetComplexFormComponentChange NewComponentSense(Guid id, Guid componentEntryId, Guid? componentSenseId) => new(id, null, componentEntryId, componentSenseId); - public Guid? ComplexFormEntryId { get; } - public Guid? ComponentEntryId { get; } - public Guid? ComponentSenseId { get; } - public override async ValueTask ApplyChange(ComplexFormComponent entity, IChangeContext context) - { - if (ComplexFormEntryId.HasValue) - { - entity.ComplexFormEntryId = ComplexFormEntryId.Value; - var complexFormEntry = await context.GetCurrent(ComplexFormEntryId.Value); - entity.ComplexFormHeadword = complexFormEntry?.Headword(); - entity.DeletedAt = complexFormEntry?.DeletedAt != null ? context.Commit.DateTime : (DateTime?)null; - } - if (ComponentEntryId.HasValue) - { - entity.ComponentEntryId = ComponentEntryId.Value; - var componentEntry = await context.GetCurrent(ComponentEntryId.Value); - entity.ComponentHeadword = componentEntry?.Headword(); - entity.DeletedAt = componentEntry?.DeletedAt != null ? context.Commit.DateTime : (DateTime?)null; - } - entity.ComponentSenseId = ComponentSenseId; - if (ComponentSenseId.HasValue) - { - entity.DeletedAt = await context.IsObjectDeleted(ComponentSenseId.Value) ? context.Commit.DateTime : (DateTime?)null; - } - } -} diff --git a/backend/FwLite/LcmCrdt/LcmCrdtKernel.cs b/backend/FwLite/LcmCrdt/LcmCrdtKernel.cs index 65b2863e37..4e5f4be1d3 100644 --- a/backend/FwLite/LcmCrdt/LcmCrdtKernel.cs +++ b/backend/FwLite/LcmCrdt/LcmCrdtKernel.cs @@ -376,7 +376,6 @@ public static void ConfigureCrdt(CrdtConfig config, bool addRemoteResourceEntity .Add() .Add() .Add() - .Add() .Add() .Add() .Add()