nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: javalin/javalin
Pull request #2250 (2024-05-16 15:54:26)

[javalin-4x][context] Handle invalid urlencoding in bodies
Bodies may exist but not contain valid form params for some requests, and we should handle trying to read params from those requests gracefully.

"backport" of https://github.com/javalin/javalin/pull/2245 for javalin 4x.

tipsy: I think you probably want to target 5x @norrs 😄 

Patch:
diff --git a/javalin/src/main/java/io/javalin/http/util/ContextUtil.kt b/javalin/src/main/java/io/javalin/http/util/ContextUtil.kt
index 01acf471..e85e960a 100644
--- a/javalin/src/main/java/io/javalin/http/util/ContextUtil.kt
+++ b/javalin/src/main/java/io/javalin/http/util/ContextUtil.kt
@@ -40,10 +40,15 @@ object ContextUtil {
     }
 
     fun splitKeyValueStringAndGroupByKey(string: String, charset: String): Map<String, List<String>> {
-        return if (string.isEmpty()) mapOf() else string.split("&").map { it.split("=", limit = 2) }.groupBy(
-            { URLDecoder.decode(it[0], charset) },
-            { if (it.size > 1) URLDecoder.decode(it[1], charset) else "" }
-        ).mapValues { it.value.toList() }
+        return try {
+            if (string.isEmpty()) mapOf() else string.split("&").map { it.split("=", limit = 2) }.groupBy(
+                { URLDecoder.decode(it[0], charset) },
+                { if (it.size > 1) URLDecoder.decode(it[1], charset) else "" }
+            ).mapValues { it.value.toList() }
+        } catch(e: IllegalArgumentException) {
+            // Presumably the body had invalid URL encoding and isn't really a key-value string
+            mapOf()
+        }
     }
 
     fun pathParamOrThrow(pathParams: Map<String, String?>, key: String, url: String) =


Test patch:
diff --git a/javalin/src/test/java/io/javalin/TestBodyReading.kt b/javalin/src/test/java/io/javalin/TestBodyReading.kt
index c2550386..39e562d8 100644
--- a/javalin/src/test/java/io/javalin/TestBodyReading.kt
+++ b/javalin/src/test/java/io/javalin/TestBodyReading.kt
@@ -56,6 +56,13 @@ class TestBodyReading {
         assertThat(response.body).isEqualTo("♚♛♜♜♝♝♞♞♟♟♟♟♟♟♟♟")
     }
 
