Skip to content

Mission-critical Swift audit: concurrency + file-read safety fixes#16

Open
christopherkarani wants to merge 2 commits into
mainfrom
codex/mission-critical-audit-20260310
Open

Mission-critical Swift audit: concurrency + file-read safety fixes#16
christopherkarani wants to merge 2 commits into
mainfrom
codex/mission-critical-audit-20260310

Conversation

@christopherkarani
Copy link
Copy Markdown
Owner

Summary\nThis PR implements mission-critical remediation for three correctness/safety gaps identified in the automation audit run:\n\n1. OTLPHTTPServer shared-state synchronization\n- Queue-synchronized all lifecycle-sensitive state access (, , , ) so listener/connection state is no longer read/written from mixed threads.\n- Added queue identity handling to avoid deadlock when already executing on the server queue.\n\n2. TerraTracedSession concurrency safety\n- Added a request gate to enforce a single in-flight operation per traced Foundation Models session.\n- Overlapping operations now fail fast with .\n- Removed shared mutable reflection cache pattern from stream path and made stream token probing stateless per partial to avoid Swift concurrency capture hazards.\n\n3. TraceFileReader TOCTOU hardening\n- Replaced path-stat + separate read with same-handle size check and bounded read () to prevent oversized read bypass when files are modified between check/read.\n\n## Tests Added\n- \n- \n- \n\n## Verification\n- Test Suite 'Selected tests' started at 2026-03-10 09:14:53.340.

