mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
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