ReqManagedAgents.Provisioner.Name (ReqManagedAgents v0.13.3)

Copy Markdown View Source

Composes a provider resource name as <base>_<digest> under a Policy.

The digest is the content address and is never truncated — it is what makes two identical specs resolve to one resource. When the composed name would exceed the policy limit, the base is shortened and a short hash of the full base is appended, so two bases sharing a long common prefix cannot collapse onto the same name. Plain truncation would: two AgentCore harness bases can share a 17-character prefix and still name distinct agents.

Summary

Functions

Builds <base>_<digest>, sanitised and fitted to policy.

True when name still carries base verbatim, i.e. the composition did not truncate it.

Functions

compose(base, digest, policy)

Builds <base>_<digest>, sanitised and fitted to policy.

A base that is empty (or sanitises to empty) still yields a legal name — the leading-character rule supplies one — so callers with neither a prefix nor a spec name keep working.

preserves_base?(name, base)

@spec preserves_base?(String.t(), String.t()) :: boolean()

True when name still carries base verbatim, i.e. the composition did not truncate it.

Callers that later parse the base back out of a name — to recover the digest, or to test that a name belongs to a base — depend on this. A truncated name cannot be parsed back, so such a caller must refuse it rather than store it.