From 132578446453108f505611df337ea3f187ddb602 Mon Sep 17 00:00:00 2001 From: Facebook GitHub Bot Date: Thu, 9 Jan 2025 11:47:09 -0800 Subject: [PATCH] Re-sync with internal repository The internal and external repositories are out of sync. This Pull Request attempts to brings them back in sync by patching the GitHub repository. Please carefully review this patch. You must disable ShipIt for your project in order to merge this pull request. DO NOT IMPORT this pull request. Instead, merge it directly on GitHub using the MERGE BUTTON. Re-enable ShipIt after merging. --- .../lib/hack/src/TClientAsyncHandler.php | 2 +- .../lib/hack/src/TClientMultiAsyncHandler.php | 2 +- .../hack/src/TContextPropV2ServerHandler.php | 46 +++--- .../lib/hack/src/ThriftContextPropState.php | 47 ++++++ .../ThriftBacktraceEventHandlerTest.php | 1 + .../ThriftContextPropHandlerTest.php | 1 + ...hriftContextPropServerEventHandlerTest.php | 1 + .../ThriftContextPropStateScopeGuardTest.php | 2 + .../__tests__/ThriftContextPropStateTest.php | 34 +++++ .../__tests__/ThriftImmutableWrapperTest.php | 2 + .../__tests__/ThriftPolicyEnforcerTest.php | 2 +- .../lib/hack/src/__tests__/ThriftUtilTest.php | 2 + .../src/conformance/__tests__/LazyAnyTest.php | 4 + .../__tests__/ThriftTypeStructAdapterTest.php | 1 + .../__tests__/ThriftUniversalNameTest.php | 1 + .../thrift_any/ThriftLazyAnyTests.php | 11 ++ .../contextprop/ThriftContextPropHandlers.php | 144 +++++------------- .../UpdateUniverseContextHandler.php | 130 ++++++++++++++-- .../ExperimentIdContextHandlerTest.php | 2 + .../__tests__/ProductIdContextHandlerTest.php | 2 + .../UpdateUniverseContextHandlerTest.php | 6 +- .../src/protocol/__tests__/AdapterTest.php | 1 + .../protocol/__tests__/FieldWrapperTest.php | 1 + .../protocol/__tests__/ProtocolTest.thrift | 12 ++ .../protocol/__tests__/SerializationTest.php | 2 + .../__tests__/SimplePHPObjectProtocolTest.php | 2 + .../ThriftSerializationHelperTest.php | 23 +++ .../ThriftUnionSerializationTraitTest.php | 2 + .../protocol/__tests__/TypeWrapperTest.php | 1 + .../TBinaryProtocolAcceleratedTestCase.php | 2 + .../__tests__/TBinarySerializerTest.php | 2 + .../TCompactProtocolAcceleratedTest.php | 1 + .../__tests__/TCompactProtocolTest.php | 1 + .../__tests__/TSimpleJSONProtocolTest.php | 2 + .../src/transport/TTransportException.php | 5 - .../__tests__/TChunkedMemoryBufferTest.php | 1 + .../transport/__tests__/TFileStreamTest.php | 2 + .../__tests__/TFramedTransportTestCase.php | 2 + .../transport/__tests__/TMemoryBufferTest.php | 2 + .../__tests__/TTransportExceptionTestCase.php | 2 + 40 files changed, 360 insertions(+), 149 deletions(-) diff --git a/third-party/thrift/src/thrift/lib/hack/src/TClientAsyncHandler.php b/third-party/thrift/src/thrift/lib/hack/src/TClientAsyncHandler.php index 7d0962a965d48..e942ea319bd48 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/TClientAsyncHandler.php +++ b/third-party/thrift/src/thrift/lib/hack/src/TClientAsyncHandler.php @@ -34,7 +34,7 @@ class TClientAsyncHandler { string $service_name, string $func_name, ?IThriftStruct $args = null, - )[zoned_local]: Awaitable { + ): Awaitable { // Do nothing } diff --git a/third-party/thrift/src/thrift/lib/hack/src/TClientMultiAsyncHandler.php b/third-party/thrift/src/thrift/lib/hack/src/TClientMultiAsyncHandler.php index 513c80d84289d..896626b0243a9 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/TClientMultiAsyncHandler.php +++ b/third-party/thrift/src/thrift/lib/hack/src/TClientMultiAsyncHandler.php @@ -52,7 +52,7 @@ public function getHandlers()[]: readonly dict { string $service_name, string $func_name, ?IThriftStruct $args = null, - )[zoned_shallow]: Awaitable { + ): Awaitable { await Vec\map_async( $this->handlers, async $handler ==> diff --git a/third-party/thrift/src/thrift/lib/hack/src/TContextPropV2ServerHandler.php b/third-party/thrift/src/thrift/lib/hack/src/TContextPropV2ServerHandler.php index cec239ee38260..07ee6f4ab3c59 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/TContextPropV2ServerHandler.php +++ b/third-party/thrift/src/thrift/lib/hack/src/TContextPropV2ServerHandler.php @@ -41,6 +41,29 @@ public function preWrite( string $fn_name, mixed $result, ): void { + // keeping this logic in tact from v1 and not moving it to handlers + // because we write to ARTILLERY_TRACING_HEADERS and not TFMR + if ( + JustKnobs::eval('artillery/sdk_www:response_header_propagation_rollout') + ) { + $context_manager = ContextManager::get(); + if ($context_manager->getCoreContext() !== null) { + $ctx_prop_headers = $context_manager->processOutgoingResponse(shape()); + + if ( + C\contains_key( + $ctx_prop_headers, + HTTPResponseHeader::ARTILLERY_TRACING_HEADERS, + ) + ) { + $this->thriftServer->addHTTPHeader( + HTTPResponseHeader::ARTILLERY_TRACING_HEADERS, + $ctx_prop_headers[HTTPResponseHeader::ARTILLERY_TRACING_HEADERS], + ); + } + } + } + $full_params = $this->params; $full_params['fn_name'] = $fn_name; $full_params['fn_result'] = $result; @@ -68,29 +91,6 @@ public function preWrite( HTTPResponseHeader::THRIFT_FRAMEWORK_METADATA_RESPONSE, $encoded_response_tfm, ); - - // keeping this logic in tact from v1 and not moving it to handlers - // because we write to ARTILLERY_TRACING_HEADERS and not TFMR - if ( - JustKnobs::eval('artillery/sdk_www:response_header_propagation_rollout') - ) { - $context_manager = ContextManager::get(); - if ($context_manager->getCoreContext() !== null) { - $ctx_prop_headers = $context_manager->processOutgoingResponse(shape()); - - if ( - C\contains_key( - $ctx_prop_headers, - HTTPResponseHeader::ARTILLERY_TRACING_HEADERS, - ) - ) { - $this->thriftServer->addHTTPHeader( - HTTPResponseHeader::ARTILLERY_TRACING_HEADERS, - $ctx_prop_headers[HTTPResponseHeader::ARTILLERY_TRACING_HEADERS], - ); - } - } - } } } diff --git a/third-party/thrift/src/thrift/lib/hack/src/ThriftContextPropState.php b/third-party/thrift/src/thrift/lib/hack/src/ThriftContextPropState.php index 42dfdf6050d98..d40cec68a8142 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/ThriftContextPropState.php +++ b/third-party/thrift/src/thrift/lib/hack/src/ThriftContextPropState.php @@ -233,6 +233,53 @@ public function getModelTypeId()[]: ?int { return $this->getModelInfo()?->get_model_type_id(); } + // user id getters + public function getUserIds()[]: ?ContextProp\UserIds { + return $this->getBaggage()?->user_ids; + } + + public function getFBUserId()[]: ?int { + return $this->getUserIds()?->fb_user_id; + } + + public function getIGUserId()[]: ?int { + return $this->getUserIds()?->ig_user_id; + } + + // user id setters + public function setUserIds( + ?ContextProp\UserIds $user_ids, + )[write_props]: void { + $this->storage->baggage = + $this->storage->baggage ?? ContextProp\Baggage::withDefaultValues(); + + $baggage = $this->storage->baggage as nonnull; + $baggage->user_ids = $user_ids; + $this->dirty(); + } + + public function setFBUserId(int $fb_user_id)[write_props]: void { + $this->storage->baggage = + $this->storage->baggage ?? ContextProp\Baggage::withDefaultValues(); + $baggage = $this->storage->baggage as nonnull; + + $baggage->user_ids = + $baggage->user_ids ?? ContextProp\UserIds::withDefaultValues(); + $baggage->user_ids->fb_user_id = $fb_user_id; + $this->dirty(); + } + + public function setIGUserId(int $ig_user_id)[write_props]: void { + $this->storage->baggage = + $this->storage->baggage ?? ContextProp\Baggage::withDefaultValues(); + $baggage = $this->storage->baggage as nonnull; + + $baggage->user_ids = + $baggage->user_ids ?? ContextProp\UserIds::withDefaultValues(); + $baggage->user_ids->ig_user_id = $ig_user_id; + $this->dirty(); + } + public function getTraceContext()[]: ?ContextProp\TraceContext { if ($this->storage->baggage is nonnull) { $trace_context = $this->storage->baggage?->trace_context; diff --git a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftBacktraceEventHandlerTest.php b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftBacktraceEventHandlerTest.php index 0211c537ec09a..71dc7a1caef61 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftBacktraceEventHandlerTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftBacktraceEventHandlerTest.php @@ -69,6 +69,7 @@ final class BacktraceClientEventHandlerTest extends WWWTest { <> final class ThriftBacktraceServerEventHandlerTest extends WWWTest { + use ClassLevelTest; public async function testSetsHeaderWhenBacktraceActive(): Awaitable { $thrift_server = mock(ThriftServer::class); $handler = new ThriftBacktraceServerEventHandler($thrift_server); diff --git a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropHandlerTest.php b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropHandlerTest.php index 51a2bcc29e040..34fd1057e24a4 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropHandlerTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropHandlerTest.php @@ -3,6 +3,7 @@ <> final class ThriftContextPropHandlerTest extends WWWTest { + use ClassLevelTest; private static function readTFMForTest(string $v): ThriftFrameworkMetadata { $transport = Base64::decode($v); $buf = new TMemoryBuffer($transport); diff --git a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropServerEventHandlerTest.php b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropServerEventHandlerTest.php index 666b2eeca7f78..c46c3f7f7b5df 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropServerEventHandlerTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropServerEventHandlerTest.php @@ -3,6 +3,7 @@ <> final class ThriftContextPropServerEventHandlerTest extends WWWTest { + use ClassLevelTest; public async function testThriftContextPropResponsePath(): Awaitable { ThriftContextPropState::get()->addExperimentId(1); diff --git a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropStateScopeGuardTest.php b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropStateScopeGuardTest.php index 73f680a4f9e5f..466bcc5f424a6 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropStateScopeGuardTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropStateScopeGuardTest.php @@ -4,6 +4,8 @@ <> final class ThriftContextPropStateScopeGuardTest extends WWWTest { + use ClassLevelTest; + private function getSerializedTFMHeaders( string $overriden_request_id, int $overriden_origin_id, diff --git a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropStateTest.php b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropStateTest.php index a497e91a17361..b905baa8542fc 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropStateTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftContextPropStateTest.php @@ -3,6 +3,7 @@ <> final class ThriftContextPropStateTest extends WWWTest { + use ClassLevelTest; public function testAccess(): void { $tcps = ThriftContextPropState::get(); expect($tcps->getRequestId())->toEqual(""); @@ -37,6 +38,39 @@ public function testRegionalizationEntityNullable(): void { expect($tcps->getRegionalizationEntity())->toBeNull(); } + public function testUserIdsNullable(): void { + $tcps = ThriftContextPropState::get(); + expect($tcps->getUserIds())->toBeNull(); + + // 0 is different from null + $tcps->setUserIds(ContextProp\UserIds::withDefaultValues()); + expect($tcps->getUserIds())->toNotBeNull(); + expect($tcps->getUserIds()?->fb_user_id)->toEqual(0); + expect($tcps->getUserIds()?->ig_user_id)->toEqual(0); + + // override existing value + $tcps->setUserIds(new ContextProp\UserIds(1, 2)); + expect($tcps->getUserIds()?->fb_user_id)->toEqual(1); + expect($tcps->getUserIds()?->ig_user_id)->toEqual(2); + + // back to null + $tcps->setUserIds(null); + expect($tcps->getUserIds())->toBeNull(); + + // set FB Id only + $tcps->setFBUserId(3); + expect($tcps->getUserIds()?->fb_user_id)->toEqual(3); + expect($tcps->getFBUserId())->toEqual(3); + expect($tcps->getUserIds()?->ig_user_id)->toEqual(0); + + // set IG Id only + $tcps->setIGUserId(4); + expect($tcps->getUserIds()?->fb_user_id)->toEqual(3); + expect($tcps->getUserIds()?->ig_user_id)->toEqual(4); + expect($tcps->getIGUserId())->toEqual(4); + + } + public function testBaggage(): void { $tcps = ThriftContextPropState::get(); $tcps->clear(); diff --git a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftImmutableWrapperTest.php b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftImmutableWrapperTest.php index 33c017ff82816..4da431dc36ffa 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftImmutableWrapperTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftImmutableWrapperTest.php @@ -4,6 +4,8 @@ <> final class ThriftImmutableWrapperTest extends WWWTest { + use ClassLevelTest; + public async function testGetSerializedThrift(): Awaitable { $underlying = AdsConsentPlatformParams::fromShape(shape( 'traceID' => '123', diff --git a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftPolicyEnforcerTest.php b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftPolicyEnforcerTest.php index a9e37aa189b60..5cdd33a690607 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftPolicyEnforcerTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftPolicyEnforcerTest.php @@ -4,6 +4,7 @@ <> final class ThriftPolicyEnforcerTest extends WWWTest { + use ClassLevelTest; use TPolicyEnforcerTest; const int FAKE_CALLER_0 = 0; @@ -15,7 +16,6 @@ final class ThriftPolicyEnforcerTest extends WWWTest { public async function beforeEach(): Awaitable { MockJustKnobs::setInt('privacy:emergency_sampling_backoff_www', 1); MockPZ2::disableSampling(); - MockPZ::alwaysLog(); MockPrivacyLib::neverDisableLibrary(); } diff --git a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftUtilTest.php b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftUtilTest.php index 948269b20bec3..bfdb33c53c52e 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftUtilTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/__tests__/ThriftUtilTest.php @@ -19,6 +19,8 @@ <> final class ThriftUtilTest extends WWWTest { + use ClassLevelTest; + public async function testGetUnionTypeFromShape(): Awaitable { expect( ThriftUtil::getUnionTypeFromShape< diff --git a/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/LazyAnyTest.php b/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/LazyAnyTest.php index 15cc2cae95863..03f6c0c35df41 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/LazyAnyTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/LazyAnyTest.php @@ -4,6 +4,8 @@ <> final class LazyAnyTest extends LazyAnyTestBase { + use ClassLevelTest; + const classname CLASSNAME = unicorn_test_MainStruct::class; const classname DATA_SERIALIZER = TCompactSerializer::class; @@ -15,6 +17,8 @@ final class LazyAnyTest extends LazyAnyTestBase { <> final class LazyAnySimpleJsonTest extends LazyAnyTestBase { + use ClassLevelTest; + const classname CLASSNAME = unicorn_test_MainStructSimpleJson::class; const classname DATA_SERIALIZER = diff --git a/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/ThriftTypeStructAdapterTest.php b/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/ThriftTypeStructAdapterTest.php index 62570cd6d1c2c..cc619a4ecd99a 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/ThriftTypeStructAdapterTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/ThriftTypeStructAdapterTest.php @@ -3,6 +3,7 @@ <> final class ThriftTypeStructAdapterTest extends WWWTest { + use ClassLevelTest; public async function testFromHackType(): Awaitable { // Struct type diff --git a/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/ThriftUniversalNameTest.php b/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/ThriftUniversalNameTest.php index 757b2299eff58..7f38faf5d1caa 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/ThriftUniversalNameTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/ThriftUniversalNameTest.php @@ -3,6 +3,7 @@ <> final class ThriftUniversalNameTest extends WWWTest { + use ClassLevelTest; public async function testUniversalHashSha256(): Awaitable { $expected = non_crypto_sha256("fbthrift://foo.com/my/type", true); diff --git a/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/thrift_any/ThriftLazyAnyTests.php b/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/thrift_any/ThriftLazyAnyTests.php index c0c23f3d4767c..5c1bbebb32f89 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/thrift_any/ThriftLazyAnyTests.php +++ b/third-party/thrift/src/thrift/lib/hack/src/conformance/__tests__/thrift_any/ThriftLazyAnyTests.php @@ -5,6 +5,8 @@ final class ThriftLazyAnyTestForStruct extends ThriftLazyAnyTestBase { + use ClassLevelTest; + const ThriftStructGenericSpecImpl TYPE_SPEC = shape( 'type' => TType::STRUCT, 'class' => facebook\thrift\test\ExampleStruct::class, @@ -45,6 +47,8 @@ protected static function getValueFromLazyAny( <> final class ThriftLazyAnyTestForString extends ThriftLazyAnyTestBase { + use ClassLevelTest; + const ThriftStructGenericSpecImpl TYPE_SPEC = shape('type' => TType::STRING); const self::TPerProtocolSerializedStrings CPP_HEX_BINARY_SERIALIZED_STRINGS = @@ -76,6 +80,8 @@ protected static function getValueFromLazyAny(ThriftLazyAny $any): ?string { final class ThriftLazyAnyTestForEnum extends ThriftLazyAnyTestBase { + use ClassLevelTest; + const ThriftStructGenericSpecImpl TYPE_SPEC = shape( 'type' => TType::I32, 'enum' => facebook\thrift\test\ExampleEnum::class, @@ -114,6 +120,8 @@ protected static function getValueFromLazyAny( final class ThriftLazyAnyTestForContainer extends ThriftLazyAnyTestBase> { + use ClassLevelTest; + const ThriftStructGenericSpecImpl TYPE_SPEC = shape( 'type' => TType::MAP, 'key' => shape('type' => TType::I32), @@ -154,6 +162,8 @@ protected static function getValueFromLazyAny( <> final class ThriftLazyAnyTestForBool extends ThriftLazyAnyTestBase { + use ClassLevelTest; + const ThriftStructGenericSpecImpl TYPE_SPEC = shape('type' => TType::BOOL); const self::TPerProtocolSerializedStrings CPP_HEX_BINARY_SERIALIZED_STRINGS = @@ -189,6 +199,7 @@ final class ThriftLazyAnyTestForNestedStructInContainers facebook\thrift\test\ExampleStruct, >>, > { + use ClassLevelTest; const type THackType = dict< int, dict, diff --git a/third-party/thrift/src/thrift/lib/hack/src/contextprop/ThriftContextPropHandlers.php b/third-party/thrift/src/thrift/lib/hack/src/contextprop/ThriftContextPropHandlers.php index 1e230abfc96e9..5abf8ba3de374 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/contextprop/ThriftContextPropHandlers.php +++ b/third-party/thrift/src/thrift/lib/hack/src/contextprop/ThriftContextPropHandlers.php @@ -13,123 +13,55 @@ public static function install( ClientInstrumentationParams $instrumentation_params, ): void { // contextprop v2 handler - if ( - JustKnobs::evalFast('artillery/sdk_www', 'thrift_contextprop_v2_handler') - ) { - // TODO T204080230: add a CPv2 handler for AM so it does not need its own handler - try { - $context_prop_state = ThriftContextPropState::get(); - // Check if AM Traffic AND (AM Tenant OR Async job) AND JK passes with consistent rate using Request ID as the hash. - if ( - $context_prop_state->getOriginId() == MCPProductID::L4_ADS_MANAGER && - ( - Environment::getServiceId() == 'web_ads_manager/hhvm' || - Environment::isAsyncEnvironment() - ) && - JustKnobs::evalString( - 'am_health/set_thrift_request_priority:is_am_tenant_or_async', - $context_prop_state->getRequestId(), - ) - ) { - $thrift_client_handler->addHandler( - 'am_thrift_context_prop_update_request_priority', - AMThriftContextPropUpdateRequestPriority::getInstance(), - ); - } - } catch (Exception $e) { - FBLogger('am_request_priority', 'failed_to_register_handler') - ->handle( - $e, - Causes::the('AM Request priority handler')->to('be not set'), - ); - + // TODO T204080230: add a CPv2 handler for AM so it does not need its own handler + try { + $context_prop_state = ThriftContextPropState::get(); + // Check if AM Traffic AND (AM Tenant OR Async job) AND JK passes with consistent rate using Request ID as the hash. + if ( + $context_prop_state->getOriginId() == MCPProductID::L4_ADS_MANAGER && + ( + Environment::getServiceId() == 'web_ads_manager/hhvm' || + Environment::isAsyncEnvironment() + ) && + JustKnobs::evalString( + 'am_health/set_thrift_request_priority:is_am_tenant_or_async', + $context_prop_state->getRequestId(), + ) + ) { + $thrift_client_handler->addHandler( + 'am_thrift_context_prop_update_request_priority', + AMThriftContextPropUpdateRequestPriority::getInstance(), + ); } - if (JustKnobs::evalFast("servicerouter/thrift_context_prop", "enabled")) { - $client_handler = new TContextPropV2ClientHandler( - $headers_transport, - $instrumentation_params, + } catch (Exception $e) { + FBLogger('am_request_priority', 'failed_to_register_handler') + ->handle( + $e, + Causes::the('AM Request priority handler')->to('be not set'), ); - if ( - JustKnobs::eval( - 'privacy_infra/xsu:thrift_context_prop_update_universe_handler', - ) - ) { - $client_handler->addHandler(new UpdateUniverseContextHandler()); - } - $client_handler->addHandler(new ExperimentIdContextHandler()); - $client_handler->addHandler(new ProductIdContextHandler()); - //TODO T204080230: add AM handler equivalent + } + if (JustKnobs::evalFast("servicerouter/thrift_context_prop", "enabled")) { + $client_handler = new TContextPropV2ClientHandler( + $headers_transport, + $instrumentation_params, + ); - $thrift_client_handler->addHandler( - 'thrift_context_prop_v2', - $client_handler, - ); - } - } else { - //contextprop v1 handler - // NOTE: Always register these handlers together in this order, so the - // context prop Universe is updated before it's serialized. if ( JustKnobs::eval( 'privacy_infra/xsu:thrift_context_prop_update_universe_handler', ) ) { - $service_name = Shapes::idx($instrumentation_params, 'service_name'); - $thrift_class = Shapes::idx($instrumentation_params, 'thrift_class'); - $client = Shapes::idx($instrumentation_params, 'client'); - if ( - $service_name is nonnull && - $thrift_class is nonnull && - $client is nonnull - ) { - $thrift_client_handler->addHandler( - 'thrift_context_prop_update_universe', - new ThriftContextPropUpdateUniverseHandler( - $service_name, - HH_FIXME::tryClassToClassname($thrift_class), - $client, - ), - ); - } - + $client_handler->addHandler(new UpdateUniverseContextHandler()); } + $client_handler->addHandler(new ExperimentIdContextHandler()); + $client_handler->addHandler(new ProductIdContextHandler()); + //TODO T204080230: add AM handler equivalent - try { - $context_prop_state = ThriftContextPropState::get(); - // Check if AM Traffic AND (AM Tenant OR Async job) AND JK passes with consistent rate using Request ID as the hash. - if ( - $context_prop_state->getOriginId() == MCPProductID::L4_ADS_MANAGER && - ( - Environment::getServiceId() == 'web_ads_manager/hhvm' || - Environment::isAsyncEnvironment() - ) && - JustKnobs::evalString( - 'am_health/set_thrift_request_priority:is_am_tenant_or_async', - $context_prop_state->getRequestId(), - ) - ) { - $thrift_client_handler->addHandler( - 'am_thrift_context_prop_update_request_priority', - AMThriftContextPropUpdateRequestPriority::getInstance(), - ); - } - } catch (Exception $e) { - FBLogger('am_request_priority', 'failed_to_register_handler') - ->handle( - $e, - Causes::the('AM Request priority handler')->to('be not set'), - ); - - } - // contextprop handlers - if (JustKnobs::evalFast("servicerouter/thrift_context_prop", "enabled")) { - $thrift_client_handler->addHandler( - 'thrift_context_prop', - new ThriftContextPropHandler($headers_transport), - ); - } + $thrift_client_handler->addHandler( + 'thrift_context_prop_v2', + $client_handler, + ); } } - } diff --git a/third-party/thrift/src/thrift/lib/hack/src/contextprop/UpdateUniverseContextHandler.php b/third-party/thrift/src/thrift/lib/hack/src/contextprop/UpdateUniverseContextHandler.php index 752a1471c5fc1..6ece8a4f7b262 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/contextprop/UpdateUniverseContextHandler.php +++ b/third-party/thrift/src/thrift/lib/hack/src/contextprop/UpdateUniverseContextHandler.php @@ -3,6 +3,7 @@ final class UpdateUniverseContextHandler implements IContextHandler { use TThriftPoliciedOptOutList; + use PZ2UniversePropagationTrait; public function onIncomingDownstream( ThriftContextPropState $mutable_ctx, @@ -40,11 +41,7 @@ public function onOutgoingDownstream( $thrift_name = HH\class_to_classname($raw_thrift_class_name); - $thrift_name = - ThriftContextPropUpdateUniverseHandler::getTransformedThriftClientName( - $thrift_name, - $client, - ); + $thrift_name = self::getTransformedThriftClientName($thrift_name, $client); if (self::isServiceNameOptedOut($thrift_name)) { return; @@ -57,7 +54,7 @@ public function onOutgoingDownstream( ); } - public static function updateContextPropUniverseInThriftFrameworkMetadata( + private static function updateContextPropUniverseInThriftFrameworkMetadata( string $thrift_name, string $function_name, ThriftFrameworkMetadata $mutable_tfm, @@ -68,10 +65,7 @@ public static function updateContextPropUniverseInThriftFrameworkMetadata( try { $current_universe = - ThriftContextPropUpdateUniverseHandler::getCurrentUniverse( - $thrift_name, - $function_name, - ); + self::getCurrentUniverse($thrift_name, $function_name); // set current universe in TFM $current_universe_int = $current_universe?->getValue(); if ( @@ -89,4 +83,120 @@ public static function updateContextPropUniverseInThriftFrameworkMetadata( ); } } + + public static function getTransformedThriftClientName( + string $thrift_name, + IThriftClient $client, + )[zoned_local]: string { + try { + $thrift_name = Str\split($thrift_name, '\\') |> C\lastx($$); + if ($client is IThriftSyncIf) { + return Str\strip_suffix($thrift_name, 'Client'); + } else if ($client is IThriftAsyncIf) { + return Str\strip_suffix($thrift_name, 'AsyncClient'); + } else { + return $thrift_name; + } + } catch (Exception $e) { + FBLogger('privacylib', 'thrift_client_naming_transform') + ->handle( + $e, + Causes::the('Thrift client name')->to('not transform') + ->document('fail to transform existing Thrift client name'), + ); + return $thrift_name; + } + } + + private static function getCurrentUniverse( + string $thrift_name, + string $function_name, + ): ?UniverseDesignator { + try { + $xid = ThriftServiceMethodNameAssetXID::unsafeGet( + $thrift_name, + $function_name, + ); + $privacy_lib = ThriftServiceMethodNamePrivacyLib::get($xid); + $asset_universe = self::getPLArtifactUniverse($privacy_lib); + if ($asset_universe is nonnull) { + if ($asset_universe->shouldDynamicallyPropagate()) { + $current_universe = + self::getUniverseForPropagation(); // dynamic propagation + + self::logAsyncPropagation( + $xid, + Str\format( + 'async_submitter_propagation_nonnull_dynamic_%d', + $current_universe?->getValue() ?? 0, + ), + ); + } else { + $current_universe = + $asset_universe->getUniverseDesignator(); // static propagation + + self::logAsyncPropagation( + $xid, + Str\format( + 'async_submitter_propagation_nonnull_static_%d', + $current_universe?->getValue() ?? 0, + ), + ); + } + } else { + // TODO: all assets should have universe, for now, default to dynamic propagation + $current_universe = + self::getUniverseForPropagation(); // dynamic propagation + + self::logAsyncPropagation( + $xid, + Str\format( + 'async_submitter_propagation_null_dynamic_%d', + $current_universe?->getValue() ?? 0, + ), + ); + } + return $current_universe; + } catch (Exception $e) { + FBLogger('privacylib', 'thrift_propagation_exception') + ->handle( + $e, + Causes::the('Universe')->to('not update') + ->document('fail to update thrift context prop universe'), + ); + return null; + } + } + + // Temporary function to log information about async XSU propagation from client + private static function logAsyncPropagation( + ThriftServiceMethodNameAssetXID $asset_xid, + string $key, + ): void { + if (self::isSignalDynamicLoggerKilled()) { + return; + } + if ($asset_xid->equals(self::getAsyncSubmitterThriftService())) { + signal_log_in_psp_no_stack( + SignalDynamicLoggerDataset::PRIVACY_INFRASTRUCTURE, + SignalDynamicLoggerProject::PRIVACYLIB_WWW, + $key, + ); + } + } + + <<__Memoize>> + private static function isSignalDynamicLoggerKilled(): bool { + return PrivacyLibKS::isKilled(PLKS::SIGNAL_DYNAMIC_LOGGER); + } + + // Temporary hardcoded function to get the Async Thrift service that we want to filter to + <<__Memoize>> + private static function getAsyncSubmitterThriftService( + ): ThriftServiceMethodNameAssetXID { + return ThriftServiceMethodNameAssetXID::unsafeGet( + 'AsyncTier_AsyncTierSubmitter', + 'scheduleJobs', + ); + } } diff --git a/third-party/thrift/src/thrift/lib/hack/src/contextprop/__tests__/ExperimentIdContextHandlerTest.php b/third-party/thrift/src/thrift/lib/hack/src/contextprop/__tests__/ExperimentIdContextHandlerTest.php index ed9fd2a81c3fc..4c75e1d36a278 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/contextprop/__tests__/ExperimentIdContextHandlerTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/contextprop/__tests__/ExperimentIdContextHandlerTest.php @@ -4,6 +4,8 @@ <> final class ExperimentIdContextHandlerTest extends WWWTest { + use ClassLevelTest; + <<__Override>> public async function beforeEach(): Awaitable { ThriftContextPropState::get()->clear(); diff --git a/third-party/thrift/src/thrift/lib/hack/src/contextprop/__tests__/ProductIdContextHandlerTest.php b/third-party/thrift/src/thrift/lib/hack/src/contextprop/__tests__/ProductIdContextHandlerTest.php index 85c30135a6de1..a279a2641ea64 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/contextprop/__tests__/ProductIdContextHandlerTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/contextprop/__tests__/ProductIdContextHandlerTest.php @@ -24,6 +24,7 @@ final class ProductIdContextHandlerTest extends WWWTest { ); // verify that TagManager::getLatestOriginID() was called + expect($mock)->wasCalledOnce(); // verify that TFM was updated @@ -49,6 +50,7 @@ final class ProductIdContextHandlerTest extends WWWTest { ); // verify that TagManager::getLatestOriginID() was called + expect($mock)->wasCalledOnce(); // verify that TFM was NOT updated diff --git a/third-party/thrift/src/thrift/lib/hack/src/contextprop/__tests__/UpdateUniverseContextHandlerTest.php b/third-party/thrift/src/thrift/lib/hack/src/contextprop/__tests__/UpdateUniverseContextHandlerTest.php index c115e25780e55..c3e7d4e484cd4 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/contextprop/__tests__/UpdateUniverseContextHandlerTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/contextprop/__tests__/UpdateUniverseContextHandlerTest.php @@ -4,6 +4,8 @@ <> final class UpdateUniverseContextHandlerTest extends WWWTest { + use ClassLevelTest; + <<__Override>> public async function beforeEach(): Awaitable { clear_class_memoization(PrivacyLibKS::class, 'isKilled'); @@ -121,7 +123,7 @@ classname $thrift_service_name, public async function testUniverseContextPropKillswitch(): Awaitable { $mock = self::mockClassStaticMethodUNSAFE( - ThriftContextPropUpdateUniverseHandler::class, + UpdateUniverseContextHandler::class, 'getUniverseForPropagation', ); @@ -173,7 +175,7 @@ classname $thrift_service_name, private async function genInitPZ2(): Awaitable { await MockPZ2::genInitRequest( - PZ2StaticCodeAnnotation::get()->withPolicy( + PZ2CodeAnnotationStatic::get()->withPolicy( PZ2XSUPolicy::create(PZ2XSUStates::FACEBOOK), ), ); diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/AdapterTest.php b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/AdapterTest.php index 35f01ed26b877..dff4fbe227cb6 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/AdapterTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/AdapterTest.php @@ -18,6 +18,7 @@ <> final class AdapterTest extends WWWTest { + use ClassLevelTest; public static function getTestCases( ): dict { return dict[ diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/FieldWrapperTest.php b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/FieldWrapperTest.php index b6ef15b7e7fc5..c279df7f1869e 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/FieldWrapperTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/FieldWrapperTest.php @@ -18,6 +18,7 @@ <> final class FieldWrapperTest extends WWWTest { + use ClassLevelTest; public static async function genTestCases( ): Awaitable>> { return dict[ diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/ProtocolTest.thrift b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/ProtocolTest.thrift index 59728acc557e8..d9957d1f020e4 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/ProtocolTest.thrift +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/ProtocolTest.thrift @@ -76,3 +76,15 @@ struct TestTerseWriteStruct { 11: set set_of_ints; 12: map map_of_str_to_struct; } + +struct CorruptedDataStruct1 { + 1: list string_list; + 2: set string_set; + 3: map string_i64_map; +} + +struct CorruptedDataStruct2 { + 1: list i64_list; + 2: set i64_set; + 3: map i64_i64_map; +} diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/SerializationTest.php b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/SerializationTest.php index bbafbf9484674..29575a9b5edc9 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/SerializationTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/SerializationTest.php @@ -20,6 +20,8 @@ <> final class SerializationTest extends WWWTest { + use ClassLevelTest; + <<__LateInit>> private CompactTestStruct $testValue; <<__LateInit>> private string $compactSerialized; <<__LateInit>> private string $binarySerialized; diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/SimplePHPObjectProtocolTest.php b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/SimplePHPObjectProtocolTest.php index f9e6b17913b17..1646ee578c780 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/SimplePHPObjectProtocolTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/SimplePHPObjectProtocolTest.php @@ -19,6 +19,8 @@ <> final class SimplePHPObjectProtocolTest extends WWWTest { + use ClassLevelTest; + public function testSameAsTSimpleJSON(): void { $grandchild = SimpleObjectTest_TestStruct::withDefaultValues(); $grandchild->stringval = 'grandchild'; diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/ThriftSerializationHelperTest.php b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/ThriftSerializationHelperTest.php index 5854c8bbca92d..df4c0bd28b5a7 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/ThriftSerializationHelperTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/ThriftSerializationHelperTest.php @@ -21,6 +21,8 @@ final class ThriftSerializationHelperTest extends WWWTest implements ISnapshotTest { + use ClassLevelTest; + <<__LateInit>> public SimpleStruct $simpleStruct; <<__LateInit>> public ContainerStruct $containerStruct; <<__LateInit>> public ComplexStruct $complexStruct; @@ -284,4 +286,25 @@ public function testStructUnionTerseWrite(): void { // Snapshot for manual verification expect(JSONThriftSerializer::serialize($terse_struct))->toMatchSnapshot(); } + + public function testCorruptedData(): void { + $transport = new TMemoryBuffer(); + $protocol = new TBinaryProtocolAccelerated($transport); + ThriftSerializationHelper::writeStruct( + $protocol, + CorruptedDataStruct1::fromShape( + shape( + "string_i64_map" => Map {"foo" => 1, "bar" => 10}, + ), + ), + ); + + expect( + () ==> ThriftSerializationHelper::readStruct( + $protocol, + CorruptedDataStruct2::withDefaultValues(), + ), + ) + ->toThrow(TTransportException::class); + } } diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/ThriftUnionSerializationTraitTest.php b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/ThriftUnionSerializationTraitTest.php index b39c53fc8b682..79afdcafcf2c4 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/ThriftUnionSerializationTraitTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/ThriftUnionSerializationTraitTest.php @@ -19,6 +19,8 @@ <> final class ThriftUnionSerializationTraitTest extends WWWTest { + use ClassLevelTest; + public static function provideUnionSerialize( ): dict { return dict[ diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/TypeWrapperTest.php b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/TypeWrapperTest.php index 193581834547e..d1f00d68cfeaf 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/TypeWrapperTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/__tests__/TypeWrapperTest.php @@ -20,6 +20,7 @@ final class TypeWrapperTest extends WWWTest implements IAllowUnrecognizedPublicMethodsInTestClass_MIGRATION_ONLY_FIXME { + use ClassLevelTest; public static async function genNestedStruct( ): Awaitable { return await WrapperTest\MyNestedStruct::genFromShape(shape( diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/binary/__tests__/TBinaryProtocolAcceleratedTestCase.php b/third-party/thrift/src/thrift/lib/hack/src/protocol/binary/__tests__/TBinaryProtocolAcceleratedTestCase.php index 3b7a2bc1155af..6e601b03498f9 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/binary/__tests__/TBinaryProtocolAcceleratedTestCase.php +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/binary/__tests__/TBinaryProtocolAcceleratedTestCase.php @@ -19,6 +19,8 @@ <> final class TBinaryProtocolAcceleratedTestCase extends WWWTest { + use ClassLevelTest; + public static function providerTBinaryProtocolAccelerated( ): vec<(KeyedContainer)> { return vec[ diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/binary/__tests__/TBinarySerializerTest.php b/third-party/thrift/src/thrift/lib/hack/src/protocol/binary/__tests__/TBinarySerializerTest.php index fa8b3ee196a46..4c0333d508d9a 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/binary/__tests__/TBinarySerializerTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/binary/__tests__/TBinarySerializerTest.php @@ -24,6 +24,8 @@ <> final class TBinarySerializerTest extends WWWTest { + use ClassLevelTest; + // Verifies if two objects of type CountersInformation // have the same content (counters value). private function checkEqualCounters( diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/compact/__tests__/TCompactProtocolAcceleratedTest.php b/third-party/thrift/src/thrift/lib/hack/src/protocol/compact/__tests__/TCompactProtocolAcceleratedTest.php index 44bbccc2020fb..c89590e0fed97 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/compact/__tests__/TCompactProtocolAcceleratedTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/compact/__tests__/TCompactProtocolAcceleratedTest.php @@ -21,6 +21,7 @@ */ <> final class TCompactProtocolAcceleratedTest extends WWWTest { + use ClassLevelTest; private function getReferenceProtocol(): TCompactProtocolUnaccelerated { return new TCompactProtocolUnaccelerated(new TMemoryBuffer()); } diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/compact/__tests__/TCompactProtocolTest.php b/third-party/thrift/src/thrift/lib/hack/src/protocol/compact/__tests__/TCompactProtocolTest.php index b41d007a91f3c..d50fe91a66276 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/compact/__tests__/TCompactProtocolTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/compact/__tests__/TCompactProtocolTest.php @@ -22,6 +22,7 @@ */ <> final class TCompactProtocolTest extends WWWTest { + use ClassLevelTest; public function testSimple(): void { $prot = new TCompactProtocolUnaccelerated(new TMemoryBuffer()); diff --git a/third-party/thrift/src/thrift/lib/hack/src/protocol/simplejson/__tests__/TSimpleJSONProtocolTest.php b/third-party/thrift/src/thrift/lib/hack/src/protocol/simplejson/__tests__/TSimpleJSONProtocolTest.php index ab53bb35438f1..3d51bab0af19e 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/protocol/simplejson/__tests__/TSimpleJSONProtocolTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/protocol/simplejson/__tests__/TSimpleJSONProtocolTest.php @@ -19,6 +19,8 @@ <> final class TSimpleJSONProtocolTest extends WWWTest { + use ClassLevelTest; + public static function provideStringEncodings(): dict string, 'json' => string, diff --git a/third-party/thrift/src/thrift/lib/hack/src/transport/TTransportException.php b/third-party/thrift/src/thrift/lib/hack/src/transport/TTransportException.php index 9450d1be73cc8..ab68992a23da6 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/transport/TTransportException.php +++ b/third-party/thrift/src/thrift/lib/hack/src/transport/TTransportException.php @@ -59,9 +59,4 @@ public function __construct( public function getShortMessage()[]: string { return $this->shortMessage; } - - public function addTAALCategorization(string $datatype): void { - $datatype_safe = TAAL::stripInvalidCategoryCharacters($datatype); - $this->message = TAAL::forceCategory($this->message, $datatype_safe); - } } diff --git a/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TChunkedMemoryBufferTest.php b/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TChunkedMemoryBufferTest.php index 8817e9dbccf47..18da9b5891efc 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TChunkedMemoryBufferTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TChunkedMemoryBufferTest.php @@ -3,6 +3,7 @@ <> final class TChunkedMemoryBufferTest extends WWWTest { + use ClassLevelTest; const string TEST_DATA = <<> final class TFileStreamTest extends WWWTest { + use ClassLevelTest; + public async function testRead(): Awaitable { using IntegrationTestDangerousFunctionGuard::forFopen(); diff --git a/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TFramedTransportTestCase.php b/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TFramedTransportTestCase.php index c82bb51c92b46..422aa8f01f514 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TFramedTransportTestCase.php +++ b/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TFramedTransportTestCase.php @@ -25,6 +25,8 @@ <> final class TFramedTransportTestCase extends WWWTest { + use ClassLevelTest; + public static function providerTFramedTransport( ): vec<(classname, string)> { $transports = vec[TBufferedTransport::class, TFramedTransport::class]; diff --git a/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TMemoryBufferTest.php b/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TMemoryBufferTest.php index 2b6e42f3bd898..d8096db78d97e 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TMemoryBufferTest.php +++ b/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TMemoryBufferTest.php @@ -19,6 +19,8 @@ <> final class TMemoryBufferTest extends WWWTest { + use ClassLevelTest; + public static function providePeekCases(): dict string, 'length' => int, diff --git a/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TTransportExceptionTestCase.php b/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TTransportExceptionTestCase.php index 53642f50d3b9b..8df85c1c1b9ab 100644 --- a/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TTransportExceptionTestCase.php +++ b/third-party/thrift/src/thrift/lib/hack/src/transport/__tests__/TTransportExceptionTestCase.php @@ -19,6 +19,8 @@ <> final class TTransportExceptionTestCase extends WWWTest { + use ClassLevelTest; + public function testSimple(): void { $short_message = null; $code = null;