Make panic wipe deterministic and device-bound (#1431)

* Make panic wipe deterministic and device-bound

* Scope install markers to iOS

* Harden panic recovery and service shutdown

* Invalidate queued BLE ingress during panic

* Harden panic keychain and media cleanup

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: jack <jack@deck.local>
This commit is contained in:
jack
2026-07-26 10:28:50 +02:00
committed by GitHub
co-authored by jack jack
parent fb8fe39713
commit cd727c6867
30 changed files with 2747 additions and 299 deletions
+29
View File
@@ -360,6 +360,35 @@ struct VoiceRecorderTests {
#expect(FileManager.default.fileExists(atPath: secondURL.path))
}
@Test func classicSessionPanicStopsRecorderAndDeletesFileBeforeReturning() async throws {
let directory = try makeTemporaryDirectory()
defer { try? FileManager.default.removeItem(at: directory) }
let rawSession = VoiceRecorderTestSession()
let coordinator = AudioSessionCoordinator(session: rawSession)
let factory = TestVoiceAudioRecorderFactory(plans: [.success])
let voiceRecorder = VoiceRecorder(
sessionCoordinator: coordinator,
recorderFactory: factory,
permissionGranted: { true },
paddingInterval: 0,
outputDirectory: directory
)
let capture = VoiceNoteCaptureSession(recorder: voiceRecorder)
try await capture.start()
let url = try #require(factory.urls.first)
let recorder = try #require(factory.recorders.first)
capture.panicCancelSynchronously()
#expect(recorder.stopCallCount == 1)
#expect(!recorder.isRecording)
#expect(!FileManager.default.fileExists(atPath: url.path))
await coordinator.drain()
#expect(rawSession.activationCalls == [true, false])
}
private func verifyFailedStart(
firstPlan: TestVoiceAudioRecorderFactory.Plan,
expectedPrepareCalls: Int,