fix(deploy): address final review — sensitiveKeys snapshot, dirty scrubbing, transition race, refetch invalidations

- Issue 1: add List<String> sensitiveKeys as 4th field to DeploymentConfigSnapshot; populate
  from agentConfig.getSensitiveKeys() in DeploymentExecutor; handleRestore hydrates from
  snap.sensitiveKeys directly; Deployment type in apps.ts gains sensitiveKeys field
- Issue 2: after createApp succeeds, refetchQueries(['apps', envSlug]) before navigate so the
  new app is in cache before the router renders the deployed view (eliminates transient Save-
  disabled flash)
- Issue 3: useDeploymentPageState useEffect now uses prevServerStateRef to detect local edits;
  background refetches only overwrite form when no local changes are present
- Issue 5: handleRedeploy invalidates dirty-state + versions queries after createDeployment
  resolves; handleSave invalidates dirty-state after staged save
- Issue 10: DirtyStateCalculator strips volatile agentConfig keys (version, updatedAt, updatedBy,
  environment, application) before JSON comparison via scrubAgentConfig(); adds
  versionBumpDoesNotMarkDirty test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-22 23:29:01 +02:00
parent 6d5ce60608
commit d33c039a17
8 changed files with 78 additions and 20 deletions

View File

@@ -261,10 +261,12 @@ public class DeploymentExecutor {
ApplicationConfig agentConfig = applicationConfigRepository
.findByApplicationAndEnvironment(app.slug(), env.slug())
.orElse(null);
List<String> snapshotSensitiveKeys = agentConfig != null ? agentConfig.getSensitiveKeys() : null;
DeploymentConfigSnapshot snapshot = new DeploymentConfigSnapshot(
deployment.appVersionId(),
agentConfig,
app.containerConfig()
app.containerConfig(),
snapshotSensitiveKeys
);
pgDeployRepo.saveDeployedConfigSnapshot(deployment.id(), snapshot);

View File

@@ -61,7 +61,8 @@ class PostgresDeploymentRepositoryIT extends AbstractPostgresIT {
DeploymentConfigSnapshot snapshot = new DeploymentConfigSnapshot(
jarVersionId,
agentConfig,
Map.of("memoryLimitMb", 1024, "replicas", 2)
Map.of("memoryLimitMb", 1024, "replicas", 2),
null
);
UUID deploymentId = repository.create(appId, appVersionId, envId, "test-container");
@@ -92,7 +93,8 @@ class PostgresDeploymentRepositoryIT extends AbstractPostgresIT {
DeploymentConfigSnapshot snapshot = new DeploymentConfigSnapshot(
jarVersionId,
new ApplicationConfig(),
Map.of()
Map.of(),
null
);
UUID deploymentId = repository.create(appId, appVersionId, envId, "test-container-clear");