Skip to main content

Module contracts

Module contracts 

Source
Expand description

bynk-contracts.json generation per Worker (v0.177, #643).

The contract hash a context’s Worker entry compares an incoming X-Bynk-Contract against, per on call service — the same constants the entry stamps, written where the driver can read them.

Why the driver needs them: the runtime check fails closed, but it does so in production, on live traffic, after the skewed pair is already deployed. deploy can know sooner. It records each context’s hashes when it pushes, so a later deploy --context A can compare A’s compiled view of its dependencies against what those dependencies actually have live, and refuse before the push rather than let requests 409 (ADR 0193’s D4 gate already checks a dependency exists; this extends it to matches).

Why a file rather than an API: the driver has two compile paths, and under a bynkc override the compiler is a child process handing back an exit status — there is no in-memory model to consult. A fact the compiler knows must reach the driver in the build output, or not at all (ADR 0195 D5, the same reasoning as bynk-secrets.json).

Structs§

ContractParts
What one context’s contract manifest says, before it is rendered, so a [deploy.workers.<key>] group’s members (one Worker, one file) can be merged (#3562).
Shapes
#2485: the structured shape text (bynk_check::contract_compat) beside each hash the manifest records: provides by service, expects by dependency then service.

Constants§

CONTRACTS_MANIFEST
The file the driver reads, beside each Worker’s wrangler.toml.

Functions§

emit_contracts_manifest
Render a context’s contract manifest: what it provides, and what it expects of each context it consumes.