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).

Constants§

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