+    @Test
+    fun `reading invalid form-params without contentType works`() = TestUtil.test { app, http ->
+        app.post("/") { it.result((it.formParam("fp") == null).toString()) }
+        val response = http.post("/").body("fp=%+").asString()
+        assertThat(response.body).isEqualTo("true")
+    }
+
     @Test // not sure why this does so much...
     fun `query-params and form-params behave the same`() = TestUtil.test { app, http ->
         app.post("/") { ctx ->
Repository: GradleUp/shadow
Pull request #1178 (2025-01-23 10:32:28)

Note using `Log4j2PluginsCacheFileTransformer` in doc
- Follow up #1175.
- Refs https://github.com/apache/logging-log4j-transform/issues/73#issuecomment-2609408107.


Patch:
diff --git a/src/docs/configuration/merging/README.md b/src/docs/configuration/merging/README.md
index 5c224fa9..b801f078 100644
--- a/src/docs/configuration/merging/README.md
+++ b/src/docs/configuration/merging/README.md
@@ -176,6 +176,18 @@ tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.Shadow
 }
 ```
 
+## Merging Log4j2 Plugin Cache Files (`Log4j2Plugins.dat`)
+
+`Log4j2PluginsCacheFileTransformer` is a `Transformer` that merges `META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat` plugin caches from all the jars
+containing Log4j 2.x Core components. It's a Gradle equivalent of [Log4j Plugin Descriptor Transformer](https://logging.apache.org/log4j/transform/log4j-transform-maven-shade-plugin-extensions.html#log4j-plugin-cache-transformer).
+
+```groovy
+// Merging Log4j2 Plugin Cache Files
+tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
+  transform(com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer.class)
+}
+```
+
 ## Appending Text Files
 
 Generic text files can be appended together using the


Test patch:
diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/JavaPluginTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/JavaPluginTest.kt
index bd012d4b..001ff582 100644
--- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/JavaPluginTest.kt
+++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/JavaPluginTest.kt
@@ -197,6 +197,10 @@ class JavaPluginTest : BasePluginTest() {
     }
   }
 
+  @Issue(
+    "https://github.com/GradleUp/shadow/issues/352",
+    "https://github.com/GradleUp/shadow/issues/729",
+  )
   @Test
   fun excludeSomeMetaInfFilesByDefault() {
     localRepo.module("shadow", "a", "1.0") {
diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/TransformersTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/TransformersTest.kt
index 5cf04f94..48bf68db 100644
--- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/TransformersTest.kt
+++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/TransformersTest.kt
@@ -53,7 +53,9 @@ class TransformersTest : BaseTransformerTest() {
     commonAssertions()
   }
 
-  @Issue("https://github.com/GradleUp/shadow/issues/82")
+  @Issue(
+    "https://github.com/GradleUp/shadow/issues/82",
+  )
   @Test
   fun shadowManifestLeaksToJarManifest() {
     writeMainClass()
Repository: GradleUp/shadow
Pull request #946 (2024-08-27 01:27:27)

Constraint foojay-resolver version


Patch:
diff --git a/build.gradle.kts b/build.gradle.kts
index ff1cb6d9..d2f458f9 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -103,6 +103,8 @@ testing.suites {
       implementation(libs.apache.maven.modelBuilder)
       implementation(libs.moshi)
       implementation(libs.moshi.kotlin)
+      // Used in test `plugins` blocks.
+      implementation(libs.foojayResolver)
     }
   }
 
@@ -126,6 +128,16 @@ gradlePlugin {
   )
 }
 
+tasks.pluginUnderTestMetadata {
+  val functionalTestImplementation = configurations.named("functionalTestImplementation") {
+    isCanBeResolved = true
+  }
+  // Plugins used in tests could be resolved in classpath.
+  pluginClasspath.from(
+    functionalTestImplementation,
+  )
+}
+
 tasks.check {
   dependsOn(
     testing.suites.named("integrationTest"),
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index c4b8bdbf..c30811fc 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -14,6 +14,7 @@ plexus-xml = "org.codehaus.plexus:plexus-xml:4.0.4"
 xmlunit = "org.xmlunit:xmlunit-legacy:2.10.0"
 moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
 moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshi" }
+foojayResolver = "org.gradle.toolchains.foojay-resolver-convention:org.gradle.toolchains.foojay-resolver-convention.gradle.plugin:0.9.0"
 
 pluginPublish = "com.gradle.publish:plugin-publish-plugin:1.3.0"
 mavenPublish = "com.vanniktech:gradle-maven-publish-plugin:0.30.0"
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 774c947d..4bb3ca1a 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -38,6 +38,7 @@ dependencyResolutionManagement {
         includeGroupAndSubgroups("com.google")
       }
     }
+    gradlePluginPortal()
   }
 }
 


Test patch:
diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationPluginTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationPluginTest.kt
index 720df401..d5f7fdba 100644
--- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationPluginTest.kt
+++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationPluginTest.kt
@@ -31,7 +31,7 @@ class ApplicationPluginTest : BasePluginTest() {
       """.trimIndent(),
       settingsBlock = """
         plugins {
-          id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
+          id 'org.gradle.toolchains.foojay-resolver-convention'
         }
       """.trimIndent(),
       runShadowBlock = """
Repository: typesafegithub/github-workflows-kt
Pull request #1006 (2023-10-05 06:23:48)

test(library): add first simple architecture test


Patch:
diff --git a/library/build.gradle.kts b/library/build.gradle.kts
index adb81d58d..842d8463a 100644
--- a/library/build.gradle.kts
+++ b/library/build.gradle.kts
@@ -24,6 +24,7 @@ dependencies {
 
     testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")
     testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.5.0")
+    testImplementation("com.lemonappdev:konsist:0.12.2")
     testImplementation(kotlin("reflect"))
 }
 


Test patch:
diff --git a/library/src/test/kotlin/io/github/typesafegithub/workflows/ArchitectureTest.kt b/library/src/test/kotlin/io/github/typesafegithub/workflows/ArchitectureTest.kt
new file mode 100644
index 000000000..0f9d36172
--- /dev/null
+++ b/library/src/test/kotlin/io/github/typesafegithub/workflows/ArchitectureTest.kt
@@ -0,0 +1,18 @@
+package io.github.typesafegithub.workflows
+
+import com.lemonappdev.konsist.api.KoModifier
+import com.lemonappdev.konsist.api.Konsist
+import com.lemonappdev.konsist.api.ext.list.modifierprovider.withModifier
+import com.lemonappdev.konsist.api.ext.list.properties
+import com.lemonappdev.konsist.api.verify.assert
+import io.kotest.core.spec.style.FunSpec
+
+class ArchitectureTest : FunSpec({
+    test("all data classes use only immutable fields") {
+        Konsist.scopeFromProduction()
+            .classes()
+            .withModifier(KoModifier.DATA)
+            .properties(includeNested = true, includeLocal = true)
+            .assert { it.hasValModifier }
+    }
+})
Repository: typesafegithub/github-workflows-kt
Pull request #1064 (2023-10-29 20:47:07)

[#941] fix(abg): support steps not only with 'uses' fields
Other kinds of steps, e.g. with `run`, have to be parseable as well.



Patch:
diff --git a/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/GitHubWorkflowModel.kt b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/GitHubWorkflowModel.kt
index 858d4f51c..a33f9a134 100644
--- a/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/GitHubWorkflowModel.kt
+++ b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/GitHubWorkflowModel.kt
@@ -14,5 +14,5 @@ internal data class Job(
 
 @Serializable
 internal data class Step(
-    val uses: String?,
+    val uses: String? = null,
 )


Test patch:
diff --git a/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/ExtractUsedActionsFromWorkflowTest.kt b/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/ExtractUsedActionsFromWorkflowTest.kt
index 8d791be80..e111d186b 100644
--- a/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/ExtractUsedActionsFromWorkflowTest.kt
+++ b/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/ExtractUsedActionsFromWorkflowTest.kt
@@ -4,7 +4,7 @@ import io.kotest.core.spec.style.FunSpec
 import io.kotest.matchers.shouldBe
 
 class ExtractUsedActionsFromWorkflowTest : FunSpec({
-    test("parses valid manifest") {
+    test("parses valid manifest just with 'uses' steps") {
         // Given
         val manifest =
             """
@@ -33,9 +33,34 @@ class ExtractUsedActionsFromWorkflowTest : FunSpec({
             )
     }
 
-    // TODO nested actions, i.e. where names have some "/"
+    test("workflow with not only with 'uses' steps") {
+        // Given
+        val manifest =
+            """
+            on:
+              push:
+
+            jobs:
+              some-job:
+                runs-on: ubuntu-latest
+                steps:
+                  - uses: actions/checkout@v3
+                  - run: echo "Hello world!"
+                  - uses: actions/setup-java@main
+            """.trimIndent()
+
+        // When
+        val actionCoords = extractUsedActionsFromWorkflow(manifest)
 
-    // TODO: steps that don't have "uses"
+        // Then
+        actionCoords shouldBe
+            listOf(
+                ActionCoords(owner = "actions", name = "checkout", version = "v3"),
+                ActionCoords(owner = "actions", name = "setup-java", version = "main"),
+            )
+    }
+
+    // TODO nested actions, i.e. where names have some "/"
 
     // TODO: steps using other kinds of actions, like Docker-based or local ones
Repository: typesafegithub/github-workflows-kt
Pull request #1081 (2023-11-06 09:17:24)

chore(lib): switch from com.github.tschuchortdev:kotlin-compile-testing to dev.zacsweers.kctfork
It's an updated fork of com.github.tschuchortdev:kotlin-compile-testing. Most importantly, it supports newer versions of Kotlin.

Needed as a prerequisite for #1066.


Patch:
diff --git a/library/build.gradle.kts b/library/build.gradle.kts
index 86b79c427..e6597c9d9 100644
--- a/library/build.gradle.kts
+++ b/library/build.gradle.kts
@@ -23,8 +23,10 @@ dependencies {
     implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.0")
 
     testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")
-    testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.5.0")
+    testImplementation("dev.zacsweers.kctfork:core:0.4.0")
     testImplementation("com.lemonappdev:konsist:0.13.0")
+    // Needed to use the right version of the compiler for the libraries that depend on it.
+    testImplementation(kotlin("compiler"))
     testImplementation(kotlin("reflect"))
 }
 


Test patch:
diff --git a/library/src/test/kotlin/io/github/typesafegithub/workflows/NonCompilableTest.kt b/library/src/test/kotlin/io/github/typesafegithub/workflows/NonCompilableTest.kt
index a1def4641..8f0c2e3a0 100644
--- a/library/src/test/kotlin/io/github/typesafegithub/workflows/NonCompilableTest.kt
+++ b/library/src/test/kotlin/io/github/typesafegithub/workflows/NonCompilableTest.kt
@@ -1,5 +1,8 @@
+@file:OptIn(ExperimentalCompilerApi::class)
+
 package io.github.typesafegithub.workflows
 
+import com.tschuchort.compiletesting.JvmCompilationResult
 import com.tschuchort.compiletesting.KotlinCompilation
 import com.tschuchort.compiletesting.KotlinCompilation.ExitCode.COMPILATION_ERROR
 import com.tschuchort.compiletesting.SourceFile
@@ -7,6 +10,7 @@ import io.kotest.core.spec.style.FunSpec
 import io.kotest.matchers.shouldBe
 import io.kotest.matchers.string.shouldContain
 import org.intellij.lang.annotations.Language
+import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
 
 class NonCompilableTest : FunSpec({
     test("job nested inside a job") {
@@ -85,7 +89,7 @@ class NonCompilableTest : FunSpec({
 
 private fun compile(
     @Language("kotlin") code: String,
-): KotlinCompilation.Result =
+): JvmCompilationResult =
     KotlinCompilation().apply {
         sources =
             listOf(
Repository: typesafegithub/github-workflows-kt
Pull request #1086 (2023-11-09 09:24:54)

[#1071] fix(abg): fix false error in extracting used actions
Multiple usages of the same action in the same version were mistakenly
interpreted as more than one version used.


Patch:
diff --git a/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/ExtractUsedActionsFromWorkflow.kt b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/ExtractUsedActionsFromWorkflow.kt
index 88e4acdcf..3522ef759 100644
--- a/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/ExtractUsedActionsFromWorkflow.kt
+++ b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/ExtractUsedActionsFromWorkflow.kt
@@ -27,8 +27,8 @@ private fun parseWorkflow(manifest: String) =
 private fun assertSingleVersionForEachAction(actionCoords: List<ActionCoords>) {
     val actionsWithMultipleVersions =
         actionCoords
-            .groupingBy { "${it.owner}/${it.name}" }
-            .eachCount()
+            .groupBy { "${it.owner}/${it.name}" }
+            .mapValues { it.value.toSet().size }
             .filterValues { it > 1 }
             .keys
     if (actionsWithMultipleVersions.isNotEmpty()) {


Test patch:
diff --git a/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/ExtractUsedActionsFromWorkflowTest.kt b/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/ExtractUsedActionsFromWorkflowTest.kt
index afb2de37f..7421d0870 100644
--- a/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/ExtractUsedActionsFromWorkflowTest.kt
+++ b/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/ExtractUsedActionsFromWorkflowTest.kt
@@ -104,6 +104,10 @@ class ExtractUsedActionsFromWorkflowTest : FunSpec({
                   - uses: actions/checkout@v3
                   - uses: actions/setup-java@v4
                   - uses: actions/checkout@v5
+              another-job:
+                runs-on: ubuntu-latest
+                steps:
+                  - uses: actions/setup-java@v4
             """.trimIndent()
 
         // Then