docs(lambda): correct the FunctionName charset claim in CodeStore (#3310)

The Javadoc on getVersionsPath, and the matching comment in CodeStoreTest,
say floci "does not restrict the character set of FunctionName today, only
that it is non-blank". That is wrong. LambdaArnUtils.validateName has
validated the name since #450, against [a-zA-Z0-9-_.]+ with a 256 character
ceiling.

The conclusion both comments draw is unaffected: a dot is an accepted
character, so "foo.v1" really is a function a user can create, and it really
would have collided with a "<name>.v<n>" sibling directory. Only the stated
reason was wrong, and it misdescribes the validation a reader would go on to
look for. Both now name the actual pattern and point at #3238, which tracks
the divergence from the live service.

Comments only. No behaviour change.

Refs #3238
This commit is contained in:
David authored and GitHub committed 2026-09-09 16:31:33 -04:00
1 parent b988dc5d1a
commit a339f3ae70
2 files changed
+13 -11

No files matched your search

@@ -122,12 +122,13 @@ class CodeStoreTest {
@Test
void aVersionDirectoryCannotCollideWithAnotherFunctionsOwnDirectory(@TempDir Path baseDir)
throws IOException {
// Floci does not restrict the character set of FunctionName today, only that it is
// non-blank, so "foo.v1" is a function a user can genuinely create. A "<name>.v<n>" sibling
// naming scheme handed it the exact directory version 1 of "foo" would claim, so deleting
// either function silently corrupted the other. The suffix used instead is outside the
// character set sanitizeName can emit, which makes the two namespaces disjoint by
// construction rather than by a prefix match that has to guess where the name ends.
// A dot is an accepted character in a function name: LambdaArnUtils validates against
// [a-zA-Z0-9-_.]+, which is wider than the live service (issue #3238), so "foo.v1" is a
// function a user can genuinely create. A "<name>.v<n>" sibling naming scheme handed it the
// exact directory version 1 of "foo" would claim, so deleting either function silently
// corrupted the other. The suffix used instead is outside the character set sanitizeName
// can emit, which makes the two namespaces disjoint by construction rather than by a prefix
// match that has to guess where the name ends.
CodeStore store = new CodeStore(baseDir);
writeHandler(store.getVersionCodePath(ACCOUNT_A, REGION, "foo", "1"), "foo-v1");
writeHandler(store.getCodePath(ACCOUNT_A, REGION, "foo.v1"), "other-function");