Repository navigation
Build the engine under the strictest compiler settings - #384
Merged
Merged
Conversation
Package.swift now applies one shared `strictSettings` array to AssemblyAI, BlurtEngine, CommandFixture and BlurtEngineTests: ExistentialAny, MemberImportVisibility, InternalImportsByDefault, InferIsolatedConformances, ImmutableWeakCaptures, strict memory safety, all warnings as errors, -require-explicit-sendable, and a 500 ms type-checking threshold for function bodies and expressions. Features that change run-time behaviour rather than checking (NonisolatedNonsendingByDefault, default MainActor isolation, ApproachableConcurrency, -enable-actor-data-race-checks) are left off, with the reasons in the manifest. ios-typecheck.sh passes the same flags for the engine's iOS shape. The fixes are diagnostics only: `any` on existentials, `public import` where a public API exposes an imported type, imports a file was relying on another file for, `unsafe` acknowledgements on the existing pointer and buffer code, `@safe` on the three classes that keep raw audio handles private, `@unsafe` on the `@preconcurrency` AVFoundation imports, and `nonisolated` on the fixture's AppKit conformances to keep them as they were. No logic changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Marking the unsafe pointer calls reflowed the capacity and after-close tests' AudioBufferList setup into identical lines, which jscpd flags as a clone. One withMonoList helper holds it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds every engine target (AssemblyAI, BlurtEngine, CommandFixture, BlurtEngineTests) under one shared
strictSettingsarray inPackage.swift. Every new diagnostic is fixed. There are no behavior changes.Enabled
ExistentialAny(SE-0335)MemberImportVisibility(SE-0444)InternalImportsByDefault(SE-0409)InferIsolatedConformances(SE-0470)ImmutableWeakCaptures(SE-0481).strictMemorySafety()(SE-0458).treatAllWarnings(as: .error)(SE-0480)unsafeFlags:-require-explicit-sendable-warn-long-function-bodies=500and-warn-long-expression-type-checking=500. The slowest type-check today is 181 ms.scripts/ios-typecheck.shpasses the same flags, so the engine's iOS-only code is held to the same bar. Comments in both files say to change the two lists together.Deliberately excluded (reasons in a
Package.swiftcomment)These change what the code does, not what the compiler checks:
NonisolatedNonsendingByDefault(SE-0461): moves where every nonisolated async function runs.ApproachableConcurrency: bundles the two above.-enable-actor-data-race-checks: adds run-time traps; Swift 6's dynamic isolation checks already cover them.Diagnostics fixed
Memory safety: about 156
unsafeacknowledgements on existing Core Audio, Accessibility, Keychain and keyboard-layout pointer code, with none of it rewritten.@safemarks three types that keep raw audio handles private:AudioRouteMonitor,SystemAudioRecorderandMixWriter.@preconcurrency @unsafe import AVFoundationwhere the capture code needs it.guard let xbecameguard let x = unsafe x.Imports: each new
public importis the minimum the compiler accepts. An unneeded one is itself a warning, and warnings are now errors.Review check: I stripped
any,unsafe,@safe/@unsafe,nonisolated, import lines and comments out of the diff. What was left is only those markers on reflowed lines.Two small follow-ons:
MixWritertests' buffer setup identical, so it now lives in onewithMonoListtest helper.for unsafe buffer in buffersbut its own linter flags the spacing, so that one loop carries// swift-format-ignorewith a comment explaining why.Verification
scripts/check.shrun from a checkout namedblurt, as CI uses:BlurtiOSCorecoverage 96.12%.main:ios-typecheck.shpasses.🤖 Generated with Claude Code