feedback-to-code/mozzarella huggingface dataset:
Repository: kestra-io/kestra
Issue: flyway migration for version rollback
Labels: enhancement

If people downgrade kesta and there is some migration on the latest version, the user can start the server and will receive this breaking error: 
```
2023-06-12 10:31:03 Caused by: org.flywaydb.core.api.exception.FlywayValidateException: Validate failed: Migrations have failed validation
2023-06-12 10:31:03 Detected applied migration not resolved locally: 14.
2023-06-12 10:31:03 If you removed this migration intentionally, run repair to mark the migration as deleted.
2023-06-12 10:31:03 Need more flexibility with validation rules? Learn more: https://rd.gt/3AbJUZE
```
Define a proper path for downgrading:
- the best transparently
- if not possible, add some tooling to help 
- if not possible, document how to do it  


Issue comments:
We configured Flyway to ignore missing migrations to be able to remove old migrations file (or buggy ones).
So we configure it like ` flyway.ignore-migration-patterns: "*:missing"` which replace the default of `flyway. ignore-migration-patterns: "*:future"`.

So "future" migrations now trigger an error.

We should be able to configure it with ` flyway.ignore-migration-patterns: "*:missing,*:future"` to ignore both missing and future migrations.
We can also propose an option to repare the schema but un-supervised this can be dangerous.

Pull request review comments:

Patch that resolved the issue:
diff --git a/cli/src/main/resources/application.yml b/cli/src/main/resources/application.yml
index 32731072ae..7d3ceb27aa 100644
--- a/cli/src/main/resources/application.yml
+++ b/cli/src/main/resources/application.yml
@@ -58,7 +58,7 @@ flyway:
       locations:
         - classpath:migrations/postgres
       # We must ignore missing migrations as a V6 wrong migration was created and replaced by the V11
-      ignore-migration-patterns: "*:missing"
+      ignore-migration-patterns: "*:missing,*:future"
     mysql:
       enabled: true
       locations:
@@ -68,7 +68,7 @@ flyway:
       locations:
         - classpath:migrations/h2
       # We must ignore missing migrations as a V8 wrong migration was created and replaced by the V11
-      ignore-migration-patterns: "*:missing"
+      ignore-migration-patterns: "*:missing,*:future"
 
 kestra:
   retries:


Test patch:
diff --git a/jdbc-postgres/src/test/resources/application.yml b/jdbc-postgres/src/test/resources/application.yml
index 6f9f61c0af..db3f240d1d 100644
--- a/jdbc-postgres/src/test/resources/application.yml
+++ b/jdbc-postgres/src/test/resources/application.yml
@@ -13,7 +13,7 @@ flyway:
       locations:
         - classpath:migrations/postgres
       # We must ignore missing migrations as a V6 wrong migration was created and replaced by the V11
-      ignore-migration-patterns: "*:missing"
+      ignore-migration-patterns: "*:missing,*:future"
 
 kestra:
   queue:
Repository: kestra-io/kestra
Issue: Kill button on execution is the same than status button
Labels: bug
frontend

people will not understand that the button will allow killing the execution 

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/components/executions/Kill.vue b/ui/src/components/executions/Kill.vue
index 789fcdac03..a825a7d772 100644
--- a/ui/src/components/executions/Kill.vue
+++ b/ui/src/components/executions/Kill.vue
@@ -1,21 +1,36 @@
 <template>
-    <status status="KILLING" :title="$t('kill')" v-if="enabled" @click="kill" class="me-1" />
+    <component
+        :is="component"
+        :icon="StopCircleOutline"
+        @click="kill"
+        v-if="enabled"
+        class="me-1"
+    >
+        {{ $t('kill') }}
+    </component>
 </template>
-<script>
+
+<script setup>
     import StopCircleOutline from "vue-material-design-icons/StopCircleOutline.vue";
+</script>
+
+<script>
+
     import {mapState} from "vuex";
     import permission from "../../models/permission";
     import action from "../../models/action";
     import State from "../../utils/state";
