Repository: kestra-io/kestra (java)

Issue:
Can't view files when Editor is selected to Topology View
### Describe the issue

When you open the Editor, and change the view to Topology only, namespace files will not open. They will appear as tabs at the top but it will not display them

https://github.com/kestra-io/kestra/assets/34094921/dcf9edaf-2026-4c52-acf9-9259e36f6650





### Environment

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


Pull request description:
fix(ui): properly handle view type on namespace files
Closes #4073.

Patch:
diff --git a/core/src/main/java/io/kestra/core/models/triggers/Trigger.java b/core/src/main/java/io/kestra/core/models/triggers/Trigger.java
index 2d81f29f6..20c09e5a0 100644
--- a/core/src/main/java/io/kestra/core/models/triggers/Trigger.java
+++ b/core/src/main/java/io/kestra/core/models/triggers/Trigger.java
@@ -79,7 +79,7 @@ public class Trigger extends TriggerContext {
     }
 
     public String flowUid() {
-        return Flow.uid(this.getTenantId(), this.getNamespace(), this.getFlowId(), Optional.of(this.getFlowRevision()));
+        return Flow.uidWithoutRevision(this.getTenantId(), this.getNamespace(), this.getFlowId());
     }
 
     /**
@@ -90,7 +90,6 @@ public class Trigger extends TriggerContext {
             .tenantId(flow.getTenantId())
             .namespace(flow.getNamespace())
             .flowId(flow.getId())
-            .flowRevision(flow.getRevision())
             .triggerId(abstractTrigger.getId())
             .stopAfter(abstractTrigger.getStopAfter())
             .build();
@@ -137,7 +136,6 @@ public class Trigger extends TriggerContext {
             .tenantId(execution.getTenantId())
             .namespace(execution.getNamespace())
             .flowId(execution.getFlowId())
-            .flowRevision(execution.getFlowRevision())
             .triggerId(execution.getTrigger().getId())
             .date(trigger.getDate())
             .nextExecutionDate(trigger.getNextExecutionDate())
@@ -175,7 +173,6 @@ public class Trigger extends TriggerContext {
             .tenantId(flow.getTenantId())
             .namespace(flow.getNamespace())
             .flowId(flow.getId())
-            .flowRevision(flow.getRevision())
             .triggerId(abstractTrigger.getId())
             .date(ZonedDateTime.now().truncatedTo(ChronoUnit.SECONDS))
             .nextExecutionDate(nextDate)
@@ -225,7 +222,6 @@ public class Trigger extends TriggerContext {
             .tenantId(this.getTenantId())
             .namespace(this.getNamespace())
             .flowId(this.getFlowId())
-            .flowRevision(this.getFlowRevision())
             .triggerId(this.getTriggerId())
             .date(this.getDate())
             .nextExecutionDate(nextExecutionDate)
@@ -240,7 +236,6 @@ public class Trigger extends TriggerContext {
             .tenantId(this.getTenantId())
             .namespace(this.getNamespace())
             .flowId(this.getFlowId())
-            .flowRevision(this.getFlowRevision())
             .triggerId(this.getTriggerId())
             .date(this.getDate())
             .nextExecutionDate(this.getNextExecutionDate())
@@ -301,7 +296,6 @@ public class Trigger extends TriggerContext {
             .tenantId(triggerContext.getTenantId())
             .namespace(triggerContext.getNamespace())
             .flowId(triggerContext.getFlowId())
-            .flowRevision(triggerContext.getFlowRevision())
             .triggerId(triggerContext.getTriggerId())
             .date(triggerContext.getDate())
             .backfill(triggerContext.getBackfill())
diff --git a/core/src/main/java/io/kestra/core/models/triggers/TriggerContext.java b/core/src/main/java/io/kestra/core/models/triggers/TriggerContext.java
index b7751a052..e3f298f8c 100644
--- a/core/src/main/java/io/kestra/core/models/triggers/TriggerContext.java
+++ b/core/src/main/java/io/kestra/core/models/triggers/TriggerContext.java
@@ -29,9 +29,6 @@ public class TriggerContext {
     @NotNull
     private String flowId;
 
-    @NotNull
-    private Integer flowRevision;
-
     @NotNull
     private String triggerId;
 
@@ -53,7 +50,6 @@ public class TriggerContext {
         this.tenantId = b.tenantId;
         this.namespace = b.namespace;
         this.flowId = b.flowId;
-        this.flowRevision = b.flowRevision;
         this.triggerId = b.triggerId;
         this.date = b.date;
         this.nextExecutionDate = b.nextExecutionDate;
diff --git a/core/src/main/java/io/kestra/core/models/triggers/TriggerService.java b/core/src/main/java/io/kestra/core/models/triggers/TriggerService.java
index cffa559b5..0ce0dbd2f 100644
--- a/core/src/main/java/io/kestra/core/models/triggers/TriggerService.java
+++ b/core/src/main/java/io/kestra/core/models/triggers/TriggerService.java
@@ -1,7 +1,5 @@
 package io.kestra.core.models.triggers;
 
-import io.kestra.core.exceptions.IllegalVariableEvaluationException;
-import io.kestra.core.models.Label;
 import io.kestra.core.models.conditions.ConditionContext;
 import io.kestra.core.models.executions.Execution;
 import io.kestra.core.models.executions.ExecutionTrigger;
@@ -22,7 +20,7 @@ public abstract class TriggerService {
         ExecutionTrigger executionTrigger = ExecutionTrigger.of(trigger, variables);
         RunContext runContext = conditionContext.getRunContext();
 
-        return generateExecution(runContext.getTriggerExecutionId(), trigger, context, executionTrigger);
+        return generateExecution(runContext.getTriggerExecutionId(), trigger, context, executionTrigger, conditionContext.getFlow().getRevision());
     }
 
     public static Execution generateExecution(
@@ -34,30 +32,32 @@ public abstract class TriggerService {
         ExecutionTrigger executionTrigger = ExecutionTrigger.of(trigger, output);
         RunContext runContext = conditionContext.getRunContext();
 
-        return generateExecution(runContext.getTriggerExecutionId(), trigger, context, executionTrigger);
+        return generateExecution(runContext.getTriggerExecutionId(), trigger, context, executionTrigger, conditionContext.getFlow().getRevision());
     }
 
     public static Execution generateRealtimeExecution(
         AbstractTrigger trigger,
+        ConditionContext conditionContext,
         TriggerContext context,
         Output output
     ) {
         ExecutionTrigger executionTrigger = ExecutionTrigger.of(trigger, output);
 
-        return generateExecution(IdUtils.create(), trigger, context, executionTrigger);
+        return generateExecution(IdUtils.create(), trigger, context, executionTrigger, conditionContext.getFlow().getRevision());
     }
 
     private static Execution generateExecution(
         String id,
         AbstractTrigger trigger,
         TriggerContext context,
-        ExecutionTrigger executionTrigger
+        ExecutionTrigger executionTrigger,
+        Integer flowRevision
     ) {
         return Execution.builder()
             .id(id)
             .namespace(context.getNamespace())
             .flowId(context.getFlowId())
-            .flowRevision(context.getFlowRevision())
+            .flowRevision(flowRevision)
             .state(new State())
             .trigger(executionTrigger)
             .labels(trigger.getLabels() == null ? null : trigger.getLabels())
diff --git a/core/src/main/java/io/kestra/core/runners/FlowListeners.java b/core/src/main/java/io/kestra/core/runners/FlowListeners.java
index 01c9f35f6..d56a11f27 100644
--- a/core/src/main/java/io/kestra/core/runners/FlowListeners.java
+++ b/core/src/main/java/io/kestra/core/runners/FlowListeners.java
@@ -14,6 +14,7 @@ import io.kestra.core.services.FlowListenersInterface;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.function.BiConsumer;
 import java.util.function.Consumer;
@@ -98,13 +99,13 @@ public class FlowListeners implements FlowListenersInterface {
     private Optional<Flow> previous(Flow flow) {
         return flows
             .stream()
-            .filter(r -> r.getNamespace().equals(flow.getNamespace()) && r.getId().equals(flow.getId()))
+            .filter(r -> Objects.equals(r.getTenantId(), flow.getTenantId()) && r.getNamespace().equals(flow.getNamespace()) && r.getId().equals(flow.getId()))
             .findFirst();
     }
 
     private boolean remove(Flow flow) {
         synchronized (this) {
-            boolean remove = flows.removeIf(r -> r.getNamespace().equals(flow.getNamespace()) && r.getId().equals(flow.getId()));
+            boolean remove = flows.removeIf(r -> Objects.equals(r.getTenantId(), flow.getTenantId()) && r.getNamespace().equals(flow.getNamespace()) && r.getId().equals(flow.getId()));
             if (!remove && flow.isDeleted()) {
                 log.warn("Can't remove flow {}.{}", flow.getNamespace(), flow.getId());
             }
diff --git a/core/src/main/java/io/kestra/core/schedulers/AbstractScheduler.java b/core/src/main/java/io/kestra/core/schedulers/AbstractScheduler.java
index 2d9e59e1d..c8a451340 100644
--- a/core/src/main/java/io/kestra/core/schedulers/AbstractScheduler.java
+++ b/core/src/main/java/io/kestra/core/schedulers/AbstractScheduler.java
@@ -180,7 +180,6 @@ public abstract class AbstractScheduler implements Scheduler, Service {
                         if (abstractTrigger instanceof WorkerTriggerInterface) {
                             RunContext runContext = runContextFactory.of(flow, abstractTrigger);
                             ConditionContext conditionContext = conditionService.conditionContext(runContext, flow, null);
-                            Trigger trigger = Trigger.of(flow, abstractTrigger);
 
                             try {
                                 this.triggerState.update(flow, abstractTrigger, conditionContext);
@@ -188,6 +187,7 @@ public abstract class AbstractScheduler implements Scheduler, Service {
                                 logError(conditionContext, flow, abstractTrigger, e);
                             }
 
+                            Trigger trigger = Trigger.of(flow, abstractTrigger);
                             this.executionKilledQueue.emit(ExecutionKilledTrigger
                                 .builder()
                                 .tenantId(trigger.getTenantId())
@@ -257,7 +257,6 @@ public abstract class AbstractScheduler implements Scheduler, Service {
                             .tenantId(flowAndTrigger.flow().getTenantId())
                             .namespace(flowAndTrigger.flow().getNamespace())
                             .flowId(flowAndTrigger.flow().getId())
-                            .flowRevision(flowAndTrigger.flow().getRevision())
                             .triggerId(flowAndTrigger.trigger().getId())
                             .date(now())
                             .nextExecutionDate(nextExecutionDate)
@@ -370,7 +369,7 @@ public abstract class AbstractScheduler implements Scheduler, Service {
     public List<FlowWithTriggers> schedulerTriggers() {
         Map<String, Flow> flows = this.flowListeners.flows()
             .stream()
-            .collect(Collectors.toMap(Flow::uid, Function.identity()));
+            .collect(Collectors.toMap(Flow::uidWithoutRevision, Function.identity()));
 
         return this.triggerState.findAllForAllTenants().stream()
             .filter(trigger -> flows.containsKey(trigger.flowUid()))
@@ -528,7 +527,6 @@ public abstract class AbstractScheduler implements Scheduler, Service {
                             .tenantId(f.getTriggerContext().getTenantId())
                             .namespace(f.getTriggerContext().getNamespace())
                             .flowId(f.getTriggerContext().getFlowId())
-                            .flowRevision(f.getTriggerContext().getFlowRevision())
                             .labels(f.getFlow().getLabels())
                             .state(new State().withState(State.Type.FAILED))
                             .build();
@@ -854,7 +852,6 @@ public abstract class AbstractScheduler implements Scheduler, Service {
                     .tenantId(f.getTriggerContext().getTenantId())
                     .namespace(f.getTriggerContext().getNamespace())
                     .flowId(f.getTriggerContext().getFlowId())
-                    .flowRevision(f.getTriggerContext().getFlowRevision())
                     .triggerId(f.getTriggerContext().getTriggerId())
                     .date(f.getTriggerContext().getNextExecutionDate())
                     .nextExecutionDate(f.getTriggerContext().getNextExecutionDate())
diff --git a/core/src/main/java/io/kestra/plugin/core/trigger/Schedule.java b/core/src/main/java/io/kestra/plugin/core/trigger/Schedule.java
index a40f62bf8..4c5f13a9c 100644
--- a/core/src/main/java/io/kestra/plugin/core/trigger/Schedule.java
+++ b/core/src/main/java/io/kestra/plugin/core/trigger/Schedule.java
@@ -367,7 +367,7 @@ public class Schedule extends AbstractTrigger implements PollingTriggerInterface
                     .tenantId(triggerContext.getTenantId())
                     .namespace(triggerContext.getNamespace())
                     .flowId(triggerContext.getFlowId())
-                    .flowRevision(triggerContext.getFlowRevision())
+                    .flowRevision(conditionContext.getFlow().getRevision())
                     .labels(labels)
                     .state(new State().withState(State.Type.FAILED))
                     .build();
@@ -411,7 +411,7 @@ public class Schedule extends AbstractTrigger implements PollingTriggerInterface
             .tenantId(triggerContext.getTenantId())
             .namespace(triggerContext.getNamespace())
             .flowId(triggerContext.getFlowId())
-            .flowRevision(triggerContext.getFlowRevision())
+            .flowRevision(conditionContext.getFlow().getRevision())
             .labels(labels)
             .state(new State())
             .trigger(executionTrigger)
diff --git a/ui/src/components/inputs/EditorView.vue b/ui/src/components/inputs/EditorView.vue
index 6bb31e4ec..981f2712f 100644
--- a/ui/src/components/inputs/EditorView.vue
+++ b/ui/src/components/inputs/EditorView.vue
@@ -587,8 +587,10 @@
         timer.value = setTimeout(() => onEdit(event, isFlow), 500);
     };
 
-    const switchViewType = (event) => {
-        persistViewType(event);
+    const switchViewType = (event, shouldPersist = true) => {
+        if(shouldPersist) persistViewType(event)
+        else viewType.value = event
+
         if (
             [editorViewTypes.TOPOLOGY, editorViewTypes.SOURCE_TOPOLOGY].includes(
                 viewType.value
@@ -882,7 +884,13 @@
         return tab.name === currentTab.value.name;
     }
 
-    watch(currentTab, () => {
+    watch(currentTab, (current, previous) => {
+        const isCurrentFlow = current?.name === "Flow";
+        const isPreviousFlow = previous?.name === "Flow";
+
+        if(isPreviousFlow) persistViewType(viewType.value);
+        switchViewType(isCurrentFlow ? loadViewType() : editorViewTypes.SOURCE, false)
+        
         nextTick(() => {
             const activeTabElement = tabsScrollRef.value.wrapRef.querySelector(".tab-active");
             const rightMostCurrentTabPixel = activeTabElement.offsetLeft + activeTabElement.clientWidth;
diff --git a/ui/src/components/inputs/SwitchView.vue b/ui/src/components/inputs/SwitchView.vue
index f27697709..3e4f528eb 100644
--- a/ui/src/components/inputs/SwitchView.vue
+++ b/ui/src/components/inputs/SwitchView.vue
@@ -3,17 +3,17 @@
         <el-tooltip :content="$t('source')" transition="" :hide-after="0" :persistent="false" effect="light">
             <el-button :type="buttonType(editorViewTypes.SOURCE)" @click="switchView(editorViewTypes.SOURCE)" :icon="FileDocumentEditOutline" />
         </el-tooltip>
-        <el-tooltip :content="$t('source and doc')" transition="" :hide-after="0" :persistent="false" effect="light">
-            <el-button :type="buttonType(editorViewTypes.SOURCE_DOC)" @click="switchView(editorViewTypes.SOURCE_DOC)" :icon="BookOpenOutline" />
+        <el-tooltip :content="!isFlow ? $t('flow_only') : $t('source and doc')" transition="" :hide-after="0" :persistent="false" effect="light">
+            <el-button :disabled="!isFlow" :type="buttonType(editorViewTypes.SOURCE_DOC)" @click="switchView(editorViewTypes.SOURCE_DOC)" :icon="BookOpenOutline" />
         </el-tooltip>
-        <el-tooltip :content="$t('source and topology')" transition="" :hide-after="0" :persistent="false" effect="light">
-            <el-button :type="buttonType(editorViewTypes.SOURCE_TOPOLOGY)" @click="switchView(editorViewTypes.SOURCE_TOPOLOGY)" :icon="FileTableOutline" />
+        <el-tooltip :content="!isFlow ? $t('flow_only') : $t('source and topology')" transition="" :hide-after="0" :persistent="false" effect="light">
+            <el-button :disabled="!isFlow" :type="buttonType(editorViewTypes.SOURCE_TOPOLOGY)" @click="switchView(editorViewTypes.SOURCE_TOPOLOGY)" :icon="FileTableOutline" />
         </el-tooltip>
-        <el-tooltip :content="$t('topology')" transition="" :hide-after="0" :persistent="false" effect="light">
-            <el-button :type="buttonType(editorViewTypes.TOPOLOGY)" @click="switchView(editorViewTypes.TOPOLOGY)" :icon="FileTreeOutline" />
+        <el-tooltip :content="!isFlow ? $t('flow_only') : $t('topology')" transition="" :hide-after="0" :persistent="false" effect="light">
+            <el-button :disabled="!isFlow" :type="buttonType(editorViewTypes.TOPOLOGY)" @click="switchView(editorViewTypes.TOPOLOGY)" :icon="FileTreeOutline" />
         </el-tooltip>
-        <el-tooltip :content="$t('source and blueprints')" transition="" :hide-after="0" :persistent="false" effect="light">
-            <el-button :type="buttonType(editorViewTypes.SOURCE_BLUEPRINTS)" @click="switchView(editorViewTypes.SOURCE_BLUEPRINTS)" :icon="BallotOutline" />
+        <el-tooltip :content="!isFlow ? $t('flow_only') : $t('source and blueprints')" transition="" :hide-after="0" :persistent="false" effect="light">
+            <el-button :disabled="!isFlow" :type="buttonType(editorViewTypes.SOURCE_BLUEPRINTS)" @click="switchView(editorViewTypes.SOURCE_BLUEPRINTS)" :icon="BallotOutline" />
         </el-tooltip>
     </el-button-group>
 </template>
@@ -28,7 +28,7 @@
 </script>
 
 <script>
-    import {mapMutations} from "vuex";
+    import {mapState, mapMutations} from "vuex";
 
     export default {
         props: {
@@ -38,6 +38,14 @@
             }
         },
         emits: ["switch-view"],
+        computed: {
+            ...mapState({
+                currentTab: (state) => state.editor.current
+            }),
+            isFlow(){
+                return this.currentTab?.name === "Flow"
+            }
+        },
         methods: {
             ...mapMutations("editor", ["changeView"]),
 
diff --git a/ui/src/translations/en.json b/ui/src/translations/en.json
index c49b7aa20..23b8928aa 100644
--- a/ui/src/translations/en.json
+++ b/ui/src/translations/en.json
@@ -809,6 +809,7 @@
     "ee-tooltip": {
       "features-blocked": "This feature requires Enterprise Edition.",
       "button": "Talk to us"
-    }
+    },
+    "flow_only": "Only available on Flow tab."
   }
 }
\ No newline at end of file
diff --git a/ui/src/translations/fr.json b/ui/src/translations/fr.json
index c4ae040e5..3a7e59aa4 100644
--- a/ui/src/translations/fr.json
+++ b/ui/src/translations/fr.json
@@ -781,6 +781,7 @@
     "ee-tooltip": {
       "features-blocked": "Cette fonctionnalité nécessite l'édition Enterprise.",
       "button": "Contactez-nous"
-    }
+    },
+    "flow_only": "Disponible uniquement sur l'onglet Flow."
   }
 }
\ No newline at end of file


Test patch:
diff --git a/core/src/test/java/io/kestra/core/repositories/AbstractTriggerRepositoryTest.java b/core/src/test/java/io/kestra/core/repositories/AbstractTriggerRepositoryTest.java
index 6112a3ab9..33cc55d82 100644
--- a/core/src/test/java/io/kestra/core/repositories/AbstractTriggerRepositoryTest.java
+++ b/core/src/test/java/io/kestra/core/repositories/AbstractTriggerRepositoryTest.java
@@ -26,7 +26,6 @@ public abstract class AbstractTriggerRepositoryTest {
         return Trigger.builder()
             .flowId(IdUtils.create())
             .namespace(TEST_NAMESPACE)
-            .flowRevision(1)
             .triggerId(IdUtils.create())
             .executionId(IdUtils.create())
             .date(ZonedDateTime.now());
diff --git a/core/src/test/java/io/kestra/core/runners/DeserializationIssuesCaseTest.java b/core/src/test/java/io/kestra/core/runners/DeserializationIssuesCaseTest.java
index 7611a22f4..be16429c4 100644
--- a/core/src/test/java/io/kestra/core/runners/DeserializationIssuesCaseTest.java
+++ b/core/src/test/java/io/kestra/core/runners/DeserializationIssuesCaseTest.java
@@ -90,8 +90,7 @@ public class DeserializationIssuesCaseTest {
             "date": "2023-11-24T15:48:57.632881597Z",
             "flowId": "http-trigger",
             "namespace": "dev",
-            "triggerId": "http",
-            "flowRevision": 3
+            "triggerId": "http"
           },
           "conditionContext": {
             "flow": {
diff --git a/core/src/test/java/io/kestra/core/runners/FlowListenersTest.java b/core/src/test/java/io/kestra/core/runners/FlowListenersTest.java
index 80653afd9..bda2a07ab 100644
--- a/core/src/test/java/io/kestra/core/runners/FlowListenersTest.java
+++ b/core/src/test/java/io/kestra/core/runners/FlowListenersTest.java
@@ -104,6 +104,13 @@ abstract public class FlowListenersTest {
             assertThat(count.get(), is(2));
             assertThat(flowListenersService.flows().size(), is(2));
         });
+
+        Flow withTenant = first.toBuilder().tenantId("some-tenant").build();
+        flowRepository.create(withTenant, withTenant.generateSource(), pluginDefaultService.injectDefaults(withTenant));
+        wait(ref, () -> {
+            assertThat(count.get(), is(3));
+            assertThat(flowListenersService.flows().size(), is(3));
+        });
     }
 
     public static class Ref {
diff --git a/core/src/test/java/io/kestra/core/schedulers/AbstractSchedulerTest.java b/core/src/test/java/io/kestra/core/schedulers/AbstractSchedulerTest.java
index d11b0d020..b1683ef85 100644
--- a/core/src/test/java/io/kestra/core/schedulers/AbstractSchedulerTest.java
+++ b/core/src/test/java/io/kestra/core/schedulers/AbstractSchedulerTest.java
@@ -125,7 +125,7 @@ abstract public class AbstractSchedulerTest {
                     .id(IdUtils.create())
                     .namespace(context.getNamespace())
                     .flowId(context.getFlowId())
-                    .flowRevision(context.getFlowRevision())
+                    .flowRevision(conditionContext.getFlow().getRevision())
                     .state(new State())
                     .trigger(ExecutionTrigger.builder()
                         .id(this.getId())
diff --git a/core/src/test/java/io/kestra/core/schedulers/SchedulerConditionTest.java b/core/src/test/java/io/kestra/core/schedulers/SchedulerConditionTest.java
index c3b39c6aa..6e9826b5c 100644
--- a/core/src/test/java/io/kestra/core/schedulers/SchedulerConditionTest.java
+++ b/core/src/test/java/io/kestra/core/schedulers/SchedulerConditionTest.java
@@ -65,7 +65,6 @@ class SchedulerConditionTest extends AbstractSchedulerTest {
         triggerState.create(Trigger.builder()
             .namespace(flow.getNamespace())
             .flowId(flow.getId())
-            .flowRevision(flow.getRevision())
             .triggerId("hourly")
             .date(ZonedDateTime.parse("2021-09-06T02:00:00+01:00[Europe/Paris]"))
             .build()
diff --git a/core/src/test/java/io/kestra/core/schedulers/SchedulerTriggerStateInterfaceTest.java b/core/src/test/java/io/kestra/core/schedulers/SchedulerTriggerStateInterfaceTest.java
index 46f8f696b..4457766d8 100644
--- a/core/src/test/java/io/kestra/core/schedulers/SchedulerTriggerStateInterfaceTest.java
+++ b/core/src/test/java/io/kestra/core/schedulers/SchedulerTriggerStateInterfaceTest.java
@@ -21,7 +21,6 @@ public abstract class SchedulerTriggerStateInterfaceTest {
         return Trigger.builder()
             .flowId(IdUtils.create())
             .namespace("io.kestra.unittest")
-            .flowRevision(1)
             .triggerId(IdUtils.create())
             .executionId(IdUtils.create())
             .date(ZonedDateTime.now());
diff --git a/core/src/test/java/io/kestra/plugin/core/trigger/ScheduleTest.java b/core/src/test/java/io/kestra/plugin/core/trigger/ScheduleTest.java
index b53d8af3c..40732dd1b 100644
--- a/core/src/test/java/io/kestra/plugin/core/trigger/ScheduleTest.java
+++ b/core/src/test/java/io/kestra/plugin/core/trigger/ScheduleTest.java
@@ -71,7 +71,6 @@ class ScheduleTest {
         return TriggerContext.builder()
             .namespace(flow.getNamespace())
             .flowId(flow.getNamespace())
-            .flowRevision(flow.getRevision())
             .triggerId(schedule.getId())
             .date(date)
             .build();
diff --git a/tests/src/main/java/io/kestra/core/utils/TestsUtils.java b/tests/src/main/java/io/kestra/core/utils/TestsUtils.java
index 3cb4156d5..ed5f3d190 100644
--- a/tests/src/main/java/io/kestra/core/utils/TestsUtils.java
+++ b/tests/src/main/java/io/kestra/core/utils/TestsUtils.java
@@ -159,7 +159,6 @@ abstract public class TestsUtils {
             .triggerId(trigger.getId())
             .flowId(flow.getId())
             .namespace(flow.getNamespace())
-            .flowRevision(flow.getRevision())
             .date(ZonedDateTime.now())
             .build();