Skip to content

Commit f119a39

Browse files
authored
refactor: remove task references in favour to change (#886)
1 parent 8a6f0e8 commit f119a39

File tree

248 files changed

+2303
-2444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

248 files changed

+2303
-2444
lines changed

CLAUDE.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ This is a multi-module Gradle project using Kotlin DSL.
141141
- AuditStore initialization requires full hierarchical context for dependency resolution
142142

143143
**Plugin System**: Extensible architecture via `Plugin` interface:
144-
- Contribute task filters, event publishers, and dependency contexts
144+
- Contribute change filters, event publishers, and dependency contexts
145145
- Platform plugins (e.g., `flamingock-springboot-integration`) provide framework integration
146146
- Initialized after base context setup but before hierarchical context building
147147

@@ -339,24 +339,24 @@ YAML File
339339
ChangeTemplateFileContent
340340
↓ (preview building)
341341
TemplatePreviewChange (unified)
342-
↓ (loaded task building - template lookup from registry)
342+
↓ (loaded change building - template lookup from registry)
343343
AbstractTemplateLoadedChange
344344
├── SimpleTemplateLoadedChange (for AbstractSimpleTemplate)
345345
└── SteppableTemplateLoadedChange (for AbstractSteppableTemplate)
346346
↓ (execution preparation)
347-
TemplateExecutableTask<T>
348-
├── SimpleTemplateExecutableTask (calls setStep())
349-
└── SteppableTemplateExecutableTask (calls setSteps())
347+
TemplateExecutableChange<T>
348+
├── SimpleTemplateExecutableChange (calls setStep())
349+
└── SteppableTemplateExecutableChange (calls setSteps())
350350
↓ (runtime execution)
351351
Template instance with injected dependencies
352352
```
353353

354354
**Key Classes in Flow**:
355355
- `ChangeTemplateFileContent` - YAML parsed data (`core/flamingock-core-commons`)
356-
- `TemplatePreviewTaskBuilder` - Builds preview from file content (`core/flamingock-core-commons`)
357-
- `TemplateLoadedTaskBuilder` - Resolves template class, builds type-specific loaded change (`core/flamingock-core`)
358-
- `TemplateExecutableTaskBuilder` - Builds type-specific executable task (`core/flamingock-core`)
359-
- `TemplateExecutableTask<T>` - Abstract base for template execution (`core/flamingock-core`)
356+
- `TemplatePreviewChangeBuilder` - Builds preview from file content (`core/flamingock-core-commons`)
357+
- `TemplateLoadedChangeBuilder` - Resolves template class, builds type-specific loaded change (`core/flamingock-core`)
358+
- `TemplateExecutableChangeBuilder` - Builds type-specific executable change (`core/flamingock-core`)
359+
- `TemplateExecutableChange<T>` - Abstract base for template execution (`core/flamingock-core`)
360360

361361
### Discovery Mechanism (SPI)
362362

@@ -444,20 +444,20 @@ AbstractTemplateLoadedChange (abstract base)
444444

445445
**Executable Phase:**
446446
```
447-
TemplateExecutableTask<T> (abstract base)
448-
├── SimpleTemplateExecutableTask (calls setStep())
449-
└── SteppableTemplateExecutableTask (calls setSteps())
447+
TemplateExecutableChange<T> (abstract base)
448+
├── SimpleTemplateExecutableChange (calls setStep())
449+
└── SteppableTemplateExecutableChange (calls setSteps())
450450
```
451451

452-
**Type Detection:** Happens in `TemplateLoadedTaskBuilder.build()` using:
452+
**Type Detection:** Happens in `TemplateLoadedChangeBuilder.build()` using:
453453
- `AbstractSteppableTemplate.class.isAssignableFrom(templateClass)` → SteppableTemplateLoadedChange
454454
- Otherwise → SimpleTemplateLoadedChange (default for AbstractSimpleTemplate and unknown types)
455455

456456
**Note:** Preview phase (`TemplatePreviewChange`) remains unified since YAML is parsed before template type is known.
457457

458-
### SteppableTemplateExecutableTask Apply/Rollback Lifecycle
458+
### SteppableTemplateExecutableChange Apply/Rollback Lifecycle
459459

460-
The `SteppableTemplateExecutableTask` manages multi-step execution with per-step rollback:
460+
The `SteppableTemplateExecutableChange` manages multi-step execution with per-step rollback:
461461

462462
**Apply Phase:**
463463
- Iterates through steps in order (0 → N-1)
@@ -471,7 +471,7 @@ The `SteppableTemplateExecutableTask` manages multi-step execution with per-step
471471
- **Skips steps without rollback payload** (`hasRollback()` returns false)
472472
- **Skips if template has no `@Rollback` method** (logs warning)
473473

474-
**Key Design Decision:** Same `SteppableTemplateExecutableTask` instance is used for both apply and rollback (no retry). The `stepIndex` state persists to enable rollback from the exact failure point.
474+
**Key Design Decision:** Same `SteppableTemplateExecutableChange` instance is used for both apply and rollback (no retry). The `stepIndex` state persists to enable rollback from the exact failure point.
475475

476476
### Dependency Injection in Templates
477477

RECOVERY_EXAMPLE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ stages:
9696
The recovery strategy is available throughout the execution pipeline:
9797
9898
```java
99-
// In ExecutableTask (available during execution)
100-
ExecutableTask task = // ... get from pipeline
99+
// In ExecutableChange (available during execution)
100+
ExecutableChange task = // ... get from pipeline
101101
RecoveryDescriptor recovery = task.getRecovery();
102102
RecoveryStrategy strategy = recovery.getStrategy();
103103

cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/request/AuditEntryRequest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
public class AuditEntryRequest {
2424

25+
private String changeId;
2526
private String stageId;
26-
private String taskId;
2727
private String author;
2828
private long appliedAtEpochMillis;
2929
private CloudAuditStatus state;
@@ -45,7 +45,7 @@ public AuditEntryRequest() {
4545
}
4646

4747
public AuditEntryRequest(String stageId,
48-
String taskId,
48+
String changeId,
4949
String author,
5050
long appliedAtEpochMillis,
5151
CloudAuditStatus state,
@@ -63,7 +63,7 @@ public AuditEntryRequest(String stageId,
6363
CloudRecoveryStrategy recoveryStrategy,
6464
Boolean transactionFlag) {
6565
this.stageId = stageId;
66-
this.taskId = taskId;
66+
this.changeId = changeId;
6767
this.author = author;
6868
this.appliedAtEpochMillis = appliedAtEpochMillis;
6969
this.state = state;
@@ -87,8 +87,8 @@ public String getStageId() {
8787
return stageId;
8888
}
8989

90-
public String getTaskId() {
91-
return taskId;
90+
public String getChangeId() {
91+
return changeId;
9292
}
9393

9494
public String getAuthor() {

cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/request/ChangeRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class ChangeRequest {
3030
public ChangeRequest() {
3131
}
3232

33-
public static ChangeRequest task(String id, boolean transactional) {
33+
public static ChangeRequest change(String id, boolean transactional) {
3434
return new ChangeRequest(id, CloudTargetSystemAuditMarkType.NONE, transactional);
3535
}
3636

cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/request/StageRequest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ public class StageRequest {
2222

2323
private int order;
2424

25-
private List<ChangeRequest> tasks;
25+
private List<ChangeRequest> changes;
2626

2727
public StageRequest() {
2828
}
2929

30-
public StageRequest(String name, int order, List<ChangeRequest> tasks) {
30+
public StageRequest(String name, int order, List<ChangeRequest> changes) {
3131
this.name = name;
3232
this.order = order;
33-
this.tasks = tasks;
33+
this.changes = changes;
3434
}
3535

3636
public String getName() {
@@ -41,8 +41,8 @@ public int getOrder() {
4141
return order;
4242
}
4343

44-
public List<ChangeRequest> getTasks() {
45-
return tasks;
44+
public List<ChangeRequest> getChanges() {
45+
return changes;
4646
}
4747

4848
public void setName(String name) {
@@ -53,8 +53,8 @@ public void setOrder(int order) {
5353
this.order = order;
5454
}
5555

56-
public void setTasks(List<ChangeRequest> tasks) {
57-
this.tasks = tasks;
56+
public void setChanges(List<ChangeRequest> changes) {
57+
this.changes = changes;
5858
}
5959

6060
@Override
@@ -64,11 +64,11 @@ public boolean equals(Object o) {
6464
StageRequest that = (StageRequest) o;
6565
return order == that.order
6666
&& java.util.Objects.equals(name, that.name)
67-
&& java.util.Objects.equals(tasks, that.tasks);
67+
&& java.util.Objects.equals(changes, that.changes);
6868
}
6969

7070
@Override
7171
public int hashCode() {
72-
return java.util.Objects.hash(name, order, tasks);
72+
return java.util.Objects.hash(name, order, changes);
7373
}
7474
}

cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/response/StageResponse.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ public class StageResponse {
2222

2323
private int order;
2424

25-
private List<ChangeResponse> tasks;
25+
private List<ChangeResponse> changes;
2626

2727
public StageResponse() {
2828
}
2929

30-
public StageResponse(String name, int order, List<ChangeResponse> tasks) {
30+
public StageResponse(String name, int order, List<ChangeResponse> changes) {
3131
this.name = name;
3232
this.order = order;
33-
this.tasks = tasks;
33+
this.changes = changes;
3434
}
3535

3636
public String getName() {
@@ -41,12 +41,12 @@ public void setName(String name) {
4141
this.name = name;
4242
}
4343

44-
public List<ChangeResponse> getTasks() {
45-
return tasks;
44+
public List<ChangeResponse> getChanges() {
45+
return changes;
4646
}
4747

48-
public void setTasks(List<ChangeResponse> tasks) {
49-
this.tasks = tasks;
48+
public void setChanges(List<ChangeResponse> changes) {
49+
this.changes = changes;
5050
}
5151

5252
public int getOrder() {
@@ -64,11 +64,11 @@ public boolean equals(Object o) {
6464
StageResponse that = (StageResponse) o;
6565
return order == that.order
6666
&& java.util.Objects.equals(name, that.name)
67-
&& java.util.Objects.equals(tasks, that.tasks);
67+
&& java.util.Objects.equals(changes, that.changes);
6868
}
6969

7070
@Override
7171
public int hashCode() {
72-
return java.util.Objects.hash(name, order, tasks);
72+
return java.util.Objects.hash(name, order, changes);
7373
}
7474
}

cloud/flamingock-cloud-api/src/main/java/io/flamingock/cloud/api/vo/CloudChangeAction.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@
1818

1919
/**
2020
* Represents the cloud orchestrator's decision about what action should be taken
21-
* for a specific task. This enum maintains separation from the internal ChangeAction
21+
* for a specific change. This enum maintains separation from the internal ChangeAction
2222
* to preserve cloud domain boundaries while keeping aligned enum values.
2323
*/
2424
public enum CloudChangeAction {
2525

2626
/**
27-
* The task needs to be applied/applied - cloud orchestrator determined it should run.
27+
* The change needs to be applied/applied - cloud orchestrator determined it should run.
2828
* Maps to ChangeAction.APPLY.
2929
*/
3030
APPLY,
3131

3232
/**
33-
* The task should be skipped as it has already been successfully applied.
33+
* The change should be skipped as it has already been successfully applied.
3434
* Maps to ChangeAction.SKIP.
3535
*/
3636
SKIP,
3737

3838
/**
39-
* Manual intervention is required for this task.
39+
* Manual intervention is required for this change.
4040
* Maps to ChangeAction.MANUAL_INTERVENTION.
4141
*/
4242
MANUAL_INTERVENTION

cloud/flamingock-cloud/src/main/java/io/flamingock/cloud/audit/HtttpAuditWriter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public HtttpAuditWriter(String host,
5656
this.runnerId = runnerId;
5757

5858
this.pathTemplate = String.format(
59-
"/api/%s/environment/%s/service/%s/execution/{executionId}/task/{taskId}/audit",
59+
"/api/%s/environment/%s/service/%s/execution/{executionId}/change/{changeId}/audit",
6060
apiVersion,
6161
environmentId.toString(),
6262
serviceId.toString());
@@ -74,12 +74,12 @@ public Result writeEntry(AuditEntry auditEntry) {
7474
.withRunnerId(runnerId)
7575
.withBearerToken(authManager.getJwtToken())
7676
.addPathParameter("executionId", auditEntry.getExecutionId())
77-
.addPathParameter("taskId", auditEntry.getTaskId())
77+
.addPathParameter("changeId", auditEntry.getChangeId())
7878
.setBody(auditEntryRequest)
7979
.execute();
8080
return Result.OK();
8181
} catch (Throwable throwable) {
82-
logger.debug("Error writing audit [{}] :\n{}", auditEntry.getTaskId(), throwable.toString());
82+
logger.debug("Error writing audit [{}] :\n{}", auditEntry.getChangeId(), throwable.toString());
8383
return new Result.Error(throwable);
8484
}
8585

@@ -91,7 +91,7 @@ private AuditEntryRequest buildRequest(AuditEntry auditEntry) {
9191
CloudTxStrategy txType = auditEntry.getTxType() != null ? CloudApiMapper.toCloud(auditEntry.getTxType()) : null;
9292
return new AuditEntryRequest(
9393
auditEntry.getStageId(),
94-
auditEntry.getTaskId(),
94+
auditEntry.getChangeId(),
9595
auditEntry.getAuthor(),
9696
appliedAtEpochMillis,
9797
CloudApiMapper.toCloud(auditEntry.getState()),

cloud/flamingock-cloud/src/main/java/io/flamingock/cloud/planner/CloudExecutionPlanMapper.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
import io.flamingock.internal.core.external.store.lock.LockKey;
3636
import io.flamingock.internal.core.pipeline.execution.ExecutableStage;
3737
import io.flamingock.internal.core.pipeline.loaded.stage.AbstractLoadedStage;
38-
import io.flamingock.internal.common.core.task.TaskDescriptor;
39-
import io.flamingock.internal.core.task.loaded.AbstractLoadedTask;
38+
import io.flamingock.internal.common.core.change.ChangeDescriptor;
39+
import io.flamingock.internal.core.change.loaded.AbstractLoadedChange;
4040
import org.jetbrains.annotations.NotNull;
4141

4242
import java.util.ArrayList;
@@ -58,19 +58,19 @@ public static ExecutionPlanRequest toRequest(List<AbstractLoadedStage> loadedSta
5858
List<StageRequest> requestStages = new ArrayList<>(loadedStages.size());
5959
for (int i = 0; i < loadedStages.size(); i++) {
6060
AbstractLoadedStage currentStage = loadedStages.get(i);
61-
List<ChangeRequest> stageTasks = currentStage
62-
.getTasks()
61+
List<ChangeRequest> stageChanges = currentStage
62+
.getChanges()
6363
.stream()
6464
.map(descriptor -> CloudExecutionPlanMapper.mapToChangeRequest(descriptor, ongoingStatusesMap))
6565
.collect(Collectors.toList());
66-
requestStages.add(new StageRequest(currentStage.getName(), i, stageTasks));
66+
requestStages.add(new StageRequest(currentStage.getName(), i, stageChanges));
6767
}
6868

6969
return new ExecutionPlanRequest(lockAcquiredForMillis, requestStages);
7070
}
7171

72-
private static ChangeRequest mapToChangeRequest(AbstractLoadedTask descriptor,
73-
Map<String, TargetSystemAuditMarkType> ongoingStatusesMap) {
72+
private static ChangeRequest mapToChangeRequest(AbstractLoadedChange descriptor,
73+
Map<String, TargetSystemAuditMarkType> ongoingStatusesMap) {
7474
TargetSystemAuditMarkType domainStatus = ongoingStatusesMap.get(descriptor.getId());
7575
CloudTargetSystemAuditMarkType cloudStatus = domainStatus != null
7676
? CloudApiMapper.toCloud(domainStatus)
@@ -96,29 +96,29 @@ static List<ExecutableStage> getExecutableStages(ExecutionPlanResponse response,
9696
}
9797

9898
private static ExecutableStage mapToExecutable(AbstractLoadedStage loadedStage, StageResponse stageResponse) {
99-
Map<String, CloudChangeAction> taskStateMap = stageResponse.getTasks()
99+
Map<String, CloudChangeAction> changeStateMap = stageResponse.getChanges()
100100
.stream()
101101
.collect(Collectors.toMap(ChangeResponse::getId, ChangeResponse::getAction));
102102

103103
// Build action map using anti-corruption layer
104-
ChangeActionMap actionPlan = getChangeActionMap(loadedStage, taskStateMap);
104+
ChangeActionMap actionPlan = getChangeActionMap(loadedStage, changeStateMap);
105105
return loadedStage.applyActions(actionPlan);
106106
}
107107

108108
@NotNull
109109
private static ChangeActionMap getChangeActionMap(AbstractLoadedStage loadedStage, Map<String, CloudChangeAction> actionsMapByChangeId) {
110110
Map<String, ChangeAction> actionMap = new HashMap<>();
111111

112-
for (TaskDescriptor task : loadedStage.getTasks()) {
113-
String taskId = task.getId();
114-
CloudChangeAction cloudAction = actionsMapByChangeId.get(taskId);
112+
for (ChangeDescriptor change : loadedStage.getChanges()) {
113+
String changeId = change.getId();
114+
CloudChangeAction cloudAction = actionsMapByChangeId.get(changeId);
115115

116-
// If task not in response, assume it's already applied (cloud orchestrator decision)
116+
// If change not in response, assume it's already applied (cloud orchestrator decision)
117117
if (cloudAction == null) {
118-
actionMap.put(taskId, ChangeAction.SKIP);
118+
actionMap.put(changeId, ChangeAction.SKIP);
119119
} else {
120120
// Use anti-corruption layer to map cloud domain to internal domain
121-
actionMap.put(taskId, mapCloudActionToChangeAction(cloudAction));
121+
actionMap.put(changeId, mapCloudActionToChangeAction(cloudAction));
122122
}
123123
}
124124

cloud/flamingock-cloud/src/main/java/io/flamingock/cloud/planner/CloudExecutionPlanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ private ExecutionPlanResponse createExecution(List<AbstractLoadedStage> loadedSt
133133

134134
Map<String, TargetSystemAuditMarkType> auditMarks = getOngoingStatuses()
135135
.stream()
136-
.collect(Collectors.toMap(TargetSystemAuditMark::getTaskId, TargetSystemAuditMark::getOperation));
136+
.collect(Collectors.toMap(TargetSystemAuditMark::getChangeId, TargetSystemAuditMark::getOperation));
137137

138138
ExecutionPlanRequest requestBody = CloudExecutionPlanMapper.toRequest(
139139
loadedStages,

0 commit comments

Comments
 (0)