Test Suite 'TerraPackageTests.xctest' started at 2026-03-10 09:14:53.350.
Test Suite 'TerraPackageTests.xctest' passed at 2026-03-10 09:14:53.350.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'Selected tests' passed at 2026-03-10 09:14:53.350.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.010) seconds
􀟈 Test run started.
􀄵 Testing Library Version: 0.99.0
􀟈 Test "TerraTracedSession rejects concurrent in-flight operations" started.
􀟈 Test "TerraTracedSession initializes with default model identifier" started.
􀟈 Test "TerraTracedSession initializes with custom model identifier" started.
􁁛 Test "TerraTracedSession initializes with default model identifier" passed after 0.021 seconds.
􁁛 Test "TerraTracedSession initializes with custom model identifier" passed after 0.021 seconds.
􁁛 Test "TerraTracedSession rejects concurrent in-flight operations" passed after 0.323 seconds.
􁁛 Test run with 3 tests passed after 0.326 seconds.\n- Test Suite 'Selected tests' started at 2026-03-10 09:14:54.687.
Test Suite 'TerraPackageTests.xctest' started at 2026-03-10 09:14:54.694.
Test Suite 'OTLPHTTPServerTests' started at 2026-03-10 09:14:54.694.
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServer_bodyReadTimeoutReturns408]' started.
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServer_bodyReadTimeoutReturns408]' passed (0.264 seconds).
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServer_headerReadTimeoutReturns408]' started.
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServer_headerReadTimeoutReturns408]' passed (0.260 seconds).
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServerConcurrentPortReadDuringLifecycleIsStable]' started.
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServerConcurrentPortReadDuringLifecycleIsStable]' passed (0.368 seconds).
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServerEndToEnd]' started.
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServerEndToEnd]' passed (0.067 seconds).
Test Suite 'OTLPHTTPServerTests' passed at 2026-03-10 09:14:55.655.
Executed 4 tests, with 0 failures (0 unexpected) in 0.960 (0.960) seconds
Test Suite 'TerraPackageTests.xctest' passed at 2026-03-10 09:14:55.655.
Executed 4 tests, with 0 failures (0 unexpected) in 0.960 (0.960) seconds
Test Suite 'Selected tests' passed at 2026-03-10 09:14:55.655.
Executed 4 tests, with 0 failures (0 unexpected) in 0.960 (0.967) seconds
􀟈 Test run started.
􀄵 Testing Library Version: 0.99.0
􁁛 Test run with 0 tests passed after 0.001 seconds.\n- Test Suite 'Selected tests' started at 2026-03-10 09:14:56.482.
Test Suite 'TerraPackageTests.xctest' started at 2026-03-10 09:14:56.488.
Test Suite 'TerraPackageTests.xctest' passed at 2026-03-10 09:14:56.489.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'Selected tests' passed at 2026-03-10 09:14:56.489.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.007) seconds
􀟈 Test run started.
􀄵 Testing Library Version: 0.99.0
􀟈 Test "TraceFileReader enforces max size using bounded handle reads" started.
􁁛 Test "TraceFileReader enforces max size using bounded handle reads" passed after 0.001 seconds.
􁁛 Test run with 1 test passed after 0.002 seconds.\n- Test Suite 'All tests' started at 2026-03-10 09:14:57.245.
Test Suite 'TerraPackageTests.xctest' started at 2026-03-10 09:14:57.252.
Test Suite 'HTTPIntegrationTests' started at 2026-03-10 09:14:57.252.
Test Case '-[TerraHTTPInstrumentTests.HTTPIntegrationTests testHTTPInstrumentationCapturesRequestAndResponseGenAIAttributes]' started.
Test Case '-[TerraHTTPInstrumentTests.HTTPIntegrationTests testHTTPInstrumentationCapturesRequestAndResponseGenAIAttributes]' passed (0.146 seconds).
Test Suite 'HTTPIntegrationTests' passed at 2026-03-10 09:14:57.398.
Executed 1 test, with 0 failures (0 unexpected) in 0.146 (0.146) seconds
Test Suite 'OTLPHTTPServerTests' started at 2026-03-10 09:14:57.398.
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServer_bodyReadTimeoutReturns408]' started.
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServer_bodyReadTimeoutReturns408]' passed (0.259 seconds).
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServer_headerReadTimeoutReturns408]' started.
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServer_headerReadTimeoutReturns408]' passed (0.259 seconds).
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServerConcurrentPortReadDuringLifecycleIsStable]' started.
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServerConcurrentPortReadDuringLifecycleIsStable]' passed (0.377 seconds).
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServerEndToEnd]' started.
Test Case '-[TerraTraceKitTests.OTLPHTTPServerTests testOTLPHTTPServerEndToEnd]' passed (0.056 seconds).
Test Suite 'OTLPHTTPServerTests' passed at 2026-03-10 09:14:58.349.
Executed 4 tests, with 0 failures (0 unexpected) in 0.950 (0.950) seconds
Test Suite 'OTLPRequestDecoderTests' started at 2026-03-10 09:14:58.349.
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeDeflatePayloadReturnsExpectedSpans]' started.
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeDeflatePayloadReturnsExpectedSpans]' passed (0.001 seconds).
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeGzipPayloadReturnsExpectedSpans]' started.
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeGzipPayloadReturnsExpectedSpans]' passed (0.001 seconds).
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeIdentityPayloadReturnsExpectedSpans]' started.
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeIdentityPayloadReturnsExpectedSpans]' passed (0.000 seconds).
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeRejectsOversizedDecompressedPayload]' started.
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeRejectsOversizedDecompressedPayload]' passed (0.000 seconds).
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeRejectsWhenAnyValueNestingExceedsLimit]' started.
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeRejectsWhenAnyValueNestingExceedsLimit]' passed (0.000 seconds).
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeRejectsWhenAttributesPerSpanExceedLimit]' started.
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeRejectsWhenAttributesPerSpanExceedLimit]' passed (0.000 seconds).
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeRejectsWhenSpanCountExceedsLimit]' started.
Test Case '-[TerraTraceKitTests.OTLPRequestDecoderTests testDecodeRejectsWhenSpanCountExceedsLimit]' passed (0.000 seconds).
Test Suite 'OTLPRequestDecoderTests' passed at 2026-03-10 09:14:58.351.
Executed 7 tests, with 0 failures (0 unexpected) in 0.002 (0.003) seconds
Test Suite 'StreamRendererTests' started at 2026-03-10 09:14:58.351.
Test Case '-[TerraTraceKitTests.StreamRendererTests testStreamRendererProducesDeterministicLines]' started.
Test Case '-[TerraTraceKitTests.StreamRendererTests testStreamRendererProducesDeterministicLines]' passed (0.001 seconds).
Test Suite 'StreamRendererTests' passed at 2026-03-10 09:14:58.352.
Executed 1 test, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'TerraConcurrencyPropagationTests' started at 2026-03-10 09:14:58.352.
Test Case '-[TerraTests.TerraConcurrencyPropagationTests testDetachedTask_doesNotInheritParentSpanContext]' started.
Test Case '-[TerraTests.TerraConcurrencyPropagationTests testDetachedTask_doesNotInheritParentSpanContext]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraConcurrencyPropagationTests testSequentialSpans_doNotLeakParentContext]' started.
Test Case '-[TerraTests.TerraConcurrencyPropagationTests testSequentialSpans_doNotLeakParentContext]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraConcurrencyPropagationTests testStructuredTask_inheritsParentSpanContext]' started.
Test Case '-[TerraTests.TerraConcurrencyPropagationTests testStructuredTask_inheritsParentSpanContext]' passed (0.000 seconds).
Test Suite 'TerraConcurrencyPropagationTests' passed at 2026-03-10 09:14:58.353.
Executed 3 tests, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'TerraE2ETests' started at 2026-03-10 09:14:58.353.
Test Case '-[TerraTests.TerraE2ETests testSpanCreateExportLoadParseFlow]' started.
Test Case '-[TerraTests.TerraE2ETests testSpanCreateExportLoadParseFlow]' passed (0.005 seconds).
Test Suite 'TerraE2ETests' passed at 2026-03-10 09:14:58.359.
Executed 1 test, with 0 failures (0 unexpected) in 0.005 (0.005) seconds
Test Suite 'TerraInferenceSpanTests' started at 2026-03-10 09:14:58.359.
Test Case '-[TerraTests.TerraInferenceSpanTests testWithInferenceSpan_cancellationDoesNotMarkSpanAsError]' started.
Test Case '-[TerraTests.TerraInferenceSpanTests testWithInferenceSpan_cancellationDoesNotMarkSpanAsError]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraInferenceSpanTests testWithInferenceSpan_createsSpan_withExpectedNameKindAndAttributes]' started.
Test Case '-[TerraTests.TerraInferenceSpanTests testWithInferenceSpan_createsSpan_withExpectedNameKindAndAttributes]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraInferenceSpanTests testWithInferenceSpan_privacyAlways_recordsExceptionMessage]' started.
Test Case '-[TerraTests.TerraInferenceSpanTests testWithInferenceSpan_privacyAlways_recordsExceptionMessage]' passed (0.001 seconds).
Test Case '-[TerraTests.TerraInferenceSpanTests testWithInferenceSpan_privacyNever_omitsExceptionMessage]' started.
Test Case '-[TerraTests.TerraInferenceSpanTests testWithInferenceSpan_privacyNever_omitsExceptionMessage]' passed (0.000 seconds).
Test Suite 'TerraInferenceSpanTests' passed at 2026-03-10 09:14:58.360.
Executed 4 tests, with 0 failures (0 unexpected) in 0.002 (0.002) seconds
Test Suite 'TerraInstrumentationNameTests' started at 2026-03-10 09:14:58.360.
Test Case '-[TerraTests.TerraInstrumentationNameTests testInstrumentationName_isStable]' started.
Test Case '-[TerraTests.TerraInstrumentationNameTests testInstrumentationName_isStable]' passed (0.000 seconds).
Test Suite 'TerraInstrumentationNameTests' passed at 2026-03-10 09:14:58.361.
Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'TerraMetricsTests' started at 2026-03-10 09:14:58.361.
Test Case '-[TerraTests.TerraMetricsTests testConfigure_createsInstrumentsOnMeterProvider]' started.
Test Case '-[TerraTests.TerraMetricsTests testConfigure_createsInstrumentsOnMeterProvider]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraMetricsTests testConfigure_nilMeterProvider_clearsInstruments]' started.
Test Case '-[TerraTests.TerraMetricsTests testConfigure_nilMeterProvider_clearsInstruments]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraMetricsTests testRecordInference_doesNotCrashWithoutConfiguration]' started.
Test Case '-[TerraTests.TerraMetricsTests testRecordInference_doesNotCrashWithoutConfiguration]' passed (0.000 seconds).
Test Suite 'TerraMetricsTests' passed at 2026-03-10 09:14:58.361.
Executed 3 tests, with 0 failures (0 unexpected) in 0.000 (0.001) seconds
Test Suite 'TerraOpenTelemetryInstallConcurrencyTests' started at 2026-03-10 09:14:58.361.
Test Case '-[TerraTests.TerraOpenTelemetryInstallConcurrencyTests testConcurrentInstall_allowsSingleSuccess]' started.
Test Case '-[TerraTests.TerraOpenTelemetryInstallConcurrencyTests testConcurrentInstall_allowsSingleSuccess]' passed (0.001 seconds).
Test Case '-[TerraTests.TerraOpenTelemetryInstallConcurrencyTests testConcurrentInstall_consistentConfiguration]' started.
Test Case '-[TerraTests.TerraOpenTelemetryInstallConcurrencyTests testConcurrentInstall_consistentConfiguration]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraOpenTelemetryInstallConcurrencyTests testConcurrentInstall_sameConfig_bothSucceed]' started.
Test Case '-[TerraTests.TerraOpenTelemetryInstallConcurrencyTests testConcurrentInstall_sameConfig_bothSucceed]' passed (0.000 seconds).
Test Suite 'TerraOpenTelemetryInstallConcurrencyTests' passed at 2026-03-10 09:14:58.363.
Executed 3 tests, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'TerraPrivacyE2ETests' started at 2026-03-10 09:14:58.363.
Test Case '-[TerraTests.TerraPrivacyE2ETests testDefaultPrivacy_exportedSpan_containsNoRawPrompt]' started.
Test Case '-[TerraTests.TerraPrivacyE2ETests testDefaultPrivacy_exportedSpan_containsNoRawPrompt]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraPrivacyE2ETests testLengthOnlyPrivacy_exportedSpan_containsLengthNotPrompt]' started.
Test Case '-[TerraTests.TerraPrivacyE2ETests testLengthOnlyPrivacy_exportedSpan_containsLengthNotPrompt]' passed (0.000 seconds).
Test Suite 'TerraPrivacyE2ETests' passed at 2026-03-10 09:14:58.363.
Executed 2 tests, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'TerraRedactionPolicyTests' started at 2026-03-10 09:14:58.363.
Test Case '-[TerraTests.TerraRedactionPolicyTests testDefaultPrivacy_doesNotRecordPromptAttributes]' started.
Test Case '-[TerraTests.TerraRedactionPolicyTests testDefaultPrivacy_doesNotRecordPromptAttributes]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraRedactionPolicyTests testHMACDigest_changesAcrossDifferentKeys]' started.
Test Case '-[TerraTests.TerraRedactionPolicyTests testHMACDigest_changesAcrossDifferentKeys]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraRedactionPolicyTests testHMACRedaction_canEnableLegacySHAAttributes]' started.
Test Case '-[TerraTests.TerraRedactionPolicyTests testHMACRedaction_canEnableLegacySHAAttributes]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraRedactionPolicyTests testHMACRedaction_recordsHMACAndLength_withoutRawPrompt]' started.
Test Case '-[TerraTests.TerraRedactionPolicyTests testHMACRedaction_recordsHMACAndLength_withoutRawPrompt]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraRedactionPolicyTests testHMACRedactionLabel_matchesAvailability]' started.
Test Case '-[TerraTests.TerraRedactionPolicyTests testHMACRedactionLabel_matchesAvailability]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraRedactionPolicyTests testLegacySHA256RedactionLabel_matchesAvailability]' started.
Test Case '-[TerraTests.TerraRedactionPolicyTests testLegacySHA256RedactionLabel_matchesAvailability]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraRedactionPolicyTests testLengthOnlyRedaction_recordsLength_withoutRawPrompt]' started.
Test Case '-[TerraTests.TerraRedactionPolicyTests testLengthOnlyRedaction_recordsLength_withoutRawPrompt]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraRedactionPolicyTests testSha256Hex_matchesExpectedOutput_orRequiresSha256LengthFallback]' started.
Test Case '-[TerraTests.TerraRedactionPolicyTests testSha256Hex_matchesExpectedOutput_orRequiresSha256LengthFallback]' passed (0.000 seconds).
Test Suite 'TerraRedactionPolicyTests' passed at 2026-03-10 09:14:58.366.
Executed 8 tests, with 0 failures (0 unexpected) in 0.002 (0.002) seconds
Test Suite 'TerraSpanTypesTests' started at 2026-03-10 09:14:58.366.
Test Case '-[TerraTests.TerraSpanTypesTests testWithAgentInvocationSpan_setsExpectedAttributes]' started.
Test Case '-[TerraTests.TerraSpanTypesTests testWithAgentInvocationSpan_setsExpectedAttributes]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraSpanTypesTests testWithEmbeddingSpan_setsExpectedAttributes]' started.
Test Case '-[TerraTests.TerraSpanTypesTests testWithEmbeddingSpan_setsExpectedAttributes]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraSpanTypesTests testWithSafetyCheckSpan_setsExpectedAttributes]' started.
Test Case '-[TerraTests.TerraSpanTypesTests testWithSafetyCheckSpan_setsExpectedAttributes]' passed (0.000 seconds).
Test Case '-[TerraTests.TerraSpanTypesTests testWithToolExecutionSpan_setsExpectedAttributes]' started.
Test Case '-[TerraTests.TerraSpanTypesTests testWithToolExecutionSpan_setsExpectedAttributes]' passed (0.000 seconds).
Test Suite 'TerraSpanTypesTests' passed at 2026-03-10 09:14:58.367.
Executed 4 tests, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'TerraStreamingSpanTests' started at 2026-03-10 09:14:58.367.
Test Case '-[TerraTests.TerraStreamingSpanTests testWithStreamingInferenceSpan_recordsFirstTokenAndThroughput]' started.
Test Case '-[TerraTests.TerraStreamingSpanTests testWithStreamingInferenceSpan_recordsFirstTokenAndThroughput]' passed (0.000 seconds).
Test Suite 'TerraStreamingSpanTests' passed at 2026-03-10 09:14:58.367.
Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'TraceStoreTests' started at 2026-03-10 09:14:58.367.
Test Case '-[TerraTraceKitTests.TraceStoreTests testIngestSnapshotGroupsByTraceID]' started.
Test Case '-[TerraTraceKitTests.TraceStoreTests testIngestSnapshotGroupsByTraceID]' passed (0.000 seconds).
Test Case '-[TerraTraceKitTests.TraceStoreTests testSnapshotFiltersByNamePrefixAndTraceID]' started.
Test Case '-[TerraTraceKitTests.TraceStoreTests testSnapshotFiltersByNamePrefixAndTraceID]' passed (0.000 seconds).
Test Suite 'TraceStoreTests' passed at 2026-03-10 09:14:58.368.
Executed 2 tests, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'TreeRendererTests' started at 2026-03-10 09:14:58.368.
Test Case '-[TerraTraceKitTests.TreeRendererTests testTreeRendererOrdersChildrenByStartTime]' started.
Test Case '-[TerraTraceKitTests.TreeRendererTests testTreeRendererOrdersChildrenByStartTime]' passed (0.000 seconds).
Test Case '-[TerraTraceKitTests.TreeRendererTests testTreeRendererReparentsWhenParentArrivesLater]' started.
Test Case '-[TerraTraceKitTests.TreeRendererTests testTreeRendererReparentsWhenParentArrivesLater]' passed (0.000 seconds).
Test Suite 'TreeRendererTests' passed at 2026-03-10 09:14:58.368.
Executed 2 tests, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'TerraPackageTests.xctest' passed at 2026-03-10 09:14:58.368.
Executed 47 tests, with 0 failures (0 unexpected) in 1.113 (1.116) seconds
Test Suite 'All tests' passed at 2026-03-10 09:14:58.369.
Executed 47 tests, with 0 failures (0 unexpected) in 1.113 (1.123) seconds
􀟈 Test run started.
􀄵 Testing Library Version: 0.99.0
􀟈 Suite "HTTPAIInstrumentation Host Matching" started.
􀟈 Test "Macro with no matching parameters only puts model in InferenceRequest" started.
􀟈 Suite "Terra.start / AutoInstrument Tests" started.
􀟈 Test "Macro captures 'maxOutputTokens' parameter name correctly" started.
􀟈 Suite "TerraMLX Tests" started.
􀟈 Test "Macro throws diagnostic when model argument label is missing from call" started.
􀟈 Test "Macro wraps async throws function body with try await" started.
􀟈 Test "TraceFileNameParser extracts timestamp from numeric prefix" started.
􀟈 Test "Macro captures 'input' parameter as prompt in InferenceRequest" started.
􀟈 Test "TraceFileNameParser handles composite filename with non-digit suffix" started.
􀟈 Test "Macro captures maxTokens parameter as maxOutputTokens in InferenceRequest" started.
􀟈 Suite "TraceKit ConcurrentAccessTests" started.
􀟈 Test "Response with only model field is returned" started.
􀟈 Test "Macro expands function with prompt parameter into withInferenceSpan" started.
􀟈 Test "OpenAI request format parses model, max_tokens, temperature, stream" started.
􀟈 Test "TraceLoader returns empty for empty directory" started.
􀟈 Test "TraceLoader loads valid traces and reports bad files as failures" started.
􀟈 Test "Trace.init throws mismatchedTraceIds when spans have different trace IDs" started.
􀟈 Test "attributes maps MLComputeUnits.cpuAndNeuralEngine to 'cpu_and_ane'" started.
􀟈 Test "Request body larger than 10 MiB is rejected" started.
􀟈 Test "Ollama response format parses prompt_eval_count and eval_count" started.
􀟈 Test "attributes maps MLComputeUnits.all to 'all'" started.
􀟈 Test "Trace.init throws invalidFileName for non-numeric name" started.
􀟈 Test "Invalid JSON returns nil" started.
􀟈 Test "TraceFileNameParser returns nil for non-digit filename" started.
􀟈 Test "TraceFileNameParser returns nil for empty string" started.
􀟈 Test "sanitizeModelName trims and bounds name length to 256" started.
􀟈 Test "attributes maps MLComputeUnits.cpuAndGPU to 'cpu_and_gpu'" started.
􀟈 Test "TraceFileLocator returns empty array for non-existent directory" started.
􀟈 Test "Anthropic tokens override OpenAI tokens when both present in usage" started.
􀟈 Test "HuggingFace format parses max_new_tokens" started.
􀟈 Test "Response with no usage data returns nil" started.
􀟈 Test "Trace.init throws duplicateSpanIds when spans reuse the same span ID" started.
􀟈 Test streamRendererTimestampUsesUTCWithFractionalSeconds() started.
􀟈 Test streamRendererTimestampStableUnderConcurrentRendering() started.
􀟈 Test "sanitizeModelName strips control characters" started.
􀟈 Test "TraceLoader reports oversized trace files as failures" started.
􀟈 Test "Keys.computeUnits has expected value" started.
􀟈 Test "attributes(configuration:) produces same result as attributes(computeUnits:)" started.
􀟈 Test "TraceFileReader enforces max size using bounded handle reads" started.
􀟈 Test "Keys.runtime has expected value" started.
􀟈 Test "Trace computes correct start and end times from spans" started.
􀟈 Test "TraceFileLocator returns files sorted by timestamp ascending" started.
􀟈 Test "TraceFileLocator excludes non-numeric filenames" started.
􀟈 Test "Anthropic request format parses model and max_tokens" started.
􀟈 Test "TraceLoader returns empty for non-existent directory" started.
􀟈 Test "attributes(computeUnits:) returns both runtime and compute_units keys" started.
􀟈 Test "TraceLoader maxFiles loads only the newest files" started.
􀟈 Test "JSON with no recognized AI fields returns nil" started.
􀟈 Test treeRendererUsesDurationFormat() started.
􀟈 Test "Empty body returns nil" started.
􀟈 Test "OpenAI response format parses model and usage tokens" started.
􀟈 Test "Integer temperature is coerced to Double" started.
􀟈 Test "Anthropic response format parses input and output tokens" started.
􀟈 Test "Empty response body returns nil" started.
􀟈 Test "Invalid JSON response returns nil" started.
􀟈 Test "Trace.init throws emptySpans for empty array" started.
􀟈 Test "TerraTracedSession initializes with default model identifier" started.
􀟈 Test "OpenAI new format parses max_completion_tokens" started.
􀟈 Test "attributes maps MLComputeUnits.cpuOnly to 'cpu_only'" started.
􀟈 Test "TerraTracedSession initializes with custom model identifier" started.
􀟈 Test "TerraTracedSession rejects concurrent in-flight operations" started.
􀟈 Test "Host boundary match is case-insensitive" started.
􀟈 Test "Host boundary match rejects suffix confusion" started.
􀟈 Test "Host boundary match allows exact host and subdomains" started.
􁁛 Test "TraceFileNameParser extracts timestamp from numeric prefix" passed after 0.005 seconds.
􀟈 Test "TraceLoader handles concurrent loads without crashing" started.
􁁛 Test "TraceFileNameParser handles composite filename with non-digit suffix" passed after 0.005 seconds.
􁁛 Test "attributes maps MLComputeUnits.cpuAndNeuralEngine to 'cpu_and_ane'" passed after 0.005 seconds.
􁁛 Test "Response with only model field is returned" passed after 0.005 seconds.
􁁛 Test "Ollama response format parses prompt_eval_count and eval_count" passed after 0.005 seconds.
􁁛 Test "attributes maps MLComputeUnits.all to 'all'" passed after 0.005 seconds.
􁁛 Test "Invalid JSON returns nil" passed after 0.005 seconds.
􁁛 Test "TraceFileNameParser returns nil for non-digit filename" passed after 0.005 seconds.
􁁛 Test "TraceFileNameParser returns nil for empty string" passed after 0.005 seconds.
􁁛 Test "sanitizeModelName trims and bounds name length to 256" passed after 0.005 seconds.
􁁛 Test "attributes maps MLComputeUnits.cpuAndGPU to 'cpu_and_gpu'" passed after 0.006 seconds.
􁁛 Test "Request body larger than 10 MiB is rejected" passed after 0.006 seconds.
􁁛 Test "Anthropic tokens override OpenAI tokens when both present in usage" passed after 0.006 seconds.
􀟈 Test "traced creates a span with the expected model attribute" started.
􁁛 Test "HuggingFace format parses max_new_tokens" passed after 0.005 seconds.
􀟈 Test "Instrumentations.none has rawValue 0" started.
􁁛 Test "Response with no usage data returns nil" passed after 0.005 seconds.
􁁛 Test "TraceFileLocator returns empty array for non-existent directory" passed after 0.006 seconds.
􁁛 Test "OpenAI request format parses model, max_tokens, temperature, stream" passed after 0.006 seconds.
􁁛 Test "TraceLoader returns empty for empty directory" passed after 0.006 seconds.
􁁛 Test "sanitizeModelName strips control characters" passed after 0.005 seconds.
􁁛 Test "Trace.init throws invalidFileName for non-numeric name" passed after 0.006 seconds.
􁁛 Test "Trace.init throws mismatchedTraceIds when spans have different trace IDs" passed after 0.006 seconds.
􁁛 Test "Trace.init throws duplicateSpanIds when spans reuse the same span ID" passed after 0.006 seconds.
􁁛 Test "Keys.computeUnits has expected value" passed after 0.006 seconds.
􁁛 Test "Keys.runtime has expected value" passed after 0.005 seconds.
􁁛 Test "attributes(configuration:) produces same result as attributes(computeUnits:)" passed after 0.006 seconds.
􁁛 Test "Trace computes correct start and end times from spans" passed after 0.005 seconds.
􁁛 Test "TraceLoader reports oversized trace files as failures" passed after 0.006 seconds.
􁁛 Test "TraceFileReader enforces max size using bounded handle reads" passed after 0.006 seconds.
􁁛 Test "Anthropic request format parses model and max_tokens" passed after 0.005 seconds.
􁁛 Test "TraceLoader returns empty for non-existent directory" passed after 0.006 seconds.
􁁛 Test "attributes(computeUnits:) returns both runtime and compute_units keys" passed after 0.005 seconds.
􁁛 Test "JSON with no recognized AI fields returns nil" passed after 0.006 seconds.
􁁛 Test "TraceFileLocator excludes non-numeric filenames" passed after 0.006 seconds.
􁁛 Test "TraceFileLocator returns files sorted by timestamp ascending" passed after 0.006 seconds.
􁁛 Test "Empty body returns nil" passed after 0.006 seconds.
􁁛 Test "OpenAI response format parses model and usage tokens" passed after 0.005 seconds.
􁁛 Test "Anthropic response format parses input and output tokens" passed after 0.006 seconds.
􁁛 Test "Integer temperature is coerced to Double" passed after 0.005 seconds.
􁁛 Test "Empty response body returns nil" passed after 0.005 seconds.
􁁛 Test "Invalid JSON response returns nil" passed after 0.006 seconds.
􁁛 Test "Trace.init throws emptySpans for empty array" passed after 0.006 seconds.
􁁛 Test "attributes maps MLComputeUnits.cpuOnly to 'cpu_only'" passed after 0.007 seconds.
􁁛 Test "OpenAI new format parses max_completion_tokens" passed after 0.007 seconds.
􁁛 Test treeRendererUsesDurationFormat() passed after 0.007 seconds.
􁁛 Test streamRendererTimestampUsesUTCWithFractionalSeconds() passed after 0.008 seconds.
􁁛 Test "Host boundary match is case-insensitive" passed after 0.004 seconds.
􁁛 Test "Host boundary match rejects suffix confusion" passed after 0.004 seconds.
􁁛 Test "Host boundary match allows exact host and subdomains" passed after 0.003 seconds.
􁁛 Test "TraceLoader maxFiles loads only the newest files" passed after 0.007 seconds.
􁁛 Test "TraceLoader loads valid traces and reports bad files as failures" passed after 0.008 seconds.
􁁛 Test "Instrumentations.none has rawValue 0" passed after 0.002 seconds.
􁁛 Test streamRendererTimestampStableUnderConcurrentRendering() passed after 0.008 seconds.
􁁛 Suite "HTTPAIInstrumentation Host Matching" passed after 0.009 seconds.
􀟈 Test "Instrumentations.all contains core and HTTP defaults" started.
􁁛 Test "Instrumentations.all contains core and HTTP defaults" passed after 0.001 seconds.
􀟈 Test "Instrumentations can be combined with union" started.
􁁛 Test "Instrumentations can be combined with union" passed after 0.001 seconds.
􀟈 Test "Instrumentations rawValues are distinct powers of two" started.
􁁛 Test "Instrumentations rawValues are distinct powers of two" passed after 0.001 seconds.
􀟈 Test "AutoInstrumentConfiguration default instrumentations is .all" started.
􁁛 Test "AutoInstrumentConfiguration default instrumentations is .all" passed after 0.001 seconds.
􀟈 Test "AutoInstrumentConfiguration can be customized with .none" started.
􁁛 Test "AutoInstrumentConfiguration can be customized with .none" passed after 0.001 seconds.
􀟈 Test "AutoInstrumentConfiguration holds custom excluded CoreML models" started.
􁁛 Test "AutoInstrumentConfiguration holds custom excluded CoreML models" passed after 0.001 seconds.
􀟈 Test "AutoInstrumentConfiguration default excluded CoreML models is empty" started.
􁁛 Test "AutoInstrumentConfiguration default excluded CoreML models is empty" passed after 0.001 seconds.
􀟈 Test "AutoInstrumentConfiguration default OpenClaw mode is disabled" started.
􁁛 Test "AutoInstrumentConfiguration default OpenClaw mode is disabled" passed after 0.001 seconds.
􀟈 Test "OpenClaw disabled mode defaults to no gateway hosts" started.
􁁛 Test "OpenClaw disabled mode defaults to no gateway hosts" passed after 0.001 seconds.
􀟈 Test "OpenClaw diagnosticsOnly enables diagnostics export and disables gateway instrumentation" started.
􁁛 Test "OpenClaw diagnosticsOnly enables diagnostics export and disables gateway instrumentation" passed after 0.001 seconds.
􀟈 Test "AutoInstrumentConfiguration profiling defaults are disabled" started.
􁁛 Test "AutoInstrumentConfiguration profiling defaults are disabled" passed after 0.001 seconds.
􀟈 Test "Terra.start() with .none instrumentations does not crash" started.
􁁛 Test "TerraTracedSession initializes with custom model identifier" passed after 0.023 seconds.
􁁛 Test "TerraTracedSession initializes with default model identifier" passed after 0.023 seconds.
􁁛 Test "Terra.start() with .none instrumentations does not crash" passed after 0.014 seconds.
􁁛 Test "traced creates a span with the expected model attribute" passed after 0.018 seconds.
􀟈 Test "Terra.start() throws alreadyInstalled when called twice with different config" started.
􀟈 Test "traced sets terra.runtime attribute to mlx" started.
􁁛 Test "Macro wraps async throws function body with try await" passed after 0.025 seconds.
􁁛 Test "Terra.start() throws alreadyInstalled when called twice with different config" passed after 0.001 seconds.
􀟈 Test "Terra.start() is idempotent when called twice with identical config" started.
􁁛 Test "Macro throws diagnostic when model argument label is missing from call" passed after 0.025 seconds.
􁁛 Test "Terra.start() is idempotent when called twice with identical config" passed after 0.001 seconds.
􁁛 Test "Macro expands function with prompt parameter into withInferenceSpan" passed after 0.025 seconds.
􁁛 Suite "Terra.start / AutoInstrument Tests" passed after 0.025 seconds.
􁁛 Test "traced sets terra.runtime attribute to mlx" passed after 0.001 seconds.
􀟈 Test "traced sets terra.auto_instrumented attribute to true" started.
􁁛 Test "Macro captures 'input' parameter as prompt in InferenceRequest" passed after 0.025 seconds.
􁁛 Test "Macro captures 'maxOutputTokens' parameter name correctly" passed after 0.025 seconds.
􁁛 Test "Macro with no matching parameters only puts model in InferenceRequest" passed after 0.026 seconds.
􁁛 Test "traced sets terra.auto_instrumented attribute to true" passed after 0.001 seconds.
􀟈 Test "traced forwards maxTokens to the span" started.
􁁛 Test "Macro captures maxTokens parameter as maxOutputTokens in InferenceRequest" passed after 0.026 seconds.
􁁛 Test "traced forwards maxTokens to the span" passed after 0.001 seconds.
􀟈 Test "traced forwards temperature to the span" started.
􁁛 Test "traced forwards temperature to the span" passed after 0.001 seconds.
􀟈 Test "traced returns the value produced by the closure" started.
􁁛 Test "traced returns the value produced by the closure" passed after 0.001 seconds.
􀟈 Test "traced propagates errors thrown from the closure" started.
􁁛 Test "traced propagates errors thrown from the closure" passed after 0.001 seconds.
􀟈 Test "traced span has gen_ai.inference name" started.
􁁛 Test "traced span has gen_ai.inference name" passed after 0.001 seconds.
􀟈 Test "recordTokenCount updates output token attribute on active span" started.
􁁛 Test "recordTokenCount updates output token attribute on active span" passed after 0.001 seconds.
􀟈 Test "recordFirstToken adds first_token event on active span" started.
􁁛 Test "recordFirstToken adds first_token event on active span" passed after 0.001 seconds.
􀟈 Test "Terra.MLX is a valid alias for TerraMLX" started.
􁁛 Test "TraceLoader handles concurrent loads without crashing" passed after 0.023 seconds.
􁁛 Suite "TraceKit ConcurrentAccessTests" passed after 0.028 seconds.
􁁛 Test "Terra.MLX is a valid alias for TerraMLX" passed after 0.001 seconds.
􁁛 Suite "TerraMLX Tests" passed after 0.029 seconds.
􁁛 Test "TerraTracedSession rejects concurrent in-flight operations" passed after 0.332 seconds.
􁁛 Test run with 88 tests passed after 0.334 seconds.\n- [0/1] Planning build
/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/grpc-swift/Plugins/GRPCSwiftPlugin/plugin.swift:264:42: warning: 'pluginWorkDirectory' is deprecated: renamed to 'pluginWorkDirectoryURL' #DeprecatedDeclaration
262 | }
263 |
264 | let workDirectory = PathLike(context.pluginWorkDirectory)
| |- warning: 'pluginWorkDirectory' is deprecated: renamed to 'pluginWorkDirectoryURL' #DeprecatedDeclaration
| `- note: use 'pluginWorkDirectoryURL' instead
265 |
266 | return try self.createBuildCommands(

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/grpc-swift/Plugins/GRPCSwiftPlugin/plugin.swift:287:18: warning: 'init(:)' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
285 |
286 | init(
path: String) {
287 | self.value = Path(path)
| - warning: 'init(_:)' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
288 | }
289 |

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/grpc-swift/Plugins/GRPCSwiftPlugin/plugin.swift:291:26: warning: 'path' is deprecated: renamed to 'url' #DeprecatedDeclaration
289 |
290 | init(_ element: FileList.Element) {
291 | self.value = element.path
| |- warning: 'path' is deprecated: renamed to 'url' #DeprecatedDeclaration
| `- note: use 'url' instead
292 | }
293 |

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/grpc-swift/Plugins/GRPCSwiftPlugin/plugin.swift:295:26: warning: 'path' is deprecated: renamed to 'url' #DeprecatedDeclaration
293 |
294 | init(_ element: PluginContext.Tool) {
295 | self.value = element.path
| |- warning: 'path' is deprecated: renamed to 'url' #DeprecatedDeclaration
| `- note: use 'url' instead
296 | }
297 |

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/grpc-swift/Plugins/GRPCSwiftPlugin/plugin.swift:303:23: warning: 'lastComponent' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
301 |
302 | var lastComponent: String {
303 | return self.value.lastComponent
| - warning: 'lastComponent' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
304 | }
305 |

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/grpc-swift/Plugins/GRPCSwiftPlugin/plugin.swift:308:29: warning: 'removingLastComponent()' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
306 | func removingLastComponent() -> Self {
307 | var copy = self
308 | copy.value = self.value.removingLastComponent()
| - warning: 'removingLastComponent()' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
309 | return copy
310 | }

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/grpc-swift/Plugins/GRPCSwiftPlugin/plugin.swift:314:29: warning: 'appending' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
312 | func appending(_ path: String) -> Self {
313 | var copy = self
314 | copy.value = self.value.appending(path)
| - warning: 'appending' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
315 | return copy
316 | }

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/grpc-swift/Plugins/GRPCSwiftPlugin/plugin.swift:327:17: warning: 'buildCommand(displayName:executable:arguments:environment:inputFiles:outputFiles:)' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
325 | outputFiles: [PathLike]
326 | ) -> PackagePlugin.Command {
327 | return Self.buildCommand(
| - warning: 'buildCommand(displayName:executable:arguments:environment:inputFiles:outputFiles:)' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
328 | displayName: displayName,
329 | executable: executable.value,

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/grpc-swift/Plugins/GRPCSwiftPlugin/plugin.swift:339:35: warning: 'appendInterpolation' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
337 | extension URL {
338 | init(_ pathLike: PathLike) {
339 | self = URL(fileURLWithPath: "(pathLike.value)")
| - warning: 'appendInterpolation' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
340 | }
341 | }

[1/1] Compiling plugin GRPCSwiftPlugin
/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:9:14: warning: associated value 'invalidTarget' of 'Sendable'-conforming enum 'PluginError' has non-Sendable type 'any Target'
7 | enum PluginError: Error, CustomStringConvertible {
8 | /// Indicates that the target where the plugin was applied to was not SourceModuleTarget.
9 | case invalidTarget(Target)
| - warning: associated value 'invalidTarget' of 'Sendable'-conforming enum 'PluginError' has non-Sendable type 'any Target' 10 | /// Indicates that the file extension of an input file was not .proto`.
11 | case invalidInputFileExtension(String)

PackagePlugin.Target:1:17: note: protocol 'Target' does not conform to the 'Sendable' protocol
1 | public protocol Target {
| `- note: protocol 'Target' does not conform to the 'Sendable' protocol
2 | var id: Self.ID { get }
3 | typealias ID = String

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:2:1: warning: add '@preconcurrency' to treat 'Sendable'-related errors from module 'PackagePlugin' as warnings
1 | import Foundation
2 | import PackagePlugin
| - warning: add '@preconcurrency' to treat 'Sendable'-related errors from module 'PackagePlugin' as warnings 3 | 4 | @main /Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:9:14: warning: associated value 'invalidTarget' of 'Sendable'-conforming enum 'PluginError' has non-Sendable type 'any Target' 7 | enum PluginError: Error, CustomStringConvertible { 8 | /// Indicates that the target where the plugin was applied to was not SourceModuleTarget. 9 | case invalidTarget(Target) | - warning: associated value 'invalidTarget' of 'Sendable'-conforming enum 'PluginError' has non-Sendable type 'any Target'
10 | /// Indicates that the file extension of an input file was not .proto.
11 | case invalidInputFileExtension(String)

PackagePlugin.Target:1:17: note: protocol 'Target' does not conform to the 'Sendable' protocol
1 | public protocol Target {
| `- note: protocol 'Target' does not conform to the 'Sendable' protocol
2 | var id: Self.ID { get }
3 | typealias ID = String

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:2:1: warning: add '@preconcurrency' to treat 'Sendable'-related errors from module 'PackagePlugin' as warnings
1 | import Foundation
2 | import PackagePlugin
| `- warning: add '@preconcurrency' to treat 'Sendable'-related errors from module 'PackagePlugin' as warnings
3 |
4 | @main

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:117:24: warning: 'path' is deprecated: renamed to 'url' #DeprecatedDeclaration
115 | let configurationFilePath = sourceFiles.first(
116 | where: {
117 | $0.path.lastComponent == Self.configurationFileName
| |- warning: 'path' is deprecated: renamed to 'url' #DeprecatedDeclaration
| `- note: use 'url' instead
118 | }
119 | )?.path

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:117:29: warning: 'lastComponent' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
115 | let configurationFilePath = sourceFiles.first(
116 | where: {
117 | $0.path.lastComponent == Self.configurationFileName
| - warning: 'lastComponent' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
118 | }
119 | )?.path

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:119:16: warning: 'path' is deprecated: renamed to 'url' #DeprecatedDeclaration
117 | $0.path.lastComponent == Self.configurationFileName
118 | }
119 | )?.path
| |- warning: 'path' is deprecated: renamed to 'url' #DeprecatedDeclaration
| `- note: use 'url' instead
120 | else {
121 | throw PluginError.noConfigFound(Self.configurationFileName)

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:123:64: warning: 'appendInterpolation' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
121 | throw PluginError.noConfigFound(Self.configurationFileName)
122 | }
123 | let data = try Data(contentsOf: URL(fileURLWithPath: "(configurationFilePath)"))
| - warning: 'appendInterpolation' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
124 | let configuration = try JSONDecoder().decode(Configuration.self, from: data)
125 | try validateConfiguration(configuration)

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:131:26: warning: 'init(_:)' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
129 | if let configuredProtocPath = configuration.protocPath {
130 | // The user set the config path in the file. So let's take that
131 | protocPath = Path(configuredProtocPath)
| - warning: 'init(_:)' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
132 | } else if let environmentPath = ProcessInfo.processInfo.environment["PROTOC_PATH"] {
133 | // The user set the env variable. So let's take that

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:134:26: warning: 'init(_:)' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
132 | } else if let environmentPath = ProcessInfo.processInfo.environment["PROTOC_PATH"] {
133 | // The user set the env variable. So let's take that
134 | protocPath = Path(environmentPath)
| - warning: 'init(_:)' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
135 | } else {
136 | // The user didn't set anything so let's try see if SPM can find a binary for us

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:137:45: warning: 'path' is deprecated: renamed to 'url' #DeprecatedDeclaration
135 | } else {
136 | // The user didn't set anything so let's try see if SPM can find a binary for us
137 | protocPath = try tool("protoc").path
| |- warning: 'path' is deprecated: renamed to 'url' #DeprecatedDeclaration
| `- note: use 'url' instead
138 | }
139 | let protocGenSwiftPath = try tool("protoc-gen-swift").path

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:139:63: warning: 'path' is deprecated: renamed to 'url' #DeprecatedDeclaration
137 | protocPath = try tool("protoc").path
138 | }
139 | let protocGenSwiftPath = try tool("protoc-gen-swift").path
| |- warning: 'path' is deprecated: renamed to 'url' #DeprecatedDeclaration
| `- note: use 'url' instead
140 |
141 | return configuration.invocations.map { invocation in

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:143:50: warning: 'removingLastComponent()' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
141 | return configuration.invocations.map { invocation in
142 | self.invokeProtoc(
143 | directory: configurationFilePath.removingLastComponent(),
| - warning: 'removingLastComponent()' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
144 | invocation: invocation,
145 | protocPath: protocPath,

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:170:41: warning: 'appendInterpolation' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
168 | // Construct the protoc arguments.
169 | var protocArgs = [
170 | "--plugin=protoc-gen-swift=(protocGenSwiftPath)",
| - warning: 'appendInterpolation' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
171 | "--swift_out=(outputDirectory)",
172 | ]

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:171:27: warning: 'appendInterpolation' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
169 | var protocArgs = [
170 | "--plugin=protoc-gen-swift=(protocGenSwiftPath)",
171 | "--swift_out=(outputDirectory)",
| - warning: 'appendInterpolation' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
172 | ]
173 |

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:177:29: warning: 'appendInterpolation' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
175 | // the proto files relative to it.
176 | protocArgs.append("-I")
177 | protocArgs.append("(directory)")
| - warning: 'appendInterpolation' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
178 |
179 | // Add the visibility if it was set

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:205:41: warning: 'appending' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
203 | // Append the file to the protoc args so that it is used for generating
204 | protocArgs.append("(file)")
205 | inputFiles.append(directory.appending(file))
| - warning: 'appending' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
206 |
207 | // The name of the output file is based on the name of the input file.

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:212:54: warning: 'appending' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
210 | file.removeLast(5)
211 | file.append("pb.swift")
212 | let protobufOutputPath = outputDirectory.appending(file)
| - warning: 'appending' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
213 |
214 | // Add the outputPath as an output file

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:221:24: warning: 'buildCommand(displayName:executable:arguments:environment:inputFiles:outputFiles:)' is deprecated: Use URL type instead of Path. #DeprecatedDeclaration
219 | // system know when to invoke the command. The output paths are passed on to
220 | // the rule engine in the build system.
221 | return Command.buildCommand(
| - warning: 'buildCommand(displayName:executable:arguments:environment:inputFiles:outputFiles:)' is deprecated: Use URLtype instead ofPath`. #DeprecatedDeclaration
222 | displayName: "Generating swift files from proto files",
223 | executable: protocPath,

