From 69217dff2a574ea8fd0308e824b6c06ee875275a Mon Sep 17 00:00:00 2001 From: Hector Ventura Date: Wed, 23 Sep 2026 21:42:33 -0500 Subject: [PATCH] fix(cloudformation): key the Lambda hot-reload identity on the Docker host path (#4275) LambdaCfnProvisioner.canonicalHotReloadPath spelled the identity with Path.normalize().toString() while LambdaService stores the path through toDockerHostPath (#4080), the POSIX form Docker receives whatever separator the JVM uses. lambdaCodeChanged compares the two, so on a Windows-hosted JVM every stack update looked like a code change and re-mounted the same directory. The provisioner now reuses the Lambda helper, made public for it, so the identity and the stored path cannot drift. Follow-up to #4093. --- .../provisioners/LambdaCfnProvisioner.java | 12 +++++++----- .../floci/services/lambda/LambdaService.java | 8 ++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaCfnProvisioner.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaCfnProvisioner.java index 859d498afa..d57995f41d 100644 --- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaCfnProvisioner.java +++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaCfnProvisioner.java @@ -407,14 +407,16 @@ public class LambdaCfnProvisioner implements CfnResourceProvisioner { /** * The form LambdaService stores a hot-reload host path in: normalized, so {@code /a/../b/} - * and {@code /b} are the same mount. Identities and change detection use it so a redeploy - * that only rewrites the path spelling, or a function adopted from a direct CreateFunction, - * is not mistaken for a code change. The raw key still goes to Lambda, which validates it and - * reports its own error for a path it cannot use. + * and {@code /b} are the same mount, and rendered as the POSIX path Docker receives + * ({@link LambdaService#toDockerHostPath}), so the identity agrees with + * {@code getHotReloadHostPath()} on every host separator. Identities and change detection use + * it so a redeploy that only rewrites the path spelling, or a function adopted from a direct + * CreateFunction, is not mistaken for a code change. The raw key still goes to Lambda, which + * validates it and reports its own error for a path it cannot use. */ private static String canonicalHotReloadPath(String s3Key) { try { - return Path.of(s3Key).normalize().toString(); + return LambdaService.toDockerHostPath(Path.of(s3Key).normalize()); } catch (InvalidPathException e) { return s3Key; } diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java index 5b8e490231..bc73712385 100644 --- a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java +++ b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java @@ -3011,8 +3011,12 @@ public class LambdaService implements ResourceProvider { LOG.infov("Hot-reload configured for function {0}: bind-mounting {1}", fn.getFunctionName(), resolvedHostPath); } - /** Docker on the host expects a POSIX path, whatever separator the JVM running Floci uses. */ - static String toDockerHostPath(Path normalized) { + /** + * Docker on the host expects a POSIX path, whatever separator the JVM running Floci uses. + * Public because the CloudFormation provisioner keys its hot-reload identity on the same form, + * so change detection agrees with what {@link #applyHotReload} stored. + */ + public static String toDockerHostPath(Path normalized) { StringBuilder path = new StringBuilder(); for (Path name : normalized) { path.append('/').append(name);