Selaa lähdekoodia

Merge pull request #621 from nightscout/oref-swift-profile-logging

[Part 1 / 2] Replay `profile` calls in oref swift
Deniz Cengiz 4 kuukautta sitten
vanhempi
commit
ce2ad1a0b9

+ 12 - 0
Trio/Resources/InfoPlist.xcstrings

@@ -457,6 +457,18 @@
         }
       }
     },
+    "NSCalendarsFullAccessUsageDescription" : {
+      "comment" : "Privacy - Calendars Full Access Usage Description",
+      "extractionState" : "extracted_with_value",
+      "localizations" : {
+        "en" : {
+          "stringUnit" : {
+            "state" : "new",
+            "value" : "To create events with BG reading values, so that they can be viewed on Apple Watch and CarPlay"
+          }
+        }
+      }
+    },
     "NSCalendarsUsageDescription" : {
       "comment" : "Privacy - Calendars Usage Description",
       "extractionState" : "extracted_with_value",

+ 12 - 6
Trio/Sources/APS/OpenAPS/OpenAPS.swift

@@ -570,6 +570,7 @@ final class OpenAPS {
             }
         }
 
+        let clock = Date()
         do {
             let pumpProfile = try await makeProfile(
                 preferences: adjustedPreferences,
@@ -582,7 +583,8 @@ final class OpenAPS {
                 model: model,
                 autotune: RawJSON.null,
                 trioSettings: trioSettings,
-                useSwiftOref: useSwiftOref
+                useSwiftOref: useSwiftOref,
+                clock: clock
             )
 
             let profile = try await makeProfile(
@@ -596,7 +598,8 @@ final class OpenAPS {
                 model: model,
                 autotune: RawJSON.null,
                 trioSettings: trioSettings,
-                useSwiftOref: useSwiftOref
+                useSwiftOref: useSwiftOref,
+                clock: clock
             )
 
             // Save the profiles
@@ -1026,7 +1029,8 @@ final class OpenAPS {
         model: JSON,
         autotune: JSON,
         trioSettings: JSON,
-        useSwiftOref: Bool
+        useSwiftOref: Bool,
+        clock: Date
     ) async throws -> RawJSON {
         let startJavascriptAt = Date()
         let jsResult = await makeProfileJavascript(
@@ -1050,7 +1054,7 @@ final class OpenAPS {
         }
 
         let startSwiftAt = Date()
-        let swiftResult = OpenAPSSwift.makeProfile(
+        let (swiftResult, makeProfileInputs) = OpenAPSSwift.makeProfile(
             preferences: preferences,
             pumpSettings: pumpSettings,
             bgTargets: bgTargets,
@@ -1059,7 +1063,8 @@ final class OpenAPS {
             carbRatio: carbRatio,
             tempTargets: tempTargets,
             model: model,
-            trioSettings: trioSettings
+            trioSettings: trioSettings,
+            clock: clock
         )
         let swiftDuration = Date().timeIntervalSince(startSwiftAt)
 
@@ -1068,7 +1073,8 @@ final class OpenAPS {
             swift: swiftResult,
             swiftDuration: swiftDuration,
             javascript: jsResult,
-            javascriptDuration: javascriptDuration
+            javascriptDuration: javascriptDuration,
+            makeProfileInputs: makeProfileInputs
         )
 
         return try jsResult.returnOrThrow()

+ 17 - 0
Trio/Sources/APS/OpenAPSSwift/Logging/AlgorithmComparison.swift

@@ -109,6 +109,20 @@ struct DetermineBasalInputs: Codable {
     let clock: Date
 }
 
+/// For tracking inputs to `makeProfile` when there is a mismatch
+struct MakeProfileInputs: Codable {
+    let preferences: Preferences
+    let pumpSettings: PumpSettings
+    let bgTargets: BGTargets
+    let basalProfile: [BasalProfileEntry]
+    let isf: InsulinSensitivities
+    let carbRatios: CarbRatios
+    let tempTargets: [TempTarget]
+    let model: String
+    let trioSettings: TrioSettings
+    let clock: Date
+}
+
 /// Represents a complete comparison between JS and Swift implementations
 struct AlgorithmComparison: Codable {
     let id: UUID
@@ -137,6 +151,7 @@ struct AlgorithmComparison: Codable {
     let mealInput: MealInputs?
     let autosensInput: AutosensInputs?
     let determineBasalInput: DetermineBasalInputs?
+    let makeProfileInput: MakeProfileInputs?
 
     init(
         function: OrefFunction,
@@ -151,6 +166,7 @@ struct AlgorithmComparison: Codable {
         mealInputs: MealInputs? = nil,
         autosensInputs: AutosensInputs? = nil,
         determineBasalInputs: DetermineBasalInputs? = nil,
+        makeProfileInputs: MakeProfileInputs? = nil,
         id: UUID = UUID(),
         createdAt: Date = Date()
     ) {
@@ -168,6 +184,7 @@ struct AlgorithmComparison: Codable {
         mealInput = mealInputs
         autosensInput = autosensInputs
         determineBasalInput = determineBasalInputs
+        makeProfileInput = makeProfileInputs
         timezone = TimeZone.current.identifier
         version = "4"
         #if targetEnvironment(simulator)

+ 14 - 7
Trio/Sources/APS/OpenAPSSwift/Logging/JSONCompare.swift

@@ -87,7 +87,8 @@ enum JSONCompare {
         iobInputs: IobInputs? = nil,
         mealInputs: MealInputs? = nil,
         autosensInputs: AutosensInputs? = nil,
-        determineBasalInputs: DetermineBasalInputs? = nil
+        determineBasalInputs: DetermineBasalInputs? = nil,
+        makeProfileInputs: MakeProfileInputs? = nil
     ) {
         let comparison = createComparison(
             function: function,
@@ -98,7 +99,8 @@ enum JSONCompare {
             iobInputs: iobInputs,
             mealInputs: mealInputs,
             autosensInputs: autosensInputs,
-            determineBasalInputs: determineBasalInputs
+            determineBasalInputs: determineBasalInputs,
+            makeProfileInputs: makeProfileInputs
         )
 
         Task {
@@ -119,7 +121,8 @@ enum JSONCompare {
         iobInputs: IobInputs?,
         mealInputs: MealInputs?,
         autosensInputs: AutosensInputs?,
-        determineBasalInputs: DetermineBasalInputs?
+        determineBasalInputs: DetermineBasalInputs?,
+        makeProfileInputs: MakeProfileInputs?
     ) -> AlgorithmComparison {
         switch (swift, javascript) {
         case let (.success(swiftJson), .success(javascriptJson)):
@@ -135,7 +138,8 @@ enum JSONCompare {
                     iobInputs: differences.isEmpty ? nil : iobInputs,
                     mealInputs: differences.isEmpty ? nil : mealInputs,
                     autosensInputs: differences.isEmpty ? nil : autosensInputs,
-                    determineBasalInputs: differences.isEmpty ? nil : determineBasalInputs
+                    determineBasalInputs: differences.isEmpty ? nil : determineBasalInputs,
+                    makeProfileInputs: differences.isEmpty ? nil : makeProfileInputs
                 )
             } catch {
                 return AlgorithmComparison(
@@ -147,7 +151,8 @@ enum JSONCompare {
                     iobInputs: iobInputs,
                     mealInputs: mealInputs,
                     autosensInputs: autosensInputs,
-                    determineBasalInputs: determineBasalInputs
+                    determineBasalInputs: determineBasalInputs,
+                    makeProfileInputs: makeProfileInputs
                 )
             }
 
@@ -168,7 +173,8 @@ enum JSONCompare {
                 iobInputs: iobInputs,
                 mealInputs: mealInputs,
                 autosensInputs: autosensInputs,
-                determineBasalInputs: determineBasalInputs
+                determineBasalInputs: determineBasalInputs,
+                makeProfileInputs: makeProfileInputs
             )
 
         case let (.success, .failure(jsError)):
@@ -180,7 +186,8 @@ enum JSONCompare {
                 iobInputs: iobInputs,
                 mealInputs: mealInputs,
                 autosensInputs: autosensInputs,
-                determineBasalInputs: determineBasalInputs
+                determineBasalInputs: determineBasalInputs,
+                makeProfileInputs: makeProfileInputs
             )
         }
     }

+ 21 - 5
Trio/Sources/APS/OpenAPSSwift/OpenAPSSwift.swift

@@ -10,8 +10,11 @@ struct OpenAPSSwift {
         carbRatio: JSON,
         tempTargets: JSON,
         model: JSON,
-        trioSettings: JSON
-    ) -> OrefFunctionResult {
+        trioSettings: JSON,
+        clock: Date
+    ) -> (OrefFunctionResult, MakeProfileInputs?) {
+        var makeProfileInputs: MakeProfileInputs?
+
         do {
             let preferences = try JSONBridge.preferences(from: preferences)
             let pumpSettings = try JSONBridge.pumpSettings(from: pumpSettings)
@@ -23,6 +26,19 @@ struct OpenAPSSwift {
             let model = JSONBridge.model(from: model)
             let trioSettings = try JSONBridge.trioSettings(from: trioSettings)
 
+            makeProfileInputs = MakeProfileInputs(
+                preferences: preferences,
+                pumpSettings: pumpSettings,
+                bgTargets: bgTargets,
+                basalProfile: basalProfile,
+                isf: isf,
+                carbRatios: carbRatio,
+                tempTargets: tempTargets,
+                model: model,
+                trioSettings: trioSettings,
+                clock: clock
+            )
+
             let profile = try ProfileGenerator.generate(
                 pumpSettings: pumpSettings,
                 bgTargets: bgTargets,
@@ -32,12 +48,12 @@ struct OpenAPSSwift {
                 carbRatios: carbRatio,
                 tempTargets: tempTargets,
                 model: model,
-                trioSettings: trioSettings
+                clock: clock
             )
 
-            return try .success(JSONBridge.to(profile))
+            return (try .success(JSONBridge.to(profile)), makeProfileInputs)
         } catch {
-            return .failure(error)
+            return (.failure(error), makeProfileInputs)
         }
     }
 

+ 2 - 2
Trio/Sources/APS/OpenAPSSwift/Profile/Basal.swift

@@ -1,8 +1,8 @@
 import Foundation
 
 struct Basal {
-    static func basalLookup(_ basalProfile: [BasalProfileEntry], now: Date? = nil) throws -> Decimal? {
-        let nowDate = now ?? Date()
+    static func basalLookup(_ basalProfile: [BasalProfileEntry], now: Date) throws -> Decimal? {
+        let nowDate = now
 
         // Original had a sort but it was a no-op if 'i' wasn't present, so we can skip it
         let basalProfileData = basalProfile

+ 1 - 1
Trio/Sources/APS/OpenAPSSwift/Profile/Carbs.swift

@@ -1,7 +1,7 @@
 import Foundation
 
 struct Carbs {
-    static func carbRatioLookup(carbRatio: CarbRatios, now: Date = Date()) -> Decimal? {
+    static func carbRatioLookup(carbRatio: CarbRatios, now: Date) -> Decimal? {
         // Get last schedule as default
         guard let lastSchedule = carbRatio.schedule.last else { return nil }
         var currentRatio = lastSchedule.ratio

+ 2 - 2
Trio/Sources/APS/OpenAPSSwift/Profile/Isf.swift

@@ -4,9 +4,9 @@ import Foundation
 struct Isf {
     static func isfLookup(
         isfDataInput: InsulinSensitivities,
-        timestamp: Date? = nil
+        timestamp: Date
     ) throws -> (Decimal, ComputedInsulinSensitivities) {
-        let now = timestamp ?? Date()
+        let now = timestamp
 
         let isfData = isfDataInput.computedInsulinSensitivies()
 

+ 12 - 9
Trio/Sources/APS/OpenAPSSwift/Profile/ProfileGenerator.swift

@@ -74,7 +74,7 @@ enum ProfileGenerator {
         carbRatios: CarbRatios,
         tempTargets: [TempTarget],
         model: String,
-        trioSettings _: TrioSettings
+        clock: Date
     ) throws -> Profile {
         let model = model.replacingOccurrences(of: "\"", with: "").trimmingCharacters(in: .whitespacesAndNewlines)
 
@@ -97,7 +97,7 @@ enum ProfileGenerator {
             debug(.openAPS, "don't modify insulin peak time")
         }
 
-        return try generate(
+        return try generateProfile(
             pumpSettings: pumpSettings,
             bgTargets: bgTargets,
             basalProfile: basalProfile,
@@ -105,12 +105,13 @@ enum ProfileGenerator {
             preferences: preferences,
             carbRatios: carbRatios,
             tempTargets: tempTargets,
-            model: model
+            model: model,
+            clock: clock
         )
     }
 
     /// Direct port of the OpenAPS profile generate function
-    private static func generate(
+    private static func generateProfile(
         pumpSettings: PumpSettings,
         bgTargets: BGTargets,
         basalProfile: [BasalProfileEntry],
@@ -118,7 +119,8 @@ enum ProfileGenerator {
         preferences: Preferences,
         carbRatios: CarbRatios,
         tempTargets: [TempTarget],
-        model: String
+        model: String,
+        clock: Date
     ) throws -> Profile {
         var profile = Profile() // start with the defaults
 
@@ -138,7 +140,7 @@ enum ProfileGenerator {
         profile.model = model
         profile.skipNeutralTemps = preferences.skipNeutralTemps
 
-        profile.currentBasal = try Basal.basalLookup(basalProfile)
+        profile.currentBasal = try Basal.basalLookup(basalProfile, now: clock)
         profile.basalprofile = basalProfile
 
         let basalProfile = basalProfile
@@ -169,7 +171,8 @@ enum ProfileGenerator {
         }
 
         profile.outUnits = bgTargets.userPreferredUnits
-        let (updatedTargets, range) = try Targets.bgTargetsLookup(targets: bgTargets, tempTargets: tempTargets, profile: profile)
+        let (updatedTargets, range) = try Targets
+            .bgTargetsLookup(targets: bgTargets, tempTargets: tempTargets, profile: profile, now: clock)
         profile.minBg = range.minBg?.rounded()
         profile.maxBg = range.maxBg?.rounded()
         // Note: we're using updatedTargets here because in Javascript the bgTargetsLookup
@@ -195,7 +198,7 @@ enum ProfileGenerator {
         )
 
         profile.temptargetSet = range.temptargetSet
-        let (sens, isfUpdated) = try Isf.isfLookup(isfDataInput: isf)
+        let (sens, isfUpdated) = try Isf.isfLookup(isfDataInput: isf, timestamp: clock)
         profile.sens = sens
         profile.isfProfile = isfUpdated
 
@@ -208,7 +211,7 @@ enum ProfileGenerator {
         }
 
         // Handle carb ratio data
-        guard let currentCarbRatio = Carbs.carbRatioLookup(carbRatio: carbRatios) else {
+        guard let currentCarbRatio = Carbs.carbRatioLookup(carbRatio: carbRatios, now: clock) else {
             throw ProfileError.invalidCarbRatio
         }
         profile.carbRatio = currentCarbRatio

+ 1 - 1
Trio/Sources/APS/OpenAPSSwift/Profile/Targets.swift

@@ -84,7 +84,7 @@ struct Targets {
         targets: BGTargets,
         tempTargets: [TempTarget],
         profile: Profile,
-        now: Date = Date()
+        now: Date
     ) throws -> (ComputedBGTargets, ComputedBGTargetEntry) {
         var (computedBgTargets, targetIdx) = try lookup(targets: targets, tempTargets: tempTargets, profile: profile, now: now)
         let currentTarget = boundTargetRange(computedBgTargets.targets[targetIdx])

+ 0 - 1
Trio/Sources/Localizations/Main/Localizable.xcstrings

@@ -10037,7 +10037,6 @@
       }
     },
     "%lld h" : {
-      "extractionState" : "stale",
       "localizations" : {
         "bg" : {
           "stringUnit" : {

+ 2 - 1
TrioTests/OpenAPSSwiftTests/AutosensJsonTests.swift

@@ -38,7 +38,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         if comparison.resultType == .valueDifference {

+ 4 - 2
TrioTests/OpenAPSSwiftTests/DetermineBasalJsonTests.swift

@@ -82,7 +82,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         if comparison.resultType == .valueDifference {
@@ -173,7 +174,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         if comparison.resultType == .valueDifference {

+ 4 - 2
TrioTests/OpenAPSSwiftTests/IobJsonTests.swift

@@ -134,7 +134,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         if comparison.resultType == .valueDifference {
@@ -173,7 +174,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         if comparison.resultType != .valueDifference {

+ 4 - 2
TrioTests/OpenAPSSwiftTests/MealJsonTests.swift

@@ -78,7 +78,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         if comparison.resultType == .valueDifference {
@@ -155,7 +156,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         #expect(comparison.resultType == .matching)

+ 3 - 3
TrioTests/OpenAPSSwiftTests/ProfileBasalTests.swift

@@ -40,7 +40,7 @@ import Testing
     }
 
     @Test("should return nil with an empty profile") func handleEmptyProfile() async throws {
-        let rate = try Basal.basalLookup([])
+        let rate = try Basal.basalLookup([], now: Date())
         #expect(rate == nil)
     }
 
@@ -49,7 +49,7 @@ import Testing
             BasalProfileEntry(start: "00:00", minutes: 0, rate: 1.0)
         ]
 
-        let rate = try Basal.basalLookup(basalProfile)
+        let rate = try Basal.basalLookup(basalProfile, now: Date())
         #expect(rate == 1.0)
     }
 
@@ -58,7 +58,7 @@ import Testing
             BasalProfileEntry(start: "00:00", minutes: 0, rate: 0.0)
         ]
 
-        let rate = try Basal.basalLookup(basalProfile)
+        let rate = try Basal.basalLookup(basalProfile, now: Date())
         #expect(rate == nil)
     }
 

+ 1 - 1
TrioTests/OpenAPSSwiftTests/ProfileCarbsTests.swift

@@ -31,7 +31,7 @@ import Testing
                 CarbRatioEntry(start: "00:00:00", offset: 0, ratio: 12)
             ]
         )
-        let ratio = Carbs.carbRatioLookup(carbRatio: exchangeSchedule)
+        let ratio = Carbs.carbRatioLookup(carbRatio: exchangeSchedule, now: Date())
         #expect(ratio == 1) // 12 grams per exchange
     }
 

+ 1 - 1
TrioTests/OpenAPSSwiftTests/ProfileIsfTests.swift

@@ -56,7 +56,7 @@ import Testing
                 InsulinSensitivityEntry(sensitivity: 100, offset: 30, start: "00:30:00")
             ]
         )
-        let (sensitivity, _) = try Isf.isfLookup(isfDataInput: invalidISF)
+        let (sensitivity, _) = try Isf.isfLookup(isfDataInput: invalidISF, timestamp: Date())
         #expect(sensitivity == -1)
     }
 }

+ 12 - 10
TrioTests/OpenAPSSwiftTests/ProfileJavascriptTests.swift

@@ -69,7 +69,7 @@ struct ProfileGeneratorTests {
             carbRatios: inputs.5,
             tempTargets: inputs.6,
             model: inputs.7,
-            trioSettings: inputs.8
+            clock: Date()
         )
 
         #expect(profile.maxIob == 0)
@@ -112,7 +112,7 @@ struct ProfileGeneratorTests {
             carbRatios: inputs.5,
             tempTargets: inputs.6,
             model: inputs.7,
-            trioSettings: inputs.8
+            clock: currentTime
         )
 
         #expect(profile.maxIob == 0)
@@ -156,7 +156,7 @@ struct ProfileGeneratorTests {
             carbRatios: inputs.5,
             tempTargets: inputs.6,
             model: inputs.7,
-            trioSettings: inputs.8
+            clock: currentTime
         )
 
         #expect(profile.maxIob == 0)
@@ -199,7 +199,7 @@ struct ProfileGeneratorTests {
             carbRatios: inputs.5,
             tempTargets: inputs.6,
             model: inputs.7,
-            trioSettings: inputs.8
+            clock: currentTime
         )
 
         #expect(profile.maxIob == 0)
@@ -229,7 +229,7 @@ struct ProfileGeneratorTests {
                 carbRatios: inputs.5,
                 tempTargets: inputs.6,
                 model: inputs.7,
-                trioSettings: inputs.8
+                clock: Date()
             )
         }
     }
@@ -252,7 +252,7 @@ struct ProfileGeneratorTests {
                 carbRatios: inputs.5,
                 tempTargets: inputs.6,
                 model: inputs.7,
-                trioSettings: inputs.8
+                clock: Date()
             )
         }
     }
@@ -270,7 +270,7 @@ struct ProfileGeneratorTests {
             carbRatios: inputs.5,
             tempTargets: inputs.6,
             model: inputs.7,
-            trioSettings: inputs.8
+            clock: Date()
         )
 
         #expect(profile.model == "554")
@@ -309,7 +309,7 @@ struct ProfileGeneratorTests {
             trioSettings: inputs.8
         )
 
-        let swiftResult = OpenAPSSwift.makeProfile(
+        let (swiftResult, makeProfileInputs) = OpenAPSSwift.makeProfile(
             preferences: inputs.4,
             pumpSettings: inputs.0,
             bgTargets: inputs.1,
@@ -318,7 +318,8 @@ struct ProfileGeneratorTests {
             carbRatio: inputs.5,
             tempTargets: tempTargets,
             model: inputs.7,
-            trioSettings: inputs.8
+            trioSettings: inputs.8,
+            clock: now
         )
 
         let comparison = JSONCompare.createComparison(
@@ -330,7 +331,8 @@ struct ProfileGeneratorTests {
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: makeProfileInputs
         )
 
         if comparison.resultType == .valueDifference {

+ 17 - 9
TrioTests/OpenAPSSwiftTests/ProfileJsNativeCompareTests.swift

@@ -77,7 +77,7 @@ import Testing
             trioSettings: inputs.8
         )
 
-        let profileSwift = OpenAPSSwift.makeProfile(
+        let (profileSwift, _) = OpenAPSSwift.makeProfile(
             preferences: inputs.0,
             pumpSettings: inputs.1,
             bgTargets: inputs.2,
@@ -86,7 +86,8 @@ import Testing
             carbRatio: inputs.5,
             tempTargets: inputs.6,
             model: inputs.7,
-            trioSettings: inputs.8
+            trioSettings: inputs.8,
+            clock: Date()
         )
 
         let comparison = JSONCompare.createComparison(
@@ -98,7 +99,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         #expect(comparison.resultType == .matching)
@@ -131,7 +133,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         #expect(comparison.resultType == .matching)
@@ -153,7 +156,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         #expect(comparison.resultType == .valueDifference)
@@ -177,7 +181,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         #expect(comparison.resultType == .matchingExceptions)
@@ -198,7 +203,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         #expect(comparison.resultType == .swiftOnlyException)
@@ -221,7 +227,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         #expect(comparison.resultType == .jsOnlyException)
@@ -243,7 +250,8 @@ import Testing
             iobInputs: nil,
             mealInputs: nil,
             autosensInputs: nil,
-            determineBasalInputs: nil
+            determineBasalInputs: nil,
+            makeProfileInputs: nil
         )
 
         #expect(comparison.resultType == .comparisonError)

+ 1 - 1
TrioTests/OpenAPSSwiftTests/ProfileTargetsTests.swift

@@ -95,7 +95,7 @@ import Testing
                 BGTargetEntry(low: 40, high: 250, start: "00:00:00", offset: 0)
             ]
         )
-        let (_, result) = try Targets.bgTargetsLookup(targets: extremeTargets, tempTargets: [], profile: profile)
+        let (_, result) = try Targets.bgTargetsLookup(targets: extremeTargets, tempTargets: [], profile: profile, now: Date())
         #expect(result.maxBg == 80)
         #expect(result.minBg == 80)
     }