Generate SSD session truth loading from typed Jerboa

ober

31a370bd35296dded94cc6e7e16714fc6883cefe

diff --git a/templates/ssd-review.ss b/templates/ssd-review.ss
index bb07dcb..ec804bb 100644
--- a/templates/ssd-review.ss
+++ b/templates/ssd-review.ss
@@ -15593,6 +15593,7 @@
                 truthStoreInvalidateTruthIndexLocal
                 truthStoreTruthIndexEntriesLocal
                 truthStoreTruthIndexEntryLocal
+                truthStoreLoadTruthForSessionLocal
                 truthStoreExportZipLocal
                 truthStoreImportZipLocal
                 truthStoreExportToTreeLocal
@@ -15754,6 +15755,9 @@
         (extern (truthStoreStagedZipEntryFile
                   (entry : StagedZipEntry)) : File
           (kotlin-member-get _file))
+        (extern (truthStoreTruthIndexEntryFile
+                  (entry : TruthIndexEntry)) : File
+          (kotlin-member-get _file))
         (extern (truthStoreLimitedInputStreamCount
                   (input : LimitedInputStream)) : Int
           (kotlin-member-get count))
@@ -16556,6 +16560,25 @@
                 (truthStoreTruthIndexCacheSet store entries)
                 (truthStoreTruthIndexCacheLoadedSet store #t)
                 entries))))
+        (def (truthStoreLoadTruthForSessionLocal
+               (store : TruthStore)
+               (session : SsdSession)) : (Nullable JSONObject)
+          (let ((best
+                  (bestTruthIndexForSession
+                    (truthStoreTruthIndexEntriesLocal store)
+                    (truthStoreTruthIndexEntryLocal
+                      store
+                      (truthStoreTruthPath
+                        store
+                        (SsdSession-sourceKey session)))
+                    session)))
+            (if (truthIndexEntryPresent best)
+              (nullable-some
+                (jsonObjectFromText
+                  (truthStoreReadLocalText
+                    (truthStoreTruthIndexEntryFile
+                      (nullable-get best)))))
+              (nullable-none JSONObject))))
         (def (truthStoreCopyInputToZipOutput
                (input : InputStream)
                (zip : ZipOutputStream)
@@ -17929,15 +17952,8 @@
        "    fun loadTruth(sourceKey: String): JSONObject? ="
        "        truthStoreLoadTruth(this, sourceKey)"
        ""
-       "    fun loadTruth(session: SsdSession): JSONObject? {"
-       "        val best = bestTruthIndexForSession("
-       "            truthIndexEntries(),"
-       "            truthIndexEntry(truthPath(session.sourceKey)),"
-       "            session"
-       "        )"
-       "        if (!truthIndexEntryPresent(best)) return null"
-       "        return jsonObjectFromText(readLocalText(checkNotNull(best)._file))"
-       "    }"
+       "    fun loadTruth(session: SsdSession): JSONObject? ="
+       "        truthStoreLoadTruthForSessionLocal(this, session)"
        ""
        "    @Synchronized"
        "    internal fun invalidateTruthIndex() ="