Revert "Add an experiment to skip envelope expansion"

This reverts commit 0d32ca120d.
This commit is contained in:
Jon Chambers authored and Jon Chambers committed 2026-06-03 12:00:34 -04:00
1 parent 324c4eafb6
commit 27fb4f227d
2 files changed
-37

No files matched your search

@@ -24,9 +24,6 @@ public class EnvelopeUtil {
@VisibleForTesting
static final String INCLUDE_BINARY_SERVICE_ID_EXPERIMENT_NAME = "envelopeIncludeBinaryServiceIdentifier";
@VisibleForTesting
static final String SKIP_EXPANSION_EXPERIMENT_NAME = "skipEnvelopeExpansion";
/**
* Converts all "compressible" UUID-like fields in the given envelope to more compact binary representations.
*
@@ -80,7 +77,6 @@ public class EnvelopeUtil {
final ExperimentEnrollmentManager experimentEnrollmentManager) {
final boolean includeBinaryServiceIdentifiers;
final boolean skipEnvelopeExpansion;
if (envelope.hasDestinationServiceIdBinary() || envelope.hasDestinationServiceId()) {
final ServiceIdentifier destinationIdentifier = envelope.hasDestinationServiceIdBinary()
@@ -89,16 +85,8 @@ public class EnvelopeUtil {
includeBinaryServiceIdentifiers =
experimentEnrollmentManager.isEnrolled(destinationIdentifier.uuid(), INCLUDE_BINARY_SERVICE_ID_EXPERIMENT_NAME);
skipEnvelopeExpansion =
experimentEnrollmentManager.isEnrolled(destinationIdentifier.uuid(), SKIP_EXPANSION_EXPERIMENT_NAME);
} else {
includeBinaryServiceIdentifiers = false;
skipEnvelopeExpansion = false;
}
if (skipEnvelopeExpansion) {
return envelope;
}
final MessageProtos.Envelope.Builder builder = envelope.toBuilder();
@@ -16,7 +16,6 @@ import static org.mockito.Mockito.when;
import com.google.protobuf.ByteString;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.whispersystems.textsecuregcm.entities.MessageProtos;
@@ -117,30 +116,6 @@ class EnvelopeUtilTest {
}
}
@Test
void compressExpandSkipExpansion() {
final ExperimentEnrollmentManager experimentEnrollmentManager = mock(ExperimentEnrollmentManager.class);
when(experimentEnrollmentManager.isEnrolled(any(UUID.class), eq(EnvelopeUtil.SKIP_EXPANSION_EXPERIMENT_NAME)))
.thenReturn(true);
final ServiceIdentifier sourceServiceId = generateRandomServiceIdentifier();
final ServiceIdentifier destinationServiceId = generateRandomServiceIdentifier();
final UUID serverGuid = UUID.randomUUID();
final UUID updatedPni = UUID.randomUUID();
final MessageProtos.Envelope compressed = generateRandomMessageBuilder()
.setSourceServiceIdBinary(ServiceIdentifierUtil.toCompactByteString(sourceServiceId))
.setDestinationServiceIdBinary(ServiceIdentifierUtil.toCompactByteString(destinationServiceId))
.setServerGuidBinary(UUIDUtil.toByteString(serverGuid))
.setUpdatedPniBinary(UUIDUtil.toByteString(updatedPni))
.build();
final MessageProtos.Envelope expanded = EnvelopeUtil.expand(compressed, experimentEnrollmentManager);
assertEquals(compressed, expanded,
"Compressed message should be returned unchanged when enrolled in 'skip expansion' experiment");
}
private static ServiceIdentifier generateRandomServiceIdentifier() {
final IdentityType identityType = ThreadLocalRandom.current().nextBoolean() ? IdentityType.ACI : IdentityType.PNI;