Skip to content

Commit b614341

Browse files
wow-mileyclaude
andauthored
Fix HybridQueryRanker commonMain compile for v0.5.0 publish (#479)
`MutableMap.putIfAbsent` is JVM-only and breaks `:ampere-core:compileCommonMainKotlinMetadata`, which is what the publish.yml workflow runs on tag push. The regular PR CI doesn't run that task, so the issue slipped through when AMPR-156 (#476) merged and only surfaced when the v0.5.0 tag triggered the publish workflow. Swap to `getOrPut`, which is in commonMain and has the same effect (insert if absent, leave existing alone) when the return value is discarded inside `forEach`. Verified with `./gradlew :ampere-core:compileCommonMainKotlinMetadata` and the existing HybridQueryRankerTest. Commit authored by Claude Opus 4.7 on Miley's behalf. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f33f977 commit b614341

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ampere-core/src/commonMain/kotlin/link/socket/ampere/knowledge/HybridQueryRanker.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class HybridQueryRanker(
6161
// semantic hit so its enrichment wins ties (semantic queries usually
6262
// walk the document table; keyword search may not).
6363
val canonicalById = mutableMapOf<String, KnowledgeQueryResult>()
64-
keywordResults.forEach { canonicalById.putIfAbsent(it.chunk.id, it) }
64+
keywordResults.forEach { canonicalById.getOrPut(it.chunk.id) { it } }
6565
semanticResults.forEach { canonicalById[it.chunk.id] = it }
6666

6767
return canonicalById.values

0 commit comments

Comments
 (0)