Expand description
wrangler.toml generation per Worker (v0.8 §4.4 / §4.5).
Each context becomes a Cloudflare Worker with its own wrangler config.
Service Bindings are declared for every consumed context. Durable
Object bindings + exports entries are declared for every agent.
Constants§
- COMPATIBILITY_
DATE - Compile-time pinned compatibility date. Cloudflare uses this to lock
Workers runtime behaviour. When to bump it, and the gate a bump must pass,
is the policy in
design/bynk-release-discipline.md(“Part 3 — The Workers compatibility date”, #1677): reviewed at each release, and moved only after the workerd smokes pass on the new date. - DEFAULT_
COMPATIBILITY_ FLAGS - #1890: the compatibility flags every emitted Worker carries, ahead of the
project’s own (
bynk.toml’s[workers] compatibility_flags). - EVENTS_
FANOUT_ CLASS_ NAME - Events track, slice 0 (spine #936, ADR 0284): the class name of a
publishing context’s fan-out Durable Object (
emitter::events_fanout). Shared withemitter::workers(theEnvfield name +deps. __eventsDispatchcall it drives) andemitter::events_fanout(the class this name must actually export) so the three can never drift apart. - FOREIGN_
SERVICE_ DOUBLE_ STATUS - Interop I5 (#1972): the status of the stand-in for a foreign Worker that
bynk devbinds by default and the integration test harness binds always. 503, not a 2xx: the stand-in served nothing, and code that ignores the status should not mistake it for the Worker’s answer. - KV_
BINDING_ NAME - The bare
Kv’s binding (KV), re-exported forbynk deploy, which reads generated configs and tells the bare namespace from derived instances by it (S4b, #1967). The fixed Worker binding name for the Kv namespace (decision C1, v0.19): one namespace, one[[kv_namespaces]]stanza, oneenv.KVfield. - KV_
NAMESPACE_ ID_ PLACEHOLDER - Deploy-time sentinel in generated Worker configuration. The driver replaces this with the persistent Cloudflare KV namespace id immediately before a remote Wrangler command runs.
- WRANGLER_
MIN - #1732: the oldest wrangler whose bundled
workerdservesCOMPATIBILITY_DATE. An olderworkerdrefuses a newer date outright (wrangler devexits: “This Worker requires compatibility date …”), sobynk doctorwarns about a wrangler below this. Set by the same compatibility-date review that sets the date (Part 3’s lag rule keeps it at least three months old).bynk-emit/tests/compat_date_policy.rschecks the policy doc names both.
Functions§
- compatibility_
flags - #1890: the flags a Worker’s
wrangler.tomlcarries, and the duplicates dropped on the way.DEFAULT_COMPATIBILITY_FLAGScome first, thenextra(the manifest’s list) in order. A name already present, whether a default or earlier inextra, is dropped and returned in the second list, once per extra occurrence, for the caller to warn about. Names are not otherwise checked. - foreign_
service_ double_ body - Interop I5 (#1972): the body of that stand-in’s every response, saying
what it is.
bynk devadds how to reach the real Worker instead. - kv_
bindings_ needing_ ids - The bindings of a generated
wrangler.toml’s[[kv_namespaces]]entries whoseidis still that binding’s deploy-time placeholder (kv_id_placeholder), in file order: whatmaterialise_kv_namespace_idswould patch. Exposed so a caller can learn which ids it needs before doing the (possibly fallible) work of finding them, asbynk dev --remotedoes before it reads the ledger. Empty for a config with no KV, or one already materialised. - kv_
id_ placeholder - The deploy-time placeholder a
[[kv_namespaces]]entry forbindingcarries untilbynk deploymaterialises it:KV_NAMESPACE_ID_PLACEHOLDERfor the bareKV,kv_instance_id_placeholderfor a derived instance (S4b, #1967). - kv_
instance_ id_ placeholder - S4a (#1966): the deploy-time id placeholder of a derived KV instance’s
[[kv_namespaces]]entry:KV_SESSIONS→<KV_SESSIONS_ID>. - kv_
instance_ title - S4b (#1967): the account-facing title stem of a derived instance’s KV
namespace,
<worker>-<capability, kebab>:shop-cartandKV_SESSIONSgiveshop-cart-sessions,KV_PRICE_CACHEgivesshop-cart-price-cache. Read off the binding, which is a function of the capability’s name, so a renamed capability is a new title.bynk deployenvironment-qualifies it. - materialise_
kv_ namespace_ ids - Materialise deploy-time KV namespace ids in a generated
wrangler.toml’s text, structurally, by binding (S4b, #1967). Each[[kv_namespaces]]entry whose binding has an id inids, and whoseidis currently exactly that binding’s placeholder (kv_id_placeholder), gets the id; the decor around the value (the# set at deploy timenote) is kept. - materialise_
r2_ bucket_ names - P5 (#2323): point
[[r2_buckets]]entries at their deploy-time bucket names, structurally, by binding: each entry whose bindingnameslists gets thatbucket_name. The generated name is the unqualified derived one (r2_bucket_name); an environment qualifies it. Unchanged text when nothing differs, asmaterialise_kv_namespace_ids. - materialise_
ratelimit_ namespace_ ids - P3 (#2342): write each rate limiter’s allocated
namespace_idover its placeholder, structurally, byname, leaving itssimple = { … }and comment as they are. Unchanged text when nothing matches, asmaterialise_kv_namespace_ids. - r2_
bucket_ entries - A generated
wrangler.toml’s[[r2_buckets]]entries as(binding, bucket_name, jurisdiction), in file order; an entry missing a binding or a name is skipped. - r2_
bucket_ name - P5 (#2323): the account-facing name of an
R2instance’s bucket,<worker>-<capability, kebab>:shop-cartandR2_ARCHIVESgiveshop-cart-archives. R2 bucket names are scoped to the account (not the Worker), so the Worker’s name carries the uniqueness.bynk deployenvironment-qualifies it. - ratelimit_
namespace_ placeholder - P3 (#2342): the placeholder
namespace_idof rate limiterbinding, whichbynk deployreplaces with the id the ledger allocates. Miniflare takes it as it is, sobynk devruns with it. - ratelimits_
needing_ ids - P3 (#2342): the rate limiters whose
namespace_idis still its placeholder, byname, in file order. - retarget_
services - Interop I5 (#1972): point Service Bindings at other Workers, structurally,
by binding: each
[[services]]entry whose bindingtargetsnames gets thatservice.bynk devuses it to bind a foreign Worker to its local stand-in, which runs under a name of its own so that it never answers for the real Worker in wrangler’s shared dev registry. Unchanged text when nothing matches, asmaterialise_kv_namespace_ids.