Expand description
A Worker’s binding names must be unique (bynk.context.duplicate_binding).
A Worker’s bindings come from derivations that know nothing of each other:
the KV namespace’s fixed crate::firstparty::KV_BINDING_NAME, a consumed
context’s name (a.b → A_B), an agent’s class name (OrderEntity →
ORDER_ENTITY) and a derived capability’s (Billing →
SERVICE_BILLING). Two of them can meet: an agent Kv in a context that
consumes bynk.cloudflare { Kv } is KV twice, and an agent
ServiceBilling and a capability Billing = Service are both
SERVICE_BILLING. Wrangler takes such a
config without complaint and one binding hides the other, so the clash is
a compile error. The names themselves are never adjusted to avoid it,
because deployed Workers depend on them.
The names are the emitter’s (bynk_emit::emitter::wrangler:: worker_bindings, the list wrangler.toml is written from); this module
owns the check over them and the diagnostic.
Structs§
- Worker
Binding - One binding a Worker declares: the name its
envfield and itswrangler.tomlentry share, and where that name came from.
Enums§
- Binding
Source - What put a binding into a Worker’s
wrangler.toml: the source abynk.context.duplicate_bindingdiagnostic names.
Functions§
- duplicate_
bindings - The bindings in
bindingswhose name an earlier one already took, each paired with that earlier one, in list order. - instance_
binding_ name - S4a (#1966): the Worker binding name of a derived capability, the kind’s
prefix then the capability name in
screaming_snakecase (Sessions→KV_SESSIONS,PriceCache→KV_PRICE_CACHE). - phase_
duplicate_ bindings bynk.context.duplicate_binding: each context’s Worker declares every binding name once.bindingsholds each context’s bindings as itswrangler.tomlwould list them. One error per clash, at the declaration that brought in the second binding (an agent, or aconsumesclause), preferring one the author wrote overconsumes bynk.cloudflare, naming both sources. A clash between two sources with no declaration of their own (Service Bindings added for event subscribers) is reported at the context’s name.- screaming_
snake - A declaration’s name in screaming snake case (
OrderEntity→ORDER_ENTITY): the casing of an agent’s binding and of a derived capability’s. One function, so the two kinds of name the duplicate check compares cannot drift apart (review of #1968).