From 1258ef6f1f93f9f83462099a9f22f74df9d5d92b Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Wed, 22 Oct 2025 23:25:51 +0200 Subject: [PATCH] Add missing parentheses around logging scope computation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The modulo operator associated `0` and `100`, so the computation here was essentially `handle?.numericValue ?? (0 % 100)`, equivalent to `handle?.numericValue ?? 0`, which means that we didn’t acutally perform modulo operations on the numeric value, which means that we would exceed the maximum number of `os_log_t` objects after some time. rdar://162891887 --- Sources/SwiftSourceKitPlugin/Plugin.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SwiftSourceKitPlugin/Plugin.swift b/Sources/SwiftSourceKitPlugin/Plugin.swift index 58b2b7647..d1ee9dbc3 100644 --- a/Sources/SwiftSourceKitPlugin/Plugin.swift +++ b/Sources/SwiftSourceKitPlugin/Plugin.swift @@ -58,7 +58,7 @@ final class RequestHandler: Sendable { func produceResult( body: @escaping @Sendable () async throws -> SKDResponseDictionaryBuilder ) -> HandleRequestResult { - withLoggingScope("request-\(handle?.numericValue ?? 0 % 100)") { + withLoggingScope("request-\((handle?.numericValue ?? 0) % 100)") { let start = Date() logger.debug( """