Use typed SSD truth filename checks
ober
88cca454678eb2b2b620693c877c575f1681bde2
--- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -5314,7 +5314,7 @@ safeTreePathParts treePathLeaf treePathDirectoryParts safeImportLeafEntryName zipEntryRootName zipEntryLeafName zipEntryRootKind - jsonLinesFileName) + jsonLinesFileName truthJsonFileName) (type Int32) (type Char) (extern (stringSplitChar (text : String) @@ -5332,6 +5332,8 @@ (string-ends-with? name ".jsonl")))) (def (jsonLinesFileName (name : String)) : Bool (string-ends-with? name ".jsonl")) + (def (truthJsonFileName (name : String)) : Bool + (string-ends-with? name ".truth.json")) (def (treeFileMime (name : String)) : String (if (string-ends-with? name ".json") "application/json" @@ -7912,7 +7914,7 @@ " @Synchronized" " private fun truthIndexEntries(): List<TruthIndexEntry> {" " truthIndexCache?.let { return it }" - " val entries = groundTruthDir.listFiles { f -> f.name.endsWith(\".truth.json\") }" + " val entries = groundTruthDir.listFiles { f -> truthJsonFileName(f.name) }" " ?.sortedBy { it.name }" " ?.mapNotNull { truthIndexEntry(it) }" " ?: emptyList()" @@ -8460,7 +8462,7 @@ " }" "" " fun storageSummary(): String {" - " val truthCount = groundTruthDir.listFiles { f -> f.name.endsWith(\".truth.json\") }?.size ?: 0" + " val truthCount = groundTruthDir.listFiles { f -> truthJsonFileName(f.name) }?.size ?: 0" " val eventCount = eventsDir.listFiles()?.size ?: 0" " return storageSummaryText(truthCount, eventCount)" " }" @@ -8476,7 +8478,7 @@ "" " private fun rebuildLearnedExamples() {" " val examples = learnedExamplesEmpty()" - " val files = groundTruthDir.listFiles { f -> f.name.endsWith(\".truth.json\") }" + " val files = groundTruthDir.listFiles { f -> truthJsonFileName(f.name) }" " ?.sortedWith(compareByDescending<File> { it.lastModified() }.thenBy { it.name })" " ?: emptyList()" " fileLoop@ for (file in files) {"