commit d3b1aabb8347a6cf5033c0816fde6ab187e69f8c
parent 2b739836097054dda56a8aae85c4298750faea16
Author: triesap <tyson@radroots.org>
Date: Wed, 17 Jun 2026 18:20:49 -0700
field-ios: align background probe with guard
- rename background handler registration telemetry
- keep UI-test assertions on the registration behavior
- expire probe staged blobs through the test clock
- verify cleanup through AppleKit file access
Diffstat:
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/Radroots/Runtime/FieldBackgroundExecution.swift b/Radroots/Runtime/FieldBackgroundExecution.swift
@@ -71,12 +71,19 @@ actor FieldBackgroundExecution {
if uiTestWasRequested {
let scheduler = RadrootsFakeBackgroundTaskScheduler()
let transfer = RadrootsFakeBackgroundTransfer()
+ let now: @Sendable () -> Date
+ if FieldBackgroundExecutionUITestProbe.isRequested {
+ now = { Date.distantFuture }
+ } else {
+ now = Date.init
+ }
return FieldBackgroundExecution(
identifiers: identifiers,
scheduler: scheduler,
transfer: transfer,
roots: roots,
telemetry: telemetry,
+ now: now,
registerHandlers: { _ in }
)
}
@@ -123,7 +130,7 @@ actor FieldBackgroundExecution {
)
)
hasRegisteredHandlers = true
- telemetry.backgroundExecution(operation: "register", outcome: "success", taskCount: 2)
+ telemetry.backgroundExecution(operation: "handler_registration", outcome: "success", taskCount: 2)
}
_ = try await schedulePermittedTasks(reason: "startup")
}
@@ -272,13 +279,15 @@ actor FieldBackgroundExecution {
mediaType: "text/plain",
filenameHint: "background-probe.txt"
)
- let blobURL = try roots.stagedBlobURL(for: blob)
- try FileManager.default.setAttributes(
- [.modificationDate: Date(timeIntervalSince1970: 0)],
- ofItemAtPath: blobURL.path
- )
_ = await performMaintenance(reason: "ui_test_probe")
- return !FileManager.default.fileExists(atPath: blobURL.path)
+ do {
+ _ = try fileAccess.readStagedBlob(blob)
+ return false
+ } catch RadrootsAppleFileError.notFound {
+ return true
+ } catch {
+ throw error
+ }
}
private func fakeSubmittedRequestCount() async -> Int {
diff --git a/Radroots/Runtime/FieldBackgroundExecutionUITestProbe.swift b/Radroots/Runtime/FieldBackgroundExecutionUITestProbe.swift
@@ -32,7 +32,7 @@ enum FieldBackgroundExecutionUITestProbe {
"cancellation_observed=\(cancellationObserved)",
"staged_blob_removed=\(stagedBlobRemoved)",
"transfer_snapshot_count=\(transferSnapshotCount)",
- "background_register_seen=\(eventNames.contains("field_ios.background_execution.register"))",
+ "background_register_seen=\(eventNames.contains("field_ios.background_execution.handler_registration"))",
"background_schedule_seen=\(eventNames.contains("field_ios.background_execution.schedule"))",
"background_cancel_all_seen=\(eventNames.contains("field_ios.background_execution.cancel_all"))",
"background_transfer_inspect_seen=\(eventNames.contains("field_ios.background_execution.transfer_inspect"))",