feedback-to-code/mozzarella huggingface dataset:
Repository: kestra-io/kestra
Issue: For Each Item Partition inferior to number of items create more executions than expected
Labels: bug

### Describe the issue

According to the documentation, the partition props should `Split a file into a fixed number of partitioned files.`. What about when this number is superior to the number of lines in the file?
It seems that the number of subflow executions is always that number whatever the file inputed.

Reproducer (inputs with a file of 3 lines will create 1000 executions):

```yaml
id: for-each-item
namespace: io.kestra.tests

inputs:
  - name: file
    type: FILE

tasks:
  - id: each
    type: io.kestra.core.tasks.flows.ForEachItem
    items: "{{ inputs.file }}"
    batch:
      partitions: 1000
    namespace: io.kestra.tests
    flowId: for-each-item-subflow
    wait: true
    transmitFailed: true
    inputs:
      items: "{{ taskrun.items }}"
```
![image](https://github.com/kestra-io/kestra/assets/46634684/6f584146-8e5d-4b89-9689-27e3ee9d6891)

![image](https://github.com/kestra-io/kestra/assets/46634684/bdb7d3c9-b61c-4c93-95d3-3f5593fbb6e6)




### Environment

- Kestra Version:
- Operating System (OS/Docker/Kubernetes):
- Java Version (if you don't run kestra in Docker):


Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/core/src/main/java/io/kestra/core/services/StorageService.java b/core/src/main/java/io/kestra/core/services/StorageService.java
index 6ce7453eb0..f4616e8f06 100644
--- a/core/src/main/java/io/kestra/core/services/StorageService.java
+++ b/core/src/main/java/io/kestra/core/services/StorageService.java
@@ -107,7 +107,7 @@ private static List<Path> partition(RunContext runContext, String extension, Str
 
         writers.forEach(throwConsumer(RandomAccessFile::close));
 
-        return files;
+        return files.stream().filter(p -> p.toFile().length() > 0).toList();
     }
 
 }


Test patch:
Repository: kestra-io/kestra
Issue: Changing the base path of Kestra (context-path) does not work
Labels: bug

### Explain the bug

According to the [documentation](https://kestra.io/docs/administrator-guide/configuration/micronaut#changing-base-path), it should be possible to change the context path of Kestra.
However, when I try it, the application loader keeps spinning and the page never loads.

How to reproduce:

1. Start Kestra as usual, specifying the `context-path` either in config.yml or as a JVM parameter:

`JAVA_OPTS=-Dmicronaut.server.context-path=/kestra ./kestra-0.13.4 server local`

2. Go to `http://localhost:8080/kestra`

3. See the loader spinning forever and some failed HTTP calls in the web console:

<img width="891" alt="image" src="https://github.com/kestra-io/kestra/assets/459215/78014ea0-f266-4f3d-8a57-f91ea1e05a54">


In particular, `http://localhost:8080/kestra/kestra/api/v1/configs` looks wrong, since the context path is repeated.


### Environment Information

- Kestra Version: 0.13.4
- Operating System and Java Version (if not using Kestra Docker image): Linux or macOS, JDK 17


Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/utils/axios.js b/ui/src/utils/axios.js
index 227e84bb37..4be5ac7fc3 100644
--- a/ui/src/utils/axios.js
+++ b/ui/src/utils/axios.js
@@ -1,6 +1,5 @@
 import axios from "axios";
 import NProgress from "nprogress"
-import {baseUrl} from "override/utils/route";
 
 // nprogress
 let requestsTotal = 0
@@ -136,7 +135,6 @@ export default (callback, store, router) => {
             return Promise.reject(errorResponse);
         })
 
-    instance.defaults.baseURL = baseUrl;
 
     instance.defaults.paramsSerializer = {
         indexes: null


Test patch:
Repository: kestra-io/kestra
Issue: Moving from absolute to relative date filter should remove the absolute filter and use the default relative filter
Labels: bug
frontend

### Describe the issue

Going on any page with date filter (executions, logs), if you select an absolute date then move to relative date filtering, even though visually it looks like it selects something (like last 30 days), it keeps the old absolute date filter till you swap out the selected relative filter.

We also see in query params that it kept the old filter

![image](https://github.com/kestra-io/kestra/assets/37618489/65f42b7d-4fe4-4ad8-a272-d7b6d13e2ce6)

### Environment

- Kestra Version: 0.15.7
- Operating System (OS/Docker/Kubernetes):
- Java Version (if you don't run kestra in Docker):


Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/components/executions/date-select/DateFilter.vue b/ui/src/components/executions/date-select/DateFilter.vue
index e2946506dd..dcc99f1d86 100644
--- a/ui/src/components/executions/date-select/DateFilter.vue
+++ b/ui/src/components/executions/date-select/DateFilter.vue
@@ -65,7 +65,11 @@
         },
         methods: {
             onSelectedFilterType() {
-                this.$emit("update:isRelative", this.selectedFilterType === this.filterType.RELATIVE);
+                const relativeFilterSelected = this.selectedFilterType === this.filterType.RELATIVE;
+
+                this.$emit("update:isRelative", relativeFilterSelected);
+
+                this.tryOverrideAbsFilter(relativeFilterSelected);
             },
             onAbsFilterChange(event) {
                 const filter = {
@@ -85,6 +89,12 @@
             },
             updateFilter(filter) {
                 this.$emit("update:filterValue", filter);
+            },
+            tryOverrideAbsFilter(relativeFilterSelected) {
+                if (relativeFilterSelected && (this.$route.query.startDate || this.$route.query.endDate)) {
+                    const forcedDefaultRelativeFilter = {timeRange: undefined};
+                    this.onRelFilterChange(forcedDefaultRelativeFilter);
+                }
             }
         }
     }


Test patch:
Repository: kestra-io/kestra
Issue: Highlight the selected Saved Search Filter
Labels: enhancement
frontend
quick-win

### Feature description

perhaps purple? 

usually the elements that are currently selected are purple 
![image](https://github.com/kestra-io/kestra/assets/86264395/81832f34-4a0c-4c15-a868-16a1c1b02ec0)


![image](https://github.com/kestra-io/kestra/assets/86264395/abb7bf60-151c-4948-9b62-32a038e40d53)


Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/components/saved-filters/Filters.vue b/ui/src/components/saved-filters/Filters.vue
index 124e2e7c4c..232b08d04d 100644
--- a/ui/src/components/saved-filters/Filters.vue
+++ b/ui/src/components/saved-filters/Filters.vue
@@ -1,12 +1,12 @@
 <template>
     <!-- No filter yet -->
     <el-button v-if="!hasSavedFilters" :icon="ContentSave" @click="toggleDrawer()">
-        Filters
+        {{ $t("search filters.filters") }}
     </el-button>
     <!-- Existing filters -->
-    <el-dropdown v-else button type="default">
+    <el-dropdown v-else button type="default" popper-class="disabled-means-selected">
         <el-button class="dropdown-button" :icon="ContentSave" @click="toggleDrawer()">
-            Filters
+            {{ $t("search filters.filters") }}
         </el-button>
         <template #dropdown>
             <el-dropdown-menu>
@@ -166,7 +166,15 @@
         }
     }
 </script>
-<style>
+
+<style lang="scss">
     .dropdown-button {
-        width: 100%}
+        width: 100%;
+    }
+
+    .disabled-means-selected {
+        li.is-disabled {
+            color: var(--bs-primary);
+        }
+    }
 </style>
\ No newline at end of file
diff --git a/ui/src/translations/en.json b/ui/src/translations/en.json
index 998cf372f2..698cff3ebe 100644
--- a/ui/src/translations/en.json
+++ b/ui/src/translations/en.json
@@ -109,7 +109,8 @@
       "manage": "Manage search filters",
       "manage desc": "Manage saved search filters",
       "save filter": "Save filter",
-      "filter name": "Filter name"
+      "filter name": "Filter name",
+      "filters": "Filters"
     },
     "steps": "Steps",
     "state": "State",


Test patch:
Repository: kestra-io/kestra
Issue: Consider moving to Postgres 16 or suppressing the warning from JooQ
Labels: quick-win
technical-issue

### Feature description

![image](https://github.com/kestra-io/kestra/assets/86264395/0a1c76d8-b78f-4122-b912-8b4fd9be904a)


Issue comments:
We use the latest tag in our Docker compose which should be Postgres 16.
We use Bitnami in our Helm Chart wich should update frequently, currently it also provide Postgres 16.

So the issue is not at our side but the customer that uses an old version of Postgres, there is nothing we can do except hiding this log if really needed (but I think it's helpful).
hide the warning to avoid user confusion

Pull request review comments:

Patch that resolved the issue:
diff --git a/core/src/main/resources/logback/text.xml b/core/src/main/resources/logback/text.xml
index 94efdaee06..32ee92c27b 100644
--- a/core/src/main/resources/logback/text.xml
+++ b/core/src/main/resources/logback/text.xml
@@ -24,7 +24,14 @@
         </filter>
         <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
             <evaluator>
-                <expression>return message.contains("outOfOrder mode is active. Migration of schema");</expression>
+                <!--
+                    - Disabling Liquibase outOfOrder warning
+                    - Disabling JooQ POSTGRES version support warning, see https://github.com/kestra-io/kestra/issues/3321#issuecomment-2017665833
+                -->
+                <expression>
+                    return message.contains("outOfOrder mode is active. Migration of schema") ||
+                        message.contains("Database version is older than what dialect POSTGRES supports");
+                </expression>
             </evaluator>
             <OnMismatch>NEUTRAL</OnMismatch>
             <OnMatch>DENY</OnMatch>


Test patch:
Repository: kestra-io/kestra
Issue: Flow without trigger failed on triggers page 
Labels: bug
backend
quick-win

I 
- create a flow with a trigger 
- remove the trigger 
- it failed on the trigger page with that error: 

```
2024-03-18 23:15:41,520 ERROR io-executor-thread-7 i.k.w.controllers.ErrorController Cannot invoke "java.util.List.stream()" because the return value of "io.kestra.core.models.flows.Flow.getTriggers()" is null
java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "io.kestra.core.models.flows.Flow.getTriggers()" is null
	at io.kestra.webserver.controllers.TriggerController.lambda$search$1(TriggerController.java:93)
	at java.base/java.util.ArrayList.forEach(Unknown Source)
	at io.kestra.webserver.controllers.TriggerController.search(TriggerController.java:79)
	at io.kestra.ee.webserver.controllers.TriggerController.search(TriggerController.java:39)
	at io.kestra.ee.webserver.controllers.$TriggerController$Definition$Exec.dispatch(Unknown Source)
	at io.micronaut.context.AbstractExecutableMethodsDefinition$DispatchedExecutableMethod.invokeUnsafe(AbstractExecutableMethodsDefinition.java:461)
	at io.micronaut.context.DefaultBeanContext$BeanContextUnsafeExecutionHandle.invokeUnsafe(DefaultBeanContext.java:4274)
	at io.micronaut.web.router.AbstractRouteMatch.execute(AbstractRouteMatch.java:271)
	at io.micronaut.http.server.RouteExecutor.executeRouteAndConvertBody(RouteExecutor.java:488)
	at io.micronaut.http.server.RouteExecutor.lambda$callRoute$6(RouteExecutor.java:465)
	at io.micronaut.core.execution.ExecutionFlow.lambda$async$1(ExecutionFlow.java:87)
	at io.micronaut.core.propagation.PropagatedContext.lambda$wrap$3(PropagatedContext.java:211)
	at io.micrometer.core.instrument.composite.CompositeTimer.record(CompositeTimer.java:141)
	at io.micrometer.core.instrument.Timer.lambda$wrap$0(Timer.java:193)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
```

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/webserver/src/main/java/io/kestra/webserver/controllers/TriggerController.java b/webserver/src/main/java/io/kestra/webserver/controllers/TriggerController.java
index fc7b4933ea..31e64aa960 100644
--- a/webserver/src/main/java/io/kestra/webserver/controllers/TriggerController.java
+++ b/webserver/src/main/java/io/kestra/webserver/controllers/TriggerController.java
@@ -86,7 +86,12 @@ public PagedResults<Triggers> search(
                     .triggerContext(tc)
                     .build()
                 );
-                
+
+                return;
+            }
+
+            if (flow.get().getTriggers() == null) {
+                // a trigger was removed from the flow but still in the trigger table
                 return;
             }
 


Test patch:
Repository: kestra-io/kestra
Issue: Documentation on ui: add anchor on properties & outputs


Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/components/layout/Markdown.vue b/ui/src/components/layout/Markdown.vue
index db1fa22ed3..4fe92fb837 100644
--- a/ui/src/components/layout/Markdown.vue
+++ b/ui/src/components/layout/Markdown.vue
@@ -1,6 +1,6 @@
 <template>
     <div>
-        <span v-html="markdownRenderer"></span>
+        <span ref="doc" v-html="markdownRenderer"></span>
     </div>
 </template>
 
@@ -21,7 +21,31 @@
                 default: ``,
             },
         },
-
+        mounted() {
+            setTimeout(() => {
+                window.scrollTo({
+                    top: document.querySelector(location.hash).getBoundingClientRect().top + window.pageYOffset,
+                    behavior: 'smooth'
+                })
+            }, 1000)
+        },
+        methods: {
+            computeAnchors() {
+                let lastTitle = ''
+                for (const child of this.$refs.doc.children) {
+                    if (child.tagName === 'H2') {
+                        lastTitle = child.textContent.replaceAll('.', '-')
+                        child.setAttribute('id', lastTitle)
+                        child.innerHTML = `<a href="#${lastTitle}">${child.innerHTML}</a>`
+                    }
+                    if (child.tagName === 'H3') {
+                        const childId = `${lastTitle}-${child.textContent}`.replaceAll('.', '-')
+                        child.setAttribute('id', childId)
+                        child.innerHTML = `<a href="#${childId}">${child.innerHTML}</a>`
+                    }
+                }
+            }
+        },
         computed: {
             markdownRenderer() {
                 const outHtml = Markdown.render(this.source);
@@ -30,6 +54,7 @@
 
                 this.$nextTick(() => {
                     Prism.highlightAll();
+                    this.computeAnchors()
                 });
 
                 return outHtml;
@@ -38,3 +63,11 @@
 
     };
 </script>
+<style scoped>
+span /deep/ h3 a {
+    color:#e83e8c;
+}
+span /deep/ h2 a {
+    color:#222;
+}
+</style>


Test patch:
Repository: bazelbuild/bazel
Issue: `print` in a module appears to be different from `print` in a workspace rule
Labels: type: feature request
P3
team-ExternalDeps
area-Bzlmod

### Description of the problem / feature request:

`print` appears to behave differently between workspace rules and when used in a module.

When called from a workspace, the output of `print` is prefixed by a `DEBUG` statement, and then the path to the file, whereas this is missing when the same function is called from a module.

### What's the output of `bazel info release`?

5.0.0rc3

### Any other information, logs, or outputs that you want to share?

The way that `print` works when called from a workspace is nicer: it makes the output easy to identify and it's easy to grep for.

Issue comments:
@meteorcloudy 
/cc @Wyverald 
Yeah there's a bunch of quality-of-life changes we should make around the Starlark-running part of bzlmod before official launch.
This goes even further: If a module extension specifies incorrect attributes for a repository rule, an error is printed but the build doesn't fail.

Pull request review comments:

Patch that resolved the issue:
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/SingleExtensionEvalFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/SingleExtensionEvalFunction.java
index 889f85ef5f40ab..cd85ff18046bbb 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/SingleExtensionEvalFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/SingleExtensionEvalFunction.java
@@ -86,6 +86,7 @@ public void setRepositoryRemoteExecutor(RepositoryRemoteExecutor repositoryRemot
     this.repositoryRemoteExecutor = repositoryRemoteExecutor;
   }
 
+  @Nullable
   @Override
   public SkyValue compute(SkyKey skyKey, Environment env)
       throws SkyFunctionException, InterruptedException {
@@ -161,6 +162,7 @@ public SkyValue compute(SkyKey skyKey, Environment env)
     try (Mutability mu =
         Mutability.create("module extension", usagesValue.getExtensionUniqueName())) {
       StarlarkThread thread = new StarlarkThread(mu, starlarkSemantics);
+      thread.setPrintHandler(Event.makeDebugPrintHandler(env.getListener()));
       ModuleExtensionContext moduleContext =
           createContext(env, usagesValue, starlarkSemantics, extension);
       threadContext.storeInThread(thread);


Test patch:
Repository: bazelbuild/bazel
Issue: Reenable tests for gRPC UDS proxy
Labels: type: feature request
P2
team-Remote-Exec

https://cs.opensource.google/bazel/bazel/+/master:src/test/shell/bazel/remote/remote_execution_test.sh;l=161;drc=b303cd128d9f1d913749927f4a1cd942b10b1ae2
https://cs.opensource.google/bazel/bazel/+/master:src/test/shell/bazel/remote/remote_execution_test.sh;l=200;drc=b303cd128d9f1d913749927f4a1cd942b10b1ae2

They were disabled due to flakiness in 8e3c0df. As a consequence, we introduced an undetected regression in 5.3 (#16171).

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/src/main/java/com/google/devtools/build/lib/authandtls/credentialhelper/CredentialHelperProvider.java b/src/main/java/com/google/devtools/build/lib/authandtls/credentialhelper/CredentialHelperProvider.java
index ded7e5eab3c0d0..e13d1b40385a8b 100644
--- a/src/main/java/com/google/devtools/build/lib/authandtls/credentialhelper/CredentialHelperProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/authandtls/credentialhelper/CredentialHelperProvider.java
@@ -16,6 +16,7 @@
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableMap;
 import com.google.devtools.build.lib.vfs.Path;
 import com.google.errorprone.annotations.Immutable;
@@ -66,7 +67,12 @@ private CredentialHelperProvider(
   public Optional<CredentialHelper> findCredentialHelper(URI uri) {
     Preconditions.checkNotNull(uri);
 
-    String host = Preconditions.checkNotNull(uri.getHost());
+    String host = uri.getHost();
+    if (Strings.isNullOrEmpty(host)) {
+      // Some URIs (e.g. unix://) legitimately have no host component.
+      return Optional.empty();
+    }
+
     Optional<Path> credentialHelper =
         findHostCredentialHelper(host)
             .or(() -> findWildcardCredentialHelper(host))


Test patch:
diff --git a/src/test/java/com/google/devtools/build/lib/authandtls/credentialhelper/CredentialHelperProviderTest.java b/src/test/java/com/google/devtools/build/lib/authandtls/credentialhelper/CredentialHelperProviderTest.java
index 25b6c03ff8e6b2..89b6dbc6396b75 100644
--- a/src/test/java/com/google/devtools/build/lib/authandtls/credentialhelper/CredentialHelperProviderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/authandtls/credentialhelper/CredentialHelperProviderTest.java
@@ -104,6 +104,15 @@ public void invalidPattern() throws Exception {
     assertInvalidPattern("foo-*.münchen.de");
   }
 
+  @Test
+  public void uriWithoutHostComponent() throws Exception {
+    Path helper = fileSystem.getPath(EXAMPLE_COM_HELPER_PATH);
+    CredentialHelperProvider provider =
+        CredentialHelperProvider.builder().add("example.com", helper).build();
+
+    assertThat(provider.findCredentialHelper(URI.create("unix:///path/to/socket"))).isEmpty();
+  }
+
   @Test
   public void addNonExecutableDefaultHelper() throws Exception {
     Path helper = fileSystem.getPath("/path/to/non/executable");
Repository: bazelbuild/bazel
Issue: [5.3.x] 'bazel info' reports 'unknown key(s)' when specifying '--no//flag'
Labels: type: bug
team-Configurability
untriaged

### Description of the bug:


Looks like this was already fixed by a Googler at f6cccae5b6f9c0ad0e7d0bf7bd31ea1263449316 and would be a trivial backport to 5.3.x.

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.


(NOTE: It doesn't matter if WORKSPACE contains a repository rule for bazel_skylib.)

```console
$ cd $(mktemp -d)
$ touch WORKSPACE
$ cat >BUILD <<EOF
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

bool_flag(
    name = "example",
    build_setting_default = True,
)
EOF
$ USE_BAZEL_VERSION=5.3.0 bazelisk info --no//:example
ERROR: unknown key(s): '--no//:example'
```

### Which operating system are you running Bazel on?


Linux

### What is the output of `bazel info release`?


release 5.3.0

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.


_No response_

### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?


_No response_

### Have you found anything relevant by searching the web?

- https://github.com/bazelbuild/bazel/commit/f6cccae5b6f9c0ad0e7d0bf7bd31ea1263449316

### Any other information, logs, or outputs that you want to share?

_No response_

Issue comments:
@beasleyr-vmw If you would like to see this fix in 5.3.1, you could cherry-pick it onto the `release-5.3.1` branch and submit a PR.
Exactly what @fmeum said.  Please send a PR.

Pull request review comments:

Patch that resolved the issue:
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/StarlarkOptionsParser.java b/src/main/java/com/google/devtools/build/lib/runtime/StarlarkOptionsParser.java
index 0c60ee576e0541..9a0685c6ac30ae 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/StarlarkOptionsParser.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/StarlarkOptionsParser.java
@@ -333,7 +333,7 @@ public static Pair<ImmutableList<String>, ImmutableList<String>> removeStarlarkO
       String potentialStarlarkFlag = name.substring(2);
       // Check if the string uses the "no" prefix for setting boolean flags to false, trim
       // off "no" if so.
-      if (name.startsWith("no")) {
+      if (potentialStarlarkFlag.startsWith("no")) {
         potentialStarlarkFlag = potentialStarlarkFlag.substring(2);
       }
       // Check if the string contains a value, trim off the value if so.


Test patch: