Files
floci/src/main/java/io/github
David 4ee5a528f3 fix(lambda): give each published version its own copy of the code (#3041)
A published version's metadata was immutable but the directory it named was
not. CodeStore.getCodePath has no version component, so every version shared
one directory with $LATEST and publishVersion copied only the codeLocalPath
pointer. UpdateFunctionCode replaces that directory wholesale, so a redeploy
silently rewrote what an already-published version ran: the version kept
advertising the CodeSha256 it was published with while the bytes behind it
were a different build, and ContainerLauncher tar-copies that directory at
launch, so a qualified invoke executed $LATEST's code.

publishVersion now copies the code into a directory belonging to that version.
Image-backed and hot-reload functions keep the reference they had: an image is
already immutable by digest, and a hot-reload function's bind-mounted directory
is meant to track the working tree. A copy failure falls back to the shared
path rather than failing the publish.

Version directories live under a "<function>@versions" container rather than as
"<function>.v<n>" siblings. sanitizeName maps every name into [a-zA-Z0-9_.-],
so no function can produce a directory name containing "@" and the two
namespaces cannot overlap. A prefix scan over flat siblings could not be made
correct: FunctionName has no charset validation in floci today, so a function
genuinely named "foo.v1" owns the directory "foo"'s version 1 would claim, and
deleting either corrupted the other.

DeleteFunction with a qualifier now reclaims that version's directory, inside
the per-function lock it already held, and only when the version actually owned
one. Previously nothing but whole-function delete reclaimed version code, so a
repeated publish/delete cycle grew on disk without bound.

Closes #2958
2026-09-06 14:07:43 -05:00
..