Repository: kestra-io/kestra
Issue: Deprecate scheduleConditions in favor of conditions
Labels: enhancement

### Feature description

can be done as part of Scheduler refactor

Issue comments:

instead of:
```yaml
id: beverage_order
namespace: dev

inputs:
  - name: beverage
    type: STRING
    defaults: coffee

tasks:
  - id: order_beverage
    type: io.kestra.plugin.fs.http.Request
    uri: https://reqres.in/api/products
    method: POST
    contentType: application/json
    formData:
      beverage: "{{inputs.beverage}}"

  - id: set_labels
    type: io.kestra.core.tasks.executions.Labels
    labels:
      date: "{{trigger.date ?? execution.startDate | date('yyyy-MM-dd')}}"
      beverage: "{{inputs.beverage}}"

triggers:
  - id: workday
    type: io.kestra.core.models.triggers.types.Schedule
    cron: "0 9 * * *"
    scheduleConditions:
      - type: io.kestra.core.models.conditions.types.NotCondition
        conditions:
          - type: io.kestra.core.models.conditions.types.WeekendCondition

  - id: weekend
    type: io.kestra.core.models.triggers.types.Schedule
    cron: "0 9 * * *" # every day at 9am
    scheduleConditions:
      - type: io.kestra.core.models.conditions.types.WeekendCondition
    inputs:
      beverage: beer
```

change to this:

```yaml
id: beverage_order
namespace: dev

inputs:
  - name: beverage
    type: STRING
    defaults: coffee

tasks:
  - id: order_beverage
    type: io.kestra.plugin.fs.http.Request
    uri: https://reqres.in/api/products
    method: POST
    contentType: application/json
    formData:
      beverage: "{{inputs.beverage}}"

  - id: set_labels
    type: io.kestra.core.tasks.executions.Labels
    labels:
      date: "{{trigger.date ?? execution.startDate | date('yyyy-MM-dd')}}"
      beverage: "{{inputs.beverage}}"

triggers:
  - id: workday
    type: io.kestra.core.models.triggers.types.Schedule
    cron: "0 9 * * *"
    conditions:
      - type: io.kestra.core.models.conditions.types.NotCondition
        conditions:
          - type: io.kestra.core.models.conditions.types.WeekendCondition

  - id: weekend
    type: io.kestra.core.models.triggers.types.Schedule
    cron: "0 9 * * *" # every day at 9am
    conditions:
      - type: io.kestra.core.models.conditions.types.WeekendCondition
    inputs:
      beverage: beer
```

 

Pull request review comments:
Why do you remove the validation
```suggestion
            if (this.getConditions() != null) {
```

You should use getConditions() everywhere to have the merge of conditions and scheduleConditions
```suggestion
```