/Users/chriskarani/.codex/worktrees/c24e/Terra/.build/checkouts/swift-protobuf/Plugins/SwiftProtobufPlugin/plugin.swift:251:42: warning: 'pluginWorkDirectory' is deprecated: renamed to 'pluginWorkDirectoryURL' #DeprecatedDeclaration
249 | }
250 | return try createBuildCommands(
251 | pluginWorkDirectory: context.pluginWorkDirectory,
| |- warning: 'pluginWorkDirectory' is deprecated: renamed to 'pluginWorkDirectoryURL' #DeprecatedDeclaration
| `- note: use 'pluginWorkDirectoryURL' instead
252 | sourceFiles: swiftTarget.sourceFiles,
253 | tool: context.tool

[2/2] Compiling plugin SwiftProtobufPlugin
Building for debugging...
[2/6] Write swift-version--58304C5D6DBC2206.txt
Build complete! (8.27s)\n\nAll tests pass and build succeeds.\n\n## Notes\n- Existing third-party/plugin deprecation warnings remain unchanged and out of scope for this remediation.\n- Updated with plan completion and review notes for this audit pass.

- synchronize OTLPHTTPServer mutable lifecycle state via queue-bound access for start/stop/port/deinit

- serialize TerraTracedSession operations with explicit request gating and deterministic overlap errors

- harden TraceFileReader against TOCTOU oversize bypass with same-handle bounded reads

- add regression coverage for server lifecycle concurrency, traced-session overlap rejection, and reader max-size enforcement

- document execution plan/review notes in tasks/todo.md and validate with targeted/full swift test plus swift build
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7468e29432

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +95 to +97
guard let self else {
continuation.finish(throwing: CancellationError())
return
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retain session during stream task startup

The new guard let self causes streamResponse to fail with CancellationError if the TerraTracedSession instance is released before the Task starts, even though modelIdentifier and session are already captured and sufficient to run the stream. This introduces a regression for call patterns that don't keep an extra strong reference (for example, consuming a stream returned from a temporary session), leading to nondeterministic early cancellation.

Useful? React with 👍 / 👎.

defer { try? handle.close() }

let initialSize = try handle.seekToEnd()
if initialSize > UInt64(maxFileSizeBytes) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate max size before unsigned/file-read arithmetic

maxFileSizeBytes is a public initializer input, but this code now performs UInt64(maxFileSizeBytes) and maxFileSizeBytes + 1 without validation; values like -1 or Int.max will trap at runtime instead of throwing a TraceFileError. This turns malformed configuration into a process crash in production paths that instantiate TraceFileReader with external limits.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant