From 7f9cfc7f183650db1cbfbb687215510b73bbd1ab Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Wed, 22 Apr 2026 21:31:48 +0200 Subject: [PATCH] core(deploy): add deployedConfigSnapshot field to Deployment model Appends DeploymentConfigSnapshot deployedConfigSnapshot to the Deployment record and adds a matching withDeployedConfigSnapshot wither. All positional call sites (repository mapper, test fixture) updated to pass null; Task 1.4 will wire real persistence and Task 1.5 will populate the field on RUNNING transition. Co-Authored-By: Claude Sonnet 4.6 --- .../app/storage/PostgresDeploymentRepository.java | 1 + .../alerting/eval/DeploymentStateEvaluatorTest.java | 2 +- .../com/cameleer/server/core/runtime/Deployment.java | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cameleer-server-app/src/main/java/com/cameleer/server/app/storage/PostgresDeploymentRepository.java b/cameleer-server-app/src/main/java/com/cameleer/server/app/storage/PostgresDeploymentRepository.java index 91aa4c0a..1715e008 100644 --- a/cameleer-server-app/src/main/java/com/cameleer/server/app/storage/PostgresDeploymentRepository.java +++ b/cameleer-server-app/src/main/java/com/cameleer/server/app/storage/PostgresDeploymentRepository.java @@ -172,6 +172,7 @@ public class PostgresDeploymentRepository implements DeploymentRepository { rs.getString("container_name"), rs.getString("error_message"), resolvedConfig, + null, // deployedConfigSnapshot — wired in Task 1.4 deployedAt != null ? deployedAt.toInstant() : null, stoppedAt != null ? stoppedAt.toInstant() : null, rs.getTimestamp("created_at").toInstant() diff --git a/cameleer-server-app/src/test/java/com/cameleer/server/app/alerting/eval/DeploymentStateEvaluatorTest.java b/cameleer-server-app/src/test/java/com/cameleer/server/app/alerting/eval/DeploymentStateEvaluatorTest.java index 5f345ffa..06424525 100644 --- a/cameleer-server-app/src/test/java/com/cameleer/server/app/alerting/eval/DeploymentStateEvaluatorTest.java +++ b/cameleer-server-app/src/test/java/com/cameleer/server/app/alerting/eval/DeploymentStateEvaluatorTest.java @@ -48,7 +48,7 @@ class DeploymentStateEvaluatorTest { private Deployment deployment(DeploymentStatus status) { return new Deployment(DEP_ID, APP_ID, UUID.randomUUID(), ENV_ID, status, null, null, List.of(), null, null, "orders-0", null, - Map.of(), NOW.minusSeconds(60), null, NOW.minusSeconds(120)); + Map.of(), null, NOW.minusSeconds(60), null, NOW.minusSeconds(120)); } @Test diff --git a/cameleer-server-core/src/main/java/com/cameleer/server/core/runtime/Deployment.java b/cameleer-server-core/src/main/java/com/cameleer/server/core/runtime/Deployment.java index d4153c68..374262d7 100644 --- a/cameleer-server-core/src/main/java/com/cameleer/server/core/runtime/Deployment.java +++ b/cameleer-server-core/src/main/java/com/cameleer/server/core/runtime/Deployment.java @@ -19,6 +19,7 @@ public record Deployment( String containerName, String errorMessage, Map resolvedConfig, + DeploymentConfigSnapshot deployedConfigSnapshot, Instant deployedAt, Instant stoppedAt, Instant createdAt @@ -27,6 +28,13 @@ public record Deployment( return new Deployment(id, appId, appVersionId, environmentId, newStatus, targetState, deploymentStrategy, replicaStates, deployStage, containerId, containerName, errorMessage, resolvedConfig, - deployedAt, stoppedAt, createdAt); + deployedConfigSnapshot, deployedAt, stoppedAt, createdAt); + } + + public Deployment withDeployedConfigSnapshot(DeploymentConfigSnapshot snapshot) { + return new Deployment(id, appId, appVersionId, environmentId, status, + targetState, deploymentStrategy, replicaStates, deployStage, + containerId, containerName, errorMessage, resolvedConfig, + snapshot, deployedAt, stoppedAt, createdAt); } }