Skip to main content

HOST_API_VERSION

Constant HOST_API_VERSION 

Source
pub const HOST_API_VERSION: u32 = 2;
Expand description

The version of the ctx surface this build exposes.

Bump this whenever ctx gains, loses or changes a function. It is a cache-key input, and it has to be: a result computed by a build where ctx.readFile did not exist is not a valid result for a build where it does — the rule could not have called something that was not there, so its cached verdict was reached without evidence it would have used.

Nothing detects this automatically. A function added without bumping it serves stale results silently, which is the failure mode the whole cache design is arranged against.

The component engine does not have this problem, and the difference is worth knowing about while this number is still here. lanekeep-wasm’s half of the same cache-key field is a content hash of wit/world.wit, the file its bindings are generated from, so it moves when the surface moves and nobody has to remember. lanekeep_engine folds both into one field; this one leaves with the last JavaScript rule, and until then it is the half that can be got wrong.

History:

  • 1 — reporting, navigation, binding resolution, emitFact, readFile, fileExists.
  • 2structureFingerprint: the structural-summary primitive (normalized subtree hash plus exact node count), computed host-side in one walk.