Skip to content

Commit 4151a9e

Browse files
authored
refactor: updated reporting metadata (#916)
1 parent 90f6b8a commit 4151a9e

10 files changed

Lines changed: 32 additions & 32 deletions

File tree

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/core/response/data/ExecuteResponseData.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ExecuteResponseData {
4040
private int failedStages;
4141
private int totalChanges;
4242
private int appliedChanges;
43-
private int skippedChanges;
43+
private int alreadyAppliedChanges;
4444
private int failedChanges;
4545
private int notReachedChanges;
4646

@@ -63,7 +63,7 @@ private ExecuteResponseData(Builder builder) {
6363
this.failedStages = builder.failedStages;
6464
this.totalChanges = builder.totalChanges;
6565
this.appliedChanges = builder.appliedChanges;
66-
this.skippedChanges = builder.skippedChanges;
66+
this.alreadyAppliedChanges = builder.alreadyAppliedChanges;
6767
this.failedChanges = builder.failedChanges;
6868
this.notReachedChanges = builder.notReachedChanges;
6969
this.stages = builder.stages != null ? builder.stages : new ArrayList<>();
@@ -157,12 +157,12 @@ public void setAppliedChanges(int appliedChanges) {
157157
this.appliedChanges = appliedChanges;
158158
}
159159

160-
public int getSkippedChanges() {
161-
return skippedChanges;
160+
public int getAlreadyAppliedChanges() {
161+
return alreadyAppliedChanges;
162162
}
163163

164-
public void setSkippedChanges(int skippedChanges) {
165-
this.skippedChanges = skippedChanges;
164+
public void setAlreadyAppliedChanges(int alreadyAppliedChanges) {
165+
this.alreadyAppliedChanges = alreadyAppliedChanges;
166166
}
167167

168168
public int getFailedChanges() {
@@ -213,7 +213,7 @@ public static class Builder {
213213
private int failedStages;
214214
private int totalChanges;
215215
private int appliedChanges;
216-
private int skippedChanges;
216+
private int alreadyAppliedChanges;
217217
private int failedChanges;
218218
private int notReachedChanges;
219219
private List<StageResult> stages = new ArrayList<>();
@@ -273,8 +273,8 @@ public Builder appliedChanges(int appliedChanges) {
273273
return this;
274274
}
275275

276-
public Builder skippedChanges(int skippedChanges) {
277-
this.skippedChanges = skippedChanges;
276+
public Builder alreadyAppliedChanges(int alreadyAppliedChanges) {
277+
this.alreadyAppliedChanges = alreadyAppliedChanges;
278278
return this;
279279
}
280280

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/core/response/data/ExecutionReportFormatter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static String summary(ExecuteResponseData result) {
7575
String counts = String.format(
7676
"; changes newly_applied=%d, already_applied=%d, failed=%d, not_reached=%d; duration=%dms",
7777
result.getAppliedChanges(),
78-
result.getSkippedChanges(),
78+
result.getAlreadyAppliedChanges(),
7979
result.getFailedChanges(),
8080
result.getNotReachedChanges(),
8181
result.getTotalDurationMs());
@@ -112,7 +112,7 @@ public static String report(ExecuteResponseData result) {
112112
sb.append(" Changes: ")
113113
.append(result.getTotalChanges()).append(" total — ")
114114
.append(result.getAppliedChanges()).append(" newly applied, ")
115-
.append(result.getSkippedChanges()).append(" already applied, ")
115+
.append(result.getAlreadyAppliedChanges()).append(" already applied, ")
116116
.append(result.getFailedChanges()).append(" failed, ")
117117
.append(result.getNotReachedChanges()).append(" not reached")
118118
.append(NEWLINE);

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/core/response/data/StageResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public int getAppliedCount() {
141141
.count();
142142
}
143143

144-
public int getSkippedCount() {
144+
public int getAlreadyAppliedCount() {
145145
return (int) changes.stream()
146146
.filter(ChangeResult::isAlreadyApplied)
147147
.count();

core/flamingock-core-commons/src/test/java/io/flamingock/internal/common/core/response/FileResponseChannelTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void shouldWriteValidJsonToFile() throws Exception {
6363
.completedStages(1)
6464
.totalChanges(3)
6565
.appliedChanges(2)
66-
.skippedChanges(1)
66+
.alreadyAppliedChanges(1)
6767
.failedChanges(0)
6868
.totalDurationMs(500)
6969
.build();

core/flamingock-core-commons/src/test/java/io/flamingock/internal/common/core/response/ResponseSerializationTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void shouldSerializeAndDeserializeExecuteResponseData() throws Exception {
6666
.failedStages(0)
6767
.totalChanges(5)
6868
.appliedChanges(3)
69-
.skippedChanges(2)
69+
.alreadyAppliedChanges(2)
7070
.failedChanges(0)
7171
.addStage(StageResult.builder()
7272
.stageId("stage-1")
@@ -93,7 +93,7 @@ void shouldSerializeAndDeserializeExecuteResponseData() throws Exception {
9393
assertEquals(2, deserialized.getCompletedStages());
9494
assertEquals(5, deserialized.getTotalChanges());
9595
assertEquals(3, deserialized.getAppliedChanges());
96-
assertEquals(2, deserialized.getSkippedChanges());
96+
assertEquals(2, deserialized.getAlreadyAppliedChanges());
9797
assertEquals(0, deserialized.getFailedChanges());
9898
assertEquals(1, deserialized.getStages().size());
9999
assertEquals("stage-1", deserialized.getStages().get(0).getStageId());
@@ -156,7 +156,7 @@ void shouldSerializeResponseEnvelopeWithPolymorphicData() throws Exception {
156156
.completedStages(1)
157157
.totalChanges(2)
158158
.appliedChanges(2)
159-
.skippedChanges(0)
159+
.alreadyAppliedChanges(0)
160160
.failedChanges(0)
161161
.totalDurationMs(500)
162162
.build();

core/flamingock-core-commons/src/test/java/io/flamingock/internal/common/core/response/data/ExecutionReportFormatterTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void summaryOnSuccess() {
4343
.failedStages(0)
4444
.totalChanges(3)
4545
.appliedChanges(3)
46-
.skippedChanges(0)
46+
.alreadyAppliedChanges(0)
4747
.failedChanges(0)
4848
.totalDurationMs(120)
4949
.build();
@@ -237,7 +237,7 @@ void reportCountsRolledBackChangeAsFailedAndListsItsId() {
237237
ExecuteResponseData result = ExecuteResponseData.builder()
238238
.status(ExecutionStatus.FAILED)
239239
.totalStages(1).failedStages(1)
240-
.totalChanges(6).appliedChanges(0).skippedChanges(5).failedChanges(1)
240+
.totalChanges(6).appliedChanges(0).alreadyAppliedChanges(5).failedChanges(1)
241241
.totalDurationMs(221)
242242
.stages(Collections.singletonList(stage))
243243
.build();
@@ -284,7 +284,7 @@ void reportAllUpToDateShowsNoChangesHeadlineAndUpToDateRowsInBreakdown() {
284284
ExecuteResponseData result = ExecuteResponseData.builder()
285285
.status(ExecutionStatus.NO_CHANGES)
286286
.totalStages(1).upToDateStages(1).notReachedStages(0).failedStages(0)
287-
.totalChanges(6).appliedChanges(0).skippedChanges(6).failedChanges(0)
287+
.totalChanges(6).appliedChanges(0).alreadyAppliedChanges(6).failedChanges(0)
288288
.stages(Collections.singletonList(upToDate))
289289
.build();
290290

@@ -359,7 +359,7 @@ void reportPartialCoverageMixesReachedUpToDateAndNotReached() {
359359
ExecuteResponseData result = ExecuteResponseData.builder()
360360
.status(ExecutionStatus.FAILED)
361361
.totalStages(4).completedStages(1).upToDateStages(1).notReachedStages(1).failedStages(1)
362-
.totalChanges(10).appliedChanges(3).skippedChanges(3).failedChanges(1).notReachedChanges(3)
362+
.totalChanges(10).appliedChanges(3).alreadyAppliedChanges(3).failedChanges(1).notReachedChanges(3)
363363
.totalDurationMs(170)
364364
.stages(Arrays.asList(block1, block2, block3, block4))
365365
.build();

core/flamingock-core/src/main/java/io/flamingock/internal/core/pipeline/execution/StageExecutor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ public Output executeStage(ExecutableStage executableStage,
118118
resultBuilder.stopTimer().completed();
119119
Duration stageDuration = Duration.between(stageStart, LocalDateTime.now());
120120
StageResult stageResult = resultBuilder.build();
121-
logger.info("Stage completed [stage={} duration={} applied={} skipped={}]",
122-
stageName, formatDuration(stageDuration), stageResult.getAppliedCount(), stageResult.getSkippedCount());
121+
logger.info("Stage completed [stage={} duration={} applied={} alreadyApplied={}]",
122+
stageName, formatDuration(stageDuration), stageResult.getAppliedCount(), stageResult.getAlreadyAppliedCount());
123123
return new Output(stageResult);
124124

125125
} catch (StageExecutionException stageExecutionException) {

core/flamingock-core/src/main/java/io/flamingock/internal/core/pipeline/run/PipelineRun.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public ExecuteResponseData toResponse() {
376376
int failedStages = 0;
377377
int totalChanges = 0;
378378
int appliedChanges = 0;
379-
int skippedChanges = 0;
379+
int alreadyAppliedChanges = 0;
380380
int failedChanges = 0;
381381
int notReachedChanges = 0;
382382
boolean anyFailed = false;
@@ -415,7 +415,7 @@ public ExecuteResponseData toResponse() {
415415
if (change.getStatus() == ChangeStatus.APPLIED) {
416416
appliedChanges++;
417417
} else if (change.getStatus() == ChangeStatus.ALREADY_APPLIED) {
418-
skippedChanges++;
418+
alreadyAppliedChanges++;
419419
} else if (change.getStatus() == ChangeStatus.FAILED
420420
|| change.getStatus() == ChangeStatus.ROLLED_BACK) {
421421
// ROLLED_BACK counts as a failed attempt for the user-facing aggregate.
@@ -455,7 +455,7 @@ public ExecuteResponseData toResponse() {
455455
.failedStages(failedStages)
456456
.totalChanges(totalChanges)
457457
.appliedChanges(appliedChanges)
458-
.skippedChanges(skippedChanges)
458+
.alreadyAppliedChanges(alreadyAppliedChanges)
459459
.failedChanges(failedChanges)
460460
.notReachedChanges(notReachedChanges)
461461
.stages(stages)

core/flamingock-core/src/test/java/io/flamingock/internal/core/pipeline/run/PipelineRunToResponseTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void twoCompletedStagesYieldsSuccessAndCountersRollUp() {
7878
assertEquals(0, response.getFailedStages());
7979
assertEquals(4, response.getTotalChanges()); // 3 (loaded alpha) + 1 (loaded beta)
8080
assertEquals(3, response.getAppliedChanges()); // 2 + 1
81-
assertEquals(1, response.getSkippedChanges()); // 1 + 0
81+
assertEquals(1, response.getAlreadyAppliedChanges()); // 1 + 0
8282
assertEquals(0, response.getFailedChanges());
8383
}
8484

@@ -187,7 +187,7 @@ void rolledBackChangeIsCountedAsFailedInAggregate() {
187187
ExecuteResponseData response = pipelineRun.toResponse();
188188
assertEquals(3, response.getTotalChanges());
189189
assertEquals(0, response.getAppliedChanges());
190-
assertEquals(2, response.getSkippedChanges());
190+
assertEquals(2, response.getAlreadyAppliedChanges());
191191
assertEquals(1, response.getFailedChanges(),
192192
"ROLLED_BACK must be counted as failed in the user-facing aggregate");
193193
}
@@ -235,8 +235,8 @@ void upToDateVerdictWithAuditPopulatedChangesAggregatesAsExpected() {
235235
assertEquals(ExecutionStatus.NO_CHANGES, response.getStatus());
236236
assertEquals(1, response.getUpToDateStages());
237237
assertEquals(0, response.getNotReachedStages());
238-
assertEquals(6, response.getSkippedChanges(),
239-
"ALREADY_APPLIED records added by the planner must roll up into skippedChanges");
238+
assertEquals(6, response.getAlreadyAppliedChanges(),
239+
"ALREADY_APPLIED records added by the planner must roll up into alreadyAppliedChanges");
240240
assertEquals(0, response.getAppliedChanges());
241241
assertEquals(0, response.getFailedChanges());
242242
assertEquals(PlannerVerdict.UP_TO_DATE, response.getStages().get(0).getPlannerVerdict());
@@ -267,7 +267,7 @@ void markStageAlreadyAppliedFromAuditDefensiveMergeRespectsOperationWrites() {
267267

268268
ExecuteResponseData response = pipelineRun.toResponse();
269269
assertEquals(1, response.getAppliedChanges(), "alpha-c0 stays APPLIED");
270-
assertEquals(1, response.getSkippedChanges(), "alpha-c1 becomes ALREADY_APPLIED");
270+
assertEquals(1, response.getAlreadyAppliedChanges(), "alpha-c1 becomes ALREADY_APPLIED");
271271
assertEquals(0, response.getNotReachedChanges(), "no NOT_REACHED records left");
272272
assertEquals(2, response.getStages().get(0).getChanges().size());
273273
}
@@ -298,7 +298,7 @@ void midStageFailurePreservesNotReachedForUnprocessedChanges() {
298298
ExecuteResponseData response = pipelineRun.toResponse();
299299
assertEquals(5, response.getTotalChanges());
300300
assertEquals(2, response.getAppliedChanges());
301-
assertEquals(0, response.getSkippedChanges());
301+
assertEquals(0, response.getAlreadyAppliedChanges());
302302
assertEquals(1, response.getFailedChanges());
303303
assertEquals(2, response.getNotReachedChanges(),
304304
"trailing unprocessed changes must remain NOT_REACHED after merge");

core/flamingock-core/src/test/java/io/flamingock/internal/core/plan/community/CommunityExecutionPlannerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ void shouldEnrichOperationTouchedStageWithAuditOnlyChanges() {
366366
// Aggregate reporting reflects the enriched view: 1 applied this run, 1 already at target.
367367
io.flamingock.internal.common.core.response.data.ExecuteResponseData response = pipelineRun.toResponse();
368368
assertEquals(1, response.getAppliedChanges());
369-
assertEquals(1, response.getSkippedChanges());
369+
assertEquals(1, response.getAlreadyAppliedChanges());
370370
assertEquals(0, response.getFailedChanges());
371371
}
372372

0 commit comments

Comments
 (0)