I think you just did what this FIXME means ;)
Why do you want to evaluate disabled triggers?
This change should be revert, if we cannot get the nextDate with conditions, we get the next date without evaluating the condition. This is important to avoid evaluating the condition on each second.
I don't understand why you do that here now
Why did you removed this test?
It test the previous backfill
If it shouldnt be evaluated, meaning the executionDate isn't validated by the condition, then we currently do nothing, then the trigger is re-evaluated the next second
So if the currentDate isn't good, we do calculate the next time it should be evaluated again
You did the filtering of disabled triggers earlier :
![image](https://github.com/kestra-io/kestra/assets/37600690/84be2b1f-40a7-48e4-a607-849135b42a6e)

I'm lost with all those evaluations.
I'll trust you on this one, as long as the existing tests pass.
If it's still there the test should stay and be removed when it disapear.

Patch that resolved the issue:
diff --git a/core/src/main/java/io/kestra/core/models/conditions/types/TimeBetweenCondition.java b/core/src/main/java/io/kestra/core/models/conditions/types/TimeBetweenCondition.java
index ee8d9f7121..9c6861fc33 100644
--- a/core/src/main/java/io/kestra/core/models/conditions/types/TimeBetweenCondition.java
+++ b/core/src/main/java/io/kestra/core/models/conditions/types/TimeBetweenCondition.java
@@ -10,11 +10,11 @@
 import io.kestra.core.models.conditions.ScheduleCondition;
 import io.kestra.core.utils.DateUtils;
 import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
 import lombok.*;
 import lombok.experimental.SuperBuilder;
 
 import java.time.OffsetTime;
-import jakarta.validation.constraints.NotNull;
 
 @SuperBuilder
 @ToString
@@ -63,7 +63,7 @@ public class TimeBetweenCondition extends Condition implements ScheduleCondition
     @Override
     public boolean test(ConditionContext conditionContext) throws InternalException {
         String render = conditionContext.getRunContext().render(date, conditionContext.getVariables());
-        OffsetTime currentDate = DateUtils.parseOffsetTime(render);
+        OffsetTime currentDate = DateUtils.parseZonedDateTime(render).toOffsetDateTime().toOffsetTime();
 
         if (this.before != null && this.after != null) {
             return currentDate.isAfter(after) && currentDate.isBefore(before);
diff --git a/core/src/main/java/io/kestra/core/models/triggers/AbstractTrigger.java b/core/src/main/java/io/kestra/core/models/triggers/AbstractTrigger.java
index d20c689929..6aaec25623 100644
--- a/core/src/main/java/io/kestra/core/models/triggers/AbstractTrigger.java
+++ b/core/src/main/java/io/kestra/core/models/triggers/AbstractTrigger.java
@@ -8,6 +8,10 @@
 import io.kestra.core.models.tasks.WorkerGroup;
 import io.micronaut.core.annotation.Introspected;
 import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Pattern;
 import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
@@ -15,10 +19,6 @@
 import org.slf4j.event.Level;
 
 import java.util.List;
-import jakarta.validation.Valid;
-import jakarta.validation.constraints.NotBlank;
-import jakarta.validation.constraints.NotNull;
-import jakarta.validation.constraints.Pattern;
 
 @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "type", visible = true, include = JsonTypeInfo.As.EXISTING_PROPERTY)
 @SuperBuilder
@@ -46,7 +46,7 @@ abstract public class AbstractTrigger {
     @Schema(
         title = "List of conditions in order to limit the flow trigger."
     )
-    private List<Condition> conditions;
+    protected List<Condition> conditions;
 
     @NotNull
     @Builder.Default
diff --git a/core/src/main/java/io/kestra/core/models/triggers/types/Schedule.java b/core/src/main/java/io/kestra/core/models/triggers/types/Schedule.java
index e3586b4c31..86cd22da83 100644
--- a/core/src/main/java/io/kestra/core/models/triggers/types/Schedule.java
+++ b/core/src/main/java/io/kestra/core/models/triggers/types/Schedule.java
@@ -10,6 +10,7 @@
 import io.kestra.core.models.annotations.Example;
 import io.kestra.core.models.annotations.Plugin;
 import io.kestra.core.models.annotations.PluginProperty;
+import io.kestra.core.models.conditions.Condition;
 import io.kestra.core.models.conditions.ConditionContext;
 import io.kestra.core.models.conditions.ScheduleCondition;
 import io.kestra.core.models.executions.Execution;
@@ -19,6 +20,7 @@
 import io.kestra.core.runners.RunContext;
 import io.kestra.core.runners.RunnerUtils;
 import io.kestra.core.services.ConditionService;
+import io.kestra.core.utils.ListUtils;
 import io.kestra.core.validations.CronExpression;
 import io.kestra.core.validations.TimezoneId;
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -34,6 +36,7 @@
 import java.time.ZonedDateTime;
 import java.time.temporal.ChronoUnit;
 import java.util.*;
+import java.util.stream.Stream;
 
 @Slf4j
 @SuperBuilder
@@ -41,7 +44,6 @@
 @EqualsAndHashCode
 @Getter
 @NoArgsConstructor
-@io.kestra.core.validations.Schedule
 @Schema(
     title = "Schedule a flow based on a CRON expression.",
     description = "You can add multiple schedule(s) to a flow.\n" +
@@ -86,7 +88,7 @@
                 "triggers:",
                 "  - id: schedule",
                 "    cron: \"0 11 * * 1\"",
-                "    scheduleConditions:",
+                "    conditions:",
                 "      - type: io.kestra.core.models.conditions.types.DayWeekInMonthCondition",
                 "        date: \"{{ trigger.date }}\"",
                 "        dayOfWeek: \"MONDAY\"",
@@ -167,9 +169,11 @@ public class Schedule extends AbstractTrigger implements PollingTriggerInterface
 
     @Valid
     @Schema(
-        title = "List of schedule conditions in order to limit the schedule trigger date."
+        title = "(Deprecated) Conditions on date. Use `conditions` instead.",
+        description = "List of schedule conditions in order to limit the schedule trigger date."
     )
     @PluginProperty
+    @Deprecated
     private List<ScheduleCondition> scheduleConditions;
 
     @Schema(
@@ -204,6 +208,13 @@ public class Schedule extends AbstractTrigger implements PollingTriggerInterface
     @PluginProperty
     private RecoverMissedSchedules recoverMissedSchedules;
 
+    @Override
+    public List<Condition> getConditions() {
+        List<Condition> conditions = Stream.concat(ListUtils.emptyOnNull(this.conditions).stream(),
+            ListUtils.emptyOnNull(this.scheduleConditions).stream().map(c -> (Condition) c)).toList();
+        return conditions.isEmpty() ? null : conditions;
+    }
+
     @Override
     public ZonedDateTime nextEvaluationDate(ConditionContext conditionContext, Optional<? extends TriggerContext> last) {
         ExecutionTime executionTime = this.executionTime();
@@ -218,8 +229,8 @@ public ZonedDateTime nextEvaluationDate(ConditionContext conditionContext, Optio
                 lastDate = convertDateTime(last.get().getDate());
             }
 
-            // previous present & scheduleConditions
-            if (this.scheduleConditions != null) {
+            // previous present & conditions
+            if (this.getConditions() != null) {
                 try {
                     Optional<ZonedDateTime> next = this.truePreviousNextDateWithCondition(
                         executionTime,
@@ -236,7 +247,7 @@ public ZonedDateTime nextEvaluationDate(ConditionContext conditionContext, Optio
                 }
             }
 
-            // previous present but no scheduleConditions
+            // previous present but no conditions
             nextDate = computeNextEvaluationDate(executionTime, lastDate).orElse(null);
 
             // if we have a current backfill but the nextDate
@@ -274,7 +285,7 @@ public ZonedDateTime nextEvaluationDate() {
 
     public ZonedDateTime previousEvaluationDate(ConditionContext conditionContext) {
         ExecutionTime executionTime = this.executionTime();
-        if (this.scheduleConditions != null) {
+        if (this.getConditions() != null) {
             try {
                 Optional<ZonedDateTime> previous = this.truePreviousNextDateWithCondition(
                     executionTime,
@@ -327,9 +338,8 @@ public Optional<Execution> evaluate(ConditionContext conditionContext, TriggerCo
         // inject outputs variables for scheduleCondition
         conditionContext = conditionContext(conditionContext, scheduleDates);
 
-        // FIXME make scheduleConditions generic
-        // control scheduleConditions
-        if (scheduleConditions != null) {
+        // control conditions
+        if (this.getConditions() != null) {
             try {
                 boolean conditionResults = this.validateScheduleCondition(conditionContext);
                 if (!conditionResults) {
@@ -551,10 +561,10 @@ private Output handleMaxDelay(Output output) {
     }
 
     private boolean validateScheduleCondition(ConditionContext conditionContext) throws InternalException {
-        if (scheduleConditions != null) {
+        if (conditions != null) {
             ConditionService conditionService = conditionContext.getRunContext().getApplicationContext().getBean(ConditionService.class);
             return conditionService.isValid(
-                scheduleConditions,
+                conditions.stream().filter(c -> c instanceof ScheduleCondition).map(c -> (ScheduleCondition) c).toList(),
                 conditionContext
             );
         }
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 b6b1dc0f8a..16de0acbc5 100644
--- a/core/src/main/java/io/kestra/core/schedulers/AbstractScheduler.java
+++ b/core/src/main/java/io/kestra/core/schedulers/AbstractScheduler.java
@@ -1,6 +1,7 @@
 package io.kestra.core.schedulers;
 
 import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableMap;
 import io.kestra.core.exceptions.InternalException;
 import io.kestra.core.metrics.MetricRegistry;
 import io.kestra.core.models.conditions.Condition;
@@ -12,7 +13,6 @@
 import io.kestra.core.models.triggers.AbstractTrigger;
 import io.kestra.core.models.triggers.PollingTriggerInterface;
 import io.kestra.core.models.triggers.Trigger;
-import io.kestra.core.models.triggers.TriggerContext;
 import io.kestra.core.models.triggers.types.Schedule;
 import io.kestra.core.queues.QueueFactoryInterface;
 import io.kestra.core.queues.QueueInterface;
@@ -252,34 +252,38 @@ private List<FlowWithTriggers> computeSchedulable(List<Flow> flows, List<Trigger
                     RunContext runContext = runContextFactory.of(flow, abstractTrigger);
                     ConditionContext conditionContext = conditionService.conditionContext(runContext, flow, null);
                     Trigger triggerContext = null;
-                    try {
-                        Trigger lastTrigger = triggerContextsToEvaluate
-                            .stream()
-                            .filter(triggerContextToFind -> triggerContextToFind.uid().equals(Trigger.uid(flow, abstractTrigger)))
-                            .findFirst()
-                            .orElse(null);
-                        // If a trigger is not found in triggers to evaluate, then we ignore it
-                        if (lastTrigger == null) {
-                            return null;
-                            // Backwards compatibility: we add a next execution date that we compute, this avoids re-triggering all existing triggers
-                        } else if (lastTrigger.getNextExecutionDate() == null) {
+                    Trigger lastTrigger = triggerContextsToEvaluate
+                        .stream()
+                        .filter(triggerContextToFind -> triggerContextToFind.uid().equals(Trigger.uid(flow, abstractTrigger)))
+                        .findFirst()
+                        .orElse(null);
+                    // If a trigger is not found in triggers to evaluate, then we ignore it
+                    if (lastTrigger == null) {
+                        return null;
+                        // Backwards compatibility: we add a next execution date that we compute, this avoids re-triggering all existing triggers
+                    } else if (lastTrigger.getNextExecutionDate() == null) {
+                        try {
                             triggerContext = lastTrigger.toBuilder()
                                 .nextExecutionDate(((PollingTriggerInterface) abstractTrigger).nextEvaluationDate(conditionContext, Optional.of(lastTrigger)))
                                 .build();
-                            this.triggerState.save(triggerContext, scheduleContext);
-                        } else {
-                            triggerContext = lastTrigger;
+                        } catch (Exception e) {
+                            logError(conditionContext, flow, abstractTrigger, e);
+                            return null;
                         }
-                    } catch (Exception e) {
-                        logError(conditionContext, flow, abstractTrigger, e);
-                        return null;
+                        this.triggerState.save(triggerContext, scheduleContext);
+                    } else {
+                        triggerContext = lastTrigger;
                     }
                     return new FlowWithTriggers(
                         flow,
                         abstractTrigger,
                         triggerContext,
                         runContext,
-                        conditionService.conditionContext(runContext, flow, null)
+                        conditionContext.withVariables(
+                            ImmutableMap.of("trigger",
+                                ImmutableMap.of("date", triggerContext.getNextExecutionDate() != null ?
+                                    triggerContext.getNextExecutionDate() : now())
+                            ))
                     );
                 })
             )
@@ -332,18 +336,9 @@ private void handle() {
                     .conditionContext(flowWithTriggers.getConditionContext())
                     .triggerContext(flowWithTriggers.TriggerContext.toBuilder().date(now()).stopAfter(flowWithTriggers.getAbstractTrigger().getStopAfter()).build())
                     .build())
-                .filter(f -> f.getTriggerContext().getEvaluateRunningDate() == null && !f.getTriggerContext().getDisabled())
+                .filter(f -> f.getTriggerContext().getEvaluateRunningDate() == null)
                 .filter(this::isExecutionNotRunning)
-                .map(f -> {
-                    try {
-
-                        return FlowWithPollingTriggerNextDate.of(f);
-                    } catch (Exception e) {
-                        logError(f, e);
-
-                        return null;
-                    }
-                })
+                .map(FlowWithPollingTriggerNextDate::of)
                 .filter(Objects::nonNull)
                 .toList();
 
@@ -388,7 +383,8 @@ private void handle() {
                                         e
                                     );
                                 }
-                            } else if (f.getPollingTrigger() instanceof Schedule schedule) {
+                            }
+                            else if (f.getPollingTrigger() instanceof Schedule schedule) {
                                 // This is the Schedule, all other triggers should have an interval.
                                 // So we evaluate it now as there is no need to send it to the worker.
                                 // Schedule didn't use the triggerState to allow backfill.
@@ -412,8 +408,17 @@ private void handle() {
                                     "Polling trigger must have an interval (except the Schedule)"
                                 );
                             }
+                        } else {
+                            ZonedDateTime nextExecutionDate = null;
+                            try {
+                                nextExecutionDate = f.getPollingTrigger().nextEvaluationDate(f.getConditionContext(), Optional.of(f.getTriggerContext()));
+                            } catch (Exception e) {
+                                logError(f, e);
+                            }
+                            var trigger = f.getTriggerContext().toBuilder().nextExecutionDate(nextExecutionDate).build().checkBackfill();
+                            this.triggerState.save(trigger, scheduleContext);
                         }
-                    } catch(InternalException ie) {
+                    } catch (InternalException ie) {
                         // validate schedule condition can fail to render variables
                         // in this case, we send a failed execution so the trigger is not evaluated each second.
                         logger.error("Unable to evaluate the trigger '{}'", f.getAbstractTrigger().getId(), ie);
diff --git a/core/src/main/java/io/kestra/core/validations/Schedule.java b/core/src/main/java/io/kestra/core/validations/Schedule.java
deleted file mode 100644
index 84987a62e1..0000000000
--- a/core/src/main/java/io/kestra/core/validations/Schedule.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package io.kestra.core.validations;
-
-import io.kestra.core.validations.validator.ScheduleValidator;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import jakarta.validation.Constraint;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = ScheduleValidator.class)
-public @interface Schedule {
-    String message() default "invalid schedule ({validatedValue})";
-}
\ No newline at end of file
diff --git a/core/src/main/java/io/kestra/core/validations/validator/ScheduleValidator.java b/core/src/main/java/io/kestra/core/validations/validator/ScheduleValidator.java
deleted file mode 100644
index 2e16ec732c..0000000000
--- a/core/src/main/java/io/kestra/core/validations/validator/ScheduleValidator.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.kestra.core.validations.validator;
-
-import io.kestra.core.validations.Schedule;
-import io.micronaut.core.annotation.AnnotationValue;
-import io.micronaut.core.annotation.Introspected;
-import io.micronaut.core.annotation.NonNull;
-import io.micronaut.core.annotation.Nullable;
-import io.micronaut.validation.validator.constraints.ConstraintValidator;
-import io.micronaut.validation.validator.constraints.ConstraintValidatorContext;
-import jakarta.inject.Singleton;
-
-@Singleton
-@Introspected
-public class ScheduleValidator  implements ConstraintValidator<Schedule, io.kestra.core.models.triggers.types.Schedule> {
-    @Override
-    public boolean isValid(
-        @Nullable io.kestra.core.models.triggers.types.Schedule value,
-        @NonNull AnnotationValue<Schedule> annotationMetadata,
-        @NonNull ConstraintValidatorContext context) {
-        if (value == null) {
-            return true;
-        }
-
-        return true;
-    }
-}


Test patch:
diff --git a/core/src/test/java/io/kestra/core/models/conditions/types/TimeBetweenConditionTest.java b/core/src/test/java/io/kestra/core/models/conditions/types/TimeBetweenConditionTest.java
index 92d7b3a47f..cf704d0b54 100644
--- a/core/src/test/java/io/kestra/core/models/conditions/types/TimeBetweenConditionTest.java
+++ b/core/src/test/java/io/kestra/core/models/conditions/types/TimeBetweenConditionTest.java
@@ -25,11 +25,11 @@ class TimeBetweenConditionTest {
 
     static Stream<Arguments> source() {
         return Stream.of(
-            Arguments.of(OffsetTime.parse("16:19:12.000000+02:00").toString(), null, OffsetTime.parse("16:19:11.000000+02:00").toString(), true),
-            Arguments.of(OffsetTime.parse("16:19:12.000000+02:00").toString(), null, OffsetTime.parse("17:19:12.000000+02:00").toString(), false),
-            Arguments.of(OffsetTime.parse("16:19:12.000000+02:00").toString(), OffsetTime.parse("16:20:12.000000+02:00"), OffsetTime.parse("16:18:12.000000+02:00"), true),
-            Arguments.of(OffsetTime.parse("16:19:12.000000+02:00").toString(), OffsetTime.parse("16:20:12.000000+02:00"), null, true),
-            Arguments.of(OffsetTime.parse("16:19:12.000000+02:00").toString(), OffsetTime.parse("16:18:12.000000+02:00"), null, false)
+            Arguments.of(ZonedDateTime.parse("2024-02-21T16:19:12.00+02:00").toString(), null, OffsetTime.parse("16:19:11.000000+02:00").toString(), true),
+            Arguments.of(ZonedDateTime.parse("2024-02-21T16:19:12.00+02:00").toString(), null, OffsetTime.parse("17:19:12.000000+02:00").toString(), false),
+            Arguments.of(ZonedDateTime.parse("2024-02-21T16:19:12.00+02:00").toString(), OffsetTime.parse("16:20:12.000000+02:00"), OffsetTime.parse("16:18:12.000000+02:00"), true),
+            Arguments.of(ZonedDateTime.parse("2024-02-21T16:19:12.00+02:00").toString(), OffsetTime.parse("16:20:12.000000+02:00"), null, true),
+            Arguments.of(ZonedDateTime.parse("2024-02-21T16:19:12.00+02:00").toString(), OffsetTime.parse("16:18:12.000000+02:00"), null, false)
         );
     }
 
diff --git a/core/src/test/java/io/kestra/core/models/triggers/types/ScheduleTest.java b/core/src/test/java/io/kestra/core/models/triggers/types/ScheduleTest.java
index 2b7543eb86..e0de7f3eac 100644
--- a/core/src/test/java/io/kestra/core/models/triggers/types/ScheduleTest.java
+++ b/core/src/test/java/io/kestra/core/models/triggers/types/ScheduleTest.java
@@ -3,7 +3,6 @@
 import io.kestra.core.models.Label;
 import io.kestra.core.models.conditions.ConditionContext;
 import io.kestra.core.models.conditions.types.DateTimeBetweenCondition;
-import io.kestra.core.models.conditions.types.DayWeekCondition;
 import io.kestra.core.models.conditions.types.DayWeekInMonthCondition;
 import io.kestra.core.models.executions.Execution;
 import io.kestra.core.models.flows.Flow;
@@ -18,10 +17,12 @@
 import jakarta.inject.Inject;
 import org.junit.jupiter.api.Test;
 
-import java.time.*;
+import java.time.DayOfWeek;
+import java.time.Duration;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
-import java.time.temporal.TemporalUnit;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -209,7 +210,7 @@ void conditions() throws Exception {
             .id("schedule")
             .cron("0 12 * * 1")
             .timezone("Europe/Paris")
-            .scheduleConditions(List.of(
+            .conditions(List.of(
                 DayWeekInMonthCondition.builder()
                     .dayOfWeek(DayOfWeek.MONDAY)
                     .dayInMonth(DayWeekInMonthCondition.DayInMonth.FIRST)
@@ -242,7 +243,7 @@ void impossibleNextConditions() throws Exception {
             .id("schedule")
             .cron("0 12 * * 1")
             .timezone("Europe/Paris")
-            .scheduleConditions(List.of(
+            .conditions(List.of(
                 DateTimeBetweenCondition.builder()
                     .before(ZonedDateTime.parse("2021-08-03T12:00:00+02:00"))
                     .date("{{ trigger.date }}")
@@ -266,50 +267,6 @@ void impossibleNextConditions() throws Exception {
         assertThat(vars.containsKey("next"), is(false));
     }
 
-    @SuppressWarnings("unchecked")
-    @Test
-    void conditionsWithBackfill() throws Exception {
-        Schedule trigger = Schedule.builder()
-            .id("schedule")
-            .cron("0 12 * * 1")
-            .timezone("Europe/Paris")
-//            .backfill(Schedule.ScheduleBackfill.builder()
-//                .start(ZonedDateTime.parse("2021-01-01T00:00:00+02:00"))
-//                .build()
-//            )
-            .scheduleConditions(List.of(
-                DayWeekInMonthCondition.builder()
-                    .dayOfWeek(DayOfWeek.MONDAY)
-                    .dayInMonth(DayWeekInMonthCondition.DayInMonth.FIRST)
-                    .date("{{ trigger.date }}")
-                    .build(),
-                DateTimeBetweenCondition.builder()
-                    .before(ZonedDateTime.parse("2021-05-01T12:00:00+02:00"))
-                    .date("{{ trigger.date }}")
-                    .build()
-            ))
-            .build();
-
-        ZonedDateTime date = ZonedDateTime.parse("2021-01-04T12:00:00+01:00");
-
-        for (int i = 0; i < 4; i++) {
-            Optional<Execution> evaluate = trigger.evaluate(
-                conditionContext(trigger),
-                triggerContext(date, trigger)
-            );
-
-            assertThat(evaluate.isPresent(), is(true));
-
-            var vars = (Map<String, String>) evaluate.get().getVariables().get("schedule");
-            assertThat(dateFromVars(vars.get("date"), date), is(date));
-            if (i == 3) {
-                assertThat(vars.containsKey("next"), is(false));
-            } else {
-                date = dateFromVars(vars.get("next"), date);
-            }
-        }
-    }
-
     @SuppressWarnings("unchecked")
     @Test
     void lateMaximumDelay() throws Exception {
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 d32cf8a0bf..bad4b6a2b2 100644
--- a/core/src/test/java/io/kestra/core/schedulers/SchedulerConditionTest.java
+++ b/core/src/test/java/io/kestra/core/schedulers/SchedulerConditionTest.java
@@ -40,7 +40,7 @@ private static Flow createScheduleFlow() {
             .inputs(Map.of(
                 "testInputs", "test-inputs"
             ))
-            .scheduleConditions(List.of(
+            .conditions(List.of(
                 DayWeekInMonthCondition.builder()
                     .type(DayWeekInMonthCondition.class.getName())
                     .date("{{ trigger.date }}")
@@ -94,7 +94,6 @@ void schedule() throws Exception {
                 assertThat(execution.getFlowId(), is(flow.getId()));
             });
 
-            worker.run();
             scheduler.run();
             queueCount.await(15, TimeUnit.SECONDS);
             // needed for RetryingTest to work since there is no context cleaning between method => we have to clear assertion receiver manually
diff --git a/core/src/test/java/io/kestra/core/schedulers/SchedulerScheduleTest.java b/core/src/test/java/io/kestra/core/schedulers/SchedulerScheduleTest.java
index 985c8bb252..122626935e 100644
--- a/core/src/test/java/io/kestra/core/schedulers/SchedulerScheduleTest.java
+++ b/core/src/test/java/io/kestra/core/schedulers/SchedulerScheduleTest.java
@@ -11,8 +11,6 @@
 import io.kestra.core.queues.QueueFactoryInterface;
 import io.kestra.core.queues.QueueInterface;
 import io.kestra.core.runners.FlowListeners;
-import io.kestra.core.runners.TestMethodScopedWorker;
-import io.kestra.core.runners.Worker;
 import io.kestra.core.utils.Await;
 import jakarta.inject.Inject;
 import jakarta.inject.Named;
@@ -463,7 +461,7 @@ void failedEvaluationTest() {
         // mock flow listeners
         FlowListeners flowListenersServiceSpy = spy(this.flowListenersService);
         Schedule schedule = createScheduleTrigger("Europe/Paris", "* * * * *", "failedEvaluation", false)
-            .scheduleConditions(
+            .conditions(
                 List.of(
                     VariableCondition.builder()
                         .type(VariableCondition.class.getName())