From 4dac2bb7f3a238301e44c258367d8a5cefb942c3 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 29b2fcd19..2cb97db3a 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( """