-    import Status from "../Status.vue";
 
     export default {
-        components: {StopCircleOutline, Status},
         props: {
             execution: {
                 type: Object,
                 required: true
-            }
+            },
+            component: {
+                type: String,
+                default: "el-button"
+            },
         },
         methods: {
             kill() {


Test patch:
Repository: kestra-io/kestra
Issue: Plugin Documentation: Definitions section is displayed even when no definitions
Labels: bug

### Expected Behavior

When no definitions for a task, the definitions section must not be visible

### Actual Behaviour

An empty definitions section is displayed, for ex: https://kestra.io/plugins/core/tasks/flows/io.kestra.core.tasks.flows.worker#definitions

### Steps To Reproduce

_No response_

### Environment Information

- Kestra Version: 0.9.0-SNAPSHOT
- Operating System (OS / Docker / Kubernetes):
- Java Version (If not docker):


### Example flow

_No response_

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/core/src/main/java/io/kestra/core/docs/AbstractClassDocumentation.java b/core/src/main/java/io/kestra/core/docs/AbstractClassDocumentation.java
index 94b9091208..6fc592c42b 100644
--- a/core/src/main/java/io/kestra/core/docs/AbstractClassDocumentation.java
+++ b/core/src/main/java/io/kestra/core/docs/AbstractClassDocumentation.java
@@ -37,6 +37,9 @@ protected AbstractClassDocumentation(JsonSchemaGenerator jsonSchemaGenerator, Cl
         this.defs = this.getDefs()
             .entrySet()
             .stream()
+            // Remove the Task entry as it only contains a reference that is filtered in the doc template,
+            // which prevent the Definitions section to be empty if no other def exist.
+            .filter(entry -> !entry.getKey().equals("io.kestra.core.models.tasks.Task"))
             .map(entry -> {
                 Map<String, Object> value = (Map<String, Object>) entry.getValue();
                 value.put("properties", flatten(properties(value), required(value)));


Test patch:
diff --git a/core/src/test/java/io/kestra/core/docs/ClassPluginDocumentationTest.java b/core/src/test/java/io/kestra/core/docs/ClassPluginDocumentationTest.java
index 03d5a6daeb..dec16b3476 100644
--- a/core/src/test/java/io/kestra/core/docs/ClassPluginDocumentationTest.java
+++ b/core/src/test/java/io/kestra/core/docs/ClassPluginDocumentationTest.java
@@ -46,6 +46,9 @@ void tasks() throws URISyntaxException {
             assertThat(((Map<String, String>) doc.getInputs().get("format")).get("pattern"), is(".*"));
             assertThat(((Map<String, String>) doc.getInputs().get("format")).get("description"), containsString("of this input"));
 
+            // definitions
+            assertThat(doc.getDefs().size(), is(5));
+
             // enum
             Map<String, Object> enumProperties = (Map<String, Object>) ((Map<String, Object>) ((Map<String, Object>) doc.getDefs().get("io.kestra.plugin.templates.ExampleTask-PropertyChildInput")).get("properties")).get("childEnum");
             assertThat(((List<String>) enumProperties.get("enum")).size(), is(2));
Repository: kestra-io/kestra
Issue: Dashboard on flow without executions should not be displayed 
Labels: bug

normally we have this page: 
![image](https://github.com/kestra-io/kestra/assets/2064609/d5bf29b0-fc20-48f7-b6e0-1ffc37980eba)
it's not working anymore 

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/components/Tabs.vue b/ui/src/components/Tabs.vue
index 294ebe7c7d..7ea025851a 100644
--- a/ui/src/components/Tabs.vue
+++ b/ui/src/components/Tabs.vue
@@ -51,13 +51,13 @@
             $route() {
                 this.setActiveName();
             },
-            activeName() {
+            activeTab() {
                 this.$nextTick(() => {
                     this.setActiveName();
                 });
             }
         },
-        created() {
+        mounted() {
             this.setActiveName();
         },
         methods: {
diff --git a/ui/src/components/home/Home.vue b/ui/src/components/home/Home.vue
index 0de27a1fb2..93e44881ef 100644
--- a/ui/src/components/home/Home.vue
+++ b/ui/src/components/home/Home.vue
@@ -208,7 +208,17 @@
                 return _merge(base, queryFilter)
             },
             haveExecutions() {
-                this.$store.dispatch("execution/findExecutions", {limit: 1})
+                let params = {
+                    size: 1
+                };
+                if (this.selectedNamespace) {
+                    params["namespace"] = this.selectedNamespace;
+                }
+
+                if (this.flowId) {
+                    params["flowId"] = this.flowId;
+                }
+                this.$store.dispatch("execution/findExecutions", params )
                     .then(executions => {
                         this.executionCounts = executions.total;
                     });
@@ -301,13 +311,13 @@
                 if (this.executionCounts > 0) {
                     return true
                 }
-
                 // not flow home
                 if (!this.flowId) {
                     if (!this.$route.query.namespace && this.executionCounts === 0) {
                         return false;
                     }
-                } else if (this.executionCounts === 0) {
+                }
+                if (this.executionCounts === 0) {
                     return false;
                 }
 


Test patch:
Repository: kestra-io/kestra
Issue: Log on flow tabs on not sorted by reverse date
Labels: bug
frontend

![image](https://github.com/kestra-io/kestra/assets/2064609/09d25e4d-e6a1-4954-8b9e-bf8b80a124be)


Issue comments:
I think it was sorted this way before, and for me it's more logical to saw logs in ascending date order than in reverse date are logs are a kind of "story" of what happened in a flow.

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/components/logs/LogsWrapper.vue b/ui/src/components/logs/LogsWrapper.vue
index 28130890a2..fe36aeb9e5 100644
--- a/ui/src/components/logs/LogsWrapper.vue
+++ b/ui/src/components/logs/LogsWrapper.vue
@@ -123,7 +123,8 @@
                     .dispatch("log/findLogs", this.loadQuery({
                         page: this.$route.query.page || this.internalPageNumber,
                         size: this.$route.query.size || this.internalPageSize,
-                        minLevel: this.selectedLogLevel
+                        minLevel: this.selectedLogLevel,
+                        sort: "timestamp:desc"
                     }))
                     .finally(() => {
                         this.isLoading = false


Test patch:
Repository: kestra-io/kestra
Issue: Show max rather than sum when using the `EachParallel` task
Labels: bug

### Expected Behavior

When running 3 script tasks in parallel, I'd expect the aggregated `pandasTransform` task to show the MAX runtime i.e. the time of the longest task, rather than the sum of all tasks, because they were running in parallel:

![image](https://github.com/kestra-io/kestra/assets/86264395/757bba67-b853-487e-882b-fcb02808cb4d)


### Actual Behaviour

flow

```yaml
id: pandas
namespace: dev
tasks:
  - id: csv
    type: io.kestra.core.tasks.flows.EachParallel
    value: ["https://raw.githubusercontent.com/dbt-labs/jaffle_shop/main/seeds/raw_customers.csv", "https://raw.githubusercontent.com/dbt-labs/jaffle_shop/main/seeds/raw_orders.csv", "https://raw.githubusercontent.com/dbt-labs/jaffle_shop/main/seeds/raw_payments.csv"]
    tasks:
    - id: pandasTransform
      type: io.kestra.core.tasks.scripts.Python
      inputFiles:
        data.csv: "{{taskrun.value}}"
        main.py: |
          import pandas as pd
          df = pd.read_csv("data.csv")
          df.info()
      requirements:
        - pandas
```

### Steps To Reproduce

_No response_

### Environment Information

- Kestra Version: 0.9.0

### Example flow

_No response_

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/components/graph/TreeTaskNode.vue b/ui/src/components/graph/TreeTaskNode.vue
index 8bba19a1b4..8488992b93 100644
--- a/ui/src/components/graph/TreeTaskNode.vue
+++ b/ui/src/components/graph/TreeTaskNode.vue
@@ -312,8 +312,8 @@
                     .filter(value => value.state.histories && value.state.histories.length > 0)
                     .map(value => new Date(value.state.histories[value.state.histories.length -1].date).getTime()));
 
-                const duration = this.taskRuns
-                    .reduce((inc, taskRun) => inc + this.$moment.duration(taskRun.state.duration).asMilliseconds() / 1000, 0);
+                const duration = Math.max(...this.taskRuns
+                    .map((taskRun) => this.$moment.duration(taskRun.state.duration).asMilliseconds() / 1000, 0));
 
                 return [
                     {date: this.$moment(max).subtract(duration, "second"), state: "CREATED"},


Test patch:
Repository: kestra-io/kestra
Issue: Execution stats are not refresh correctly 
Labels: bug
frontend

- have at least 2 flows with one without any execution
- go on the flows list 
- go on the flow detail 
- hit new execution 
- go on the flows list 
- go on the flow detail for the one that don't have any executions 
- see the stats from the previous flows  

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/components/home/Home.vue b/ui/src/components/home/Home.vue
index d1b657be6a..d8c090b1a8 100644
--- a/ui/src/components/home/Home.vue
+++ b/ui/src/components/home/Home.vue
@@ -133,7 +133,6 @@
     import action from "../../models/action";
     import OnboardingBottom from "../onboarding/OnboardingBottom.vue";
     import DateRange from "../layout/DateRange.vue";
-    import {getFormat} from "../../utils/charts";
 
     export default {
         mixins: [RouteContext, RestoreUrl],
@@ -173,6 +172,10 @@
                 if (oldValue.name === newValue.name && newValue.query !== oldValue.query) {
                     this.loadStats();
                 }
+            },
+            flowId() {
+                this.loadStats();
+                this.haveExecutions();
             }
         },
         data() {


Test patch:
Repository: kestra-io/kestra
Issue: Minor bug: the onboarding tour window doesn't close after "Save" flow step
Labels: bug

### Expected Behavior

_No response_

### Actual Behaviour

![image](https://github.com/kestra-io/kestra/assets/86264395/2f91a86f-9e1d-495a-aad8-6af878cf15ed)


could be just window placement, after clicking Execute now, the window is back

![image](https://github.com/kestra-io/kestra/assets/86264395/2ebaee89-b62f-4f6e-ad82-6f4ff731e995)


An easy fix would be to finish the tour after the Save step - instead of "Save" it could be "Save and execute the flow" maybe? @Ben8t  

### Environment Information

- Kestra Version: latest 0.9.3

### Example flow

_No response_

Issue comments:
Agree, linked to #1399 
It seems that your page miss the title, that's the root of the issue

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/components/onboarding/VueTour.vue b/ui/src/components/onboarding/VueTour.vue
index 6610cc0f93..212df802e4 100644
--- a/ui/src/components/onboarding/VueTour.vue
+++ b/ui/src/components/onboarding/VueTour.vue
@@ -277,7 +277,7 @@
                             this.dispatchEvent(this.$tours["guidedTour"].currentStep._value, "created")
                             setTimeout(() => {
                                 resolve(true);
-                            }, 300);
+                            }, 500);
                         }),
                     },
                     {
@@ -294,7 +294,7 @@
                             localStorage.setItem("tourDoneOrSkip", "true");
                             setTimeout(() => {
                                 resolve(true);
-                            }, 300);
+                            }, 500);
                         }),
                     }
                 ],


Test patch:
Repository: kestra-io/kestra
Issue: PR build should build the JavDoc

### Issue description

PR build should build the JavDoc to avoid merging PR that will crash the build on master as it builds the JavaDoc.

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 542efa225e..1b1cb43d0d 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -91,7 +91,7 @@ jobs:
           python3 -m pip install virtualenv
           echo $GOOGLE_SERVICE_ACCOUNT | base64 -d > ~/.gcp-service-account.json
           export GOOGLE_APPLICATION_CREDENTIALS=$HOME/.gcp-service-account.json
-          ./gradlew check jacoco --no-daemon --priority=normal
+          ./gradlew check jacoco javadoc --no-daemon --priority=normal
 
       # Codecov
       - uses: codecov/codecov-action@v3
diff --git a/build.gradle b/build.gradle
index dc057b2e59..c37ecf0c06 100644
--- a/build.gradle
+++ b/build.gradle
@@ -349,6 +349,7 @@ subprojects {
         options {
             locale = 'en_US'
             encoding = 'UTF-8'
+            addStringOption("Xdoclint:none", "-quiet")
         }
     }
 


Test patch:
diff --git a/jdbc/src/test/java/io/kestra/jdbc/runner/JdbcRunnerTest.java b/jdbc/src/test/java/io/kestra/jdbc/runner/JdbcRunnerTest.java
index 4c0151ab57..51ae829afb 100644
--- a/jdbc/src/test/java/io/kestra/jdbc/runner/JdbcRunnerTest.java
+++ b/jdbc/src/test/java/io/kestra/jdbc/runner/JdbcRunnerTest.java
@@ -15,6 +15,7 @@
 import jakarta.inject.Inject;
 import jakarta.inject.Named;
 import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.RepeatedTest;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.TestInstance;
 import org.junitpioneer.jupiter.RetryingTest;
@@ -179,7 +180,7 @@ void withTemplate() throws Exception {
         TemplateTest.withTemplate(runnerUtils, templateRepository, repositoryLoader, logsQueue);
     }
 
-    @Test
+    @RetryingTest(5)
     void withFailedTemplate() throws Exception {
         TemplateTest.withFailedTemplate(runnerUtils, templateRepository, repositoryLoader, logsQueue);
     }
diff --git a/webserver/src/test/java/io/kestra/webserver/controllers/ExecutionControllerTest.java b/webserver/src/test/java/io/kestra/webserver/controllers/ExecutionControllerTest.java
index e5a7a4d195..32d2c0935c 100644
--- a/webserver/src/test/java/io/kestra/webserver/controllers/ExecutionControllerTest.java
+++ b/webserver/src/test/java/io/kestra/webserver/controllers/ExecutionControllerTest.java
@@ -241,7 +241,7 @@ void restartFromUnknownTaskId() throws TimeoutException {
         assertThat(e.getResponse().getBody(String.class).get(), containsString("No task found"));
     }
 
-    @Test
+    @RetryingTest(5)
     void restartWithNoFailure() throws TimeoutException {
         final String flowId = "restart_with_inputs";
Repository: kestra-io/kestra
Issue: Blueprint title overlap with editor views button
Labels: bug

### Expected Behavior

_No response_

### Actual Behaviour

![image](https://github.com/kestra-io/kestra/assets/46634684/8cbc4911-8bb0-4f1e-8d4f-9fb13453186b)


### Steps To Reproduce

_No response_

### Environment Information

- Kestra Version:
- Operating System (OS / Docker / Kubernetes):
- Java Version (If not docker):


### Example flow

_No response_

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/components/flows/blueprints/BlueprintDetail.vue b/ui/src/components/flows/blueprints/BlueprintDetail.vue
index 9687cd7e6e..5359708886 100644
--- a/ui/src/components/flows/blueprints/BlueprintDetail.vue
+++ b/ui/src/components/flows/blueprints/BlueprintDetail.vue
@@ -164,6 +164,10 @@
     .header-wrapper {
         margin-bottom: $spacer;
 
+        .el-card & {
+            margin-top: 2.5rem;
+        }
+
         .header {
             margin-bottom: calc(var(--spacer) * 0.5);
 


Test patch:
Repository: kestra-io/kestra
Issue: Backend error on save don't provide any feedback on ui
Labels: bug
frontend

![image](https://github.com/kestra-io/kestra/assets/2064609/6e0d5aaa-5cfb-42c0-960c-df92d6a93f97)


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 d2f52880af..a6eed9c48d 100644
--- a/ui/src/utils/axios.js
+++ b/ui/src/utils/axios.js
@@ -76,7 +76,7 @@ export default (callback, store, router) => {
         response => {
             return response
         }, errorResponse => {
-            if (errorResponse.code && errorResponse.code === "ECONNABORTED") {
+            if (errorResponse.code && (errorResponse.code === "ECONNABORTED" || errorResponse.code === "ERR_BAD_RESPONSE")) {
                 store.dispatch("core/showMessage", {
                     response: errorResponse,
                     content: errorResponse,


Test patch:
Repository: kestra-io/kestra
Issue: Remove top progress bar during flow typing 
Labels: bug


https://github.com/kestra-io/kestra/assets/2064609/d9c6d5bd-fa91-47a1-99d8-b1d64f3c7146



Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/ui/src/stores/flow.js b/ui/src/stores/flow.js
index 16a73ba749..dc7fd5317f 100644
--- a/ui/src/stores/flow.js
+++ b/ui/src/stores/flow.js
@@ -159,7 +159,7 @@ export default {
             if (!flowParsed.id || !flowParsed.namespace) {
                 flowSource = YamlUtils.updateMetadata(flowSource, {id: "default", namespace: "default"})
             }
-            return this.$http.post("/api/v1/flows/graph", flowSource, {...config})
+            return axios.post("/api/v1/flows/graph", flowSource, {...config})
                 .then(response => {
                     if (response.status === 422) {
                         return response;


Test patch: