Files
floci/docs
Jackson Price f22c2a4db1 feat(cloudformation): support SAM's optional AutoPublishAlias version properties (#5823)
* feat(cloudformation): support SAM's optional AutoPublishAlias version properties

With AutoPublishAlias, read the three function properties SAM uses to
shape the version it publishes:

- AutoPublishCodeSha256: a string names the version by its first ten
  characters instead of the hash, so new code under the same value
  publishes nothing. A Ref to a parameter resolves first.
- AutoPublishAliasAllProperties: the hash covers every property the
  transform gives the function, plus its SnapStart.
- VersionDeletionPolicy: the version's DeletionPolicy when the
  function sets none; a function with a CapacityProviderConfig
  defaults to Delete, any other to Retain. An intrinsic value is
  copied unresolved, as SAM copies it.

Each gets SAM's type checks and messages: AutoPublishCodeSha256 must
be a string and make an alphanumeric id, AutoPublishAliasAllProperties
a boolean, and VersionDeletionPolicy Delete or Retain, only with
AutoPublishAlias.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin the default Ref hash and AutoPublishAliasAllProperties coverage

Keep the check that a Ref in the code changes the version id without
AutoPublishAliasAllProperties, and show that with it a Timeout change
names a new version and false hashes as if the property were absent.
Pin that an AutoPublishCodeSha256 Ref resolving to an empty value
leaves the hash in place. The docs say that ids under
AutoPublishAliasAllProperties are floci's own and that a Ref to a
parameter works for AutoPublishCodeSha256.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): refuse AutoPublishCodeSha256 in SAM Globals

SAM refuses a Globals property it does not list for a section, and
Globals.Function does not list AutoPublishCodeSha256. Now that the
property names the version, merging it from Globals would give every
function the same version id, so a code change would never publish.
Refuse the template with SAM's message, without the list of supported
properties that SAM appends.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin the AutoPublishAliasAllProperties ids and SAM version updates

Pin two version ids under AutoPublishAliasAllProperties to the SHA-1 of
the generated function's properties, worked out by hand, and that a
given AutoPublishCodeSha256 still names the version there. Show that
Globals.Function carries AutoPublishAliasAllProperties and
VersionDeletionPolicy. On a stack, a Timeout change under
AutoPublishAliasAllProperties publishes version 2 with the new timeout,
and VersionDeletionPolicy: Delete reports the replaced version
DELETE_COMPLETE instead of DELETE_SKIPPED. An intrinsic
VersionDeletionPolicy is copied unresolved, which the assertion now
says.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): say when a new SAM version id publishes

Say which statements about the version id hold by default, that
AutoPublishCodeSha256 outranks AutoPublishAliasAllProperties and cannot
come from Globals, and when a new id publishes nothing: SnapStart, a new
AutoPublishCodeSha256 alone, or, under AutoPublishAliasAllProperties, a
Tags or ReservedConcurrentExecutions change, which AWS fails with "A
version for this Lambda function exists". A hot-reloaded function
publishes for every new id. State the DeletionPolicy order, and that
CloudFormation takes intrinsic functions only in resource properties,
outputs, metadata and update policies. The javadocs of the version id
and of AutoPublishAlias say the same.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): note IgnoreGlobals and LanguageExtensions for SAM versions

Say that floci does not honour IgnoreGlobals, so a function cannot opt
out of a VersionDeletionPolicy in Globals, and that an intrinsic
VersionDeletionPolicy reaches CloudFormation only through a transform
such as AWS::LanguageExtensions, which floci does not implement. Under
AutoPublishAliasAllProperties the code's parameter references are still
resolved, and any SnapStart change publishes nothing.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin the SnapStart id under AutoPublishAliasAllProperties

Pin the id a SnapStart with ApplyOn None gives under
AutoPublishAliasAllProperties, worked out by hand like the others, and
show that a version VersionDeletionPolicy: Delete reports deleted is
still listed, as the docs say floci keeps every version it publishes.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): say that IgnoreGlobals is the opt-out floci ignores

A function can still clear a Globals VersionDeletionPolicy with a null
of its own; what floci does not honour is IgnoreGlobals.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-17 14:04:04 -04:00
..
2026-03-15 17:43:56 